• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

TriggerMail / lazylru / 173 / 173
86%
master: 98%

Build:
Build:
LAST BUILD BRANCH: (HEAD detached at 69bb3b2)
DEFAULT BRANCH: master
Ran 18 Jun 2024 09:49PM UTC
Files 8
Run time 1s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

18 Jun 2024 09:48PM UTC coverage: 97.222% (+0.05%) from 97.173%
173

push

buildkite

web-flow
Fixing data race (#29)

When reading and writing the same key simultaneously, there were two races that could occur while escalating the lock from a reader lock to a writer lock in the `get` method.

* The expiration check in `get` was reading `pqi.expiration`
* The returned value in `get` was reading `pqi.value`

Both of happened after the call to `lru.lock.RUnlock()`, which means that set could have modified the item that `pqi` was pointing to. We are now copying the underlying item (`*pqi`) to the stack and referencing that. This is a pessimistic way to approach this problem, but it is safe.

A test was added that highlighted these races when run with `-race`.

Thanks @coxley for pointing these out and giving me a test that showed the problem.

665 of 684 relevant lines covered (97.22%)

502.86 hits per line

Source Files on job interface - 173
  • Tree
  • List 0
  • Changed 5
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 173
  • 062025bc on github
  • Prev Job for on (HEAD detached at 062025b) (#169)
  • Next Job for on (HEAD detached at 062025b) (#174)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc