Skip to content

In-depth lesson · Race condition

Typical fixes

Every point the Race condition reports back under this heading, best-backed first, each with the reports it is seen in.

Back to the lesson 1 to 49 of 49
  1. Enforce limits with atomic counters or database constraints rather than a separate check

    Seen in 7 reports
  2. Use file descriptors opened with no-follow semantics and avoid check-then-use on paths

    Seen in 6 reports
  3. Use atomic check-and-record operations for follow and reaction endpoints

    Seen in 4 reports
  4. Record votes with an atomic insert or unique constraint per user and item

    Seen in 3 reports
  5. Lock or serialise redemption so the balance update and validation happen in one transaction

    Seen in 3 reports
  6. Enforce membership uniqueness with a database constraint and an atomic insert

    Seen in 3 reports
  7. Add idempotency keys and locking to payout and retest payment processing

    Seen in 2 reports
  8. Perform email change and verification in a single database transaction tied to the specific change request

    Seen in 2 reports
  9. Protect the shared resolver buffer with a mutex

    Seen in 2 reports
  10. Isolate privileged file operations from concurrent manipulation

    Seen in 2 reports
  11. Make vote and entry counting atomic per account

    Seen in 2 reports
  12. Make transaction handling atomic

    Seen in 2 reports
  13. Lock the approval record and enforce one approval per user per merge request

    Seen in 1 report
  14. Remove approvals synchronously when a new commit is pushed

    Seen in 1 report
  15. Make the flag check and point award atomic and idempotent

    Seen in 1 report
  16. Treat parallel reset requests as one operation so cancelling one cancels all

    Seen in 1 report
  17. Lock the balance during transfer validation and deduction

    Seen in 1 report
  18. Make the balance check and transfer a single atomic step

    Seen in 1 report
  19. Enforce eligibility with an atomic lock per account

    Seen in 1 report
  20. Add a database-level constraint preventing cyclic parent-child relationships

    Seen in 1 report
  21. Set a restrictive umask at daemon startup

    Seen in 1 report
  22. Make reference counting thread-safe

    Seen in 1 report
  23. Add proper locking around the IPv6 packet options structure

    Seen in 1 report
  24. Add locking and ownership checks around shared path pointers

    Seen in 1 report
  25. Sanitise user-supplied job IDs before using them in file paths

    Seen in 1 report
  26. Complete certificate validation before deciding to reuse a connection

    Seen in 1 report
  27. Match queued responses to their originating requests

    Seen in 1 report
  28. Zero-fill buffers even when allocation times out

    Seen in 1 report
  29. Copy or lock shared buffers before decoding

    Seen in 1 report
  30. Prevent iterator replay of previously executed writes

    Seen in 1 report
  31. Synchronise teardown of shared handles with list destruction

    Seen in 1 report
  32. Make the GSS context per-thread or protect it with a lock

    Seen in 1 report
  33. Guard against double close of eventfd descriptors

    Seen in 1 report
  34. Make the resume check and append atomic

    Seen in 1 report
  35. Verify and use the file through the same descriptor

    Seen in 1 report
  36. Make lock screen state changes atomic

    Seen in 1 report
  37. Invalidate all concurrent sessions on logout

    Seen in 1 report
  38. Serialise ban and unban actions

    Seen in 1 report
  39. Make membership changes atomic

    Seen in 1 report
  40. Bind recovery steps to a single flow instance

    Seen in 1 report
  41. Check purchase before accepting a publish request

    Seen in 1 report
  42. Make creation checks atomic

    Seen in 1 report
  43. Make review submission checks atomic per user

    Seen in 1 report
  44. Match pipelined responses reliably to their requests

    Seen in 1 report
  45. Add database constraints instead of relying on application-level validation

    Seen in 1 report
  46. Make security feature checks atomic with their use

    Seen in 1 report
  47. Synchronise feature entitlement checks across parallel requests

    Seen in 1 report