In that case replacing the log line with an actual sleep should also work, right? How long? I tries sleeping for 1ms but the bug returned.

Reply to this note

Please Login to reply.

Discussion

are you working in Go? if so you can pass the -race flag go test/build/run to invoke the race detector

Not necessarily. Does the log write direct or is there flushing, batched kernel io, etc? (Just pulling shit out of thin air without knowing context)

That is to say; *any* work can affect a race condition outcome. But that work may not be happening where you think it is, for all sorts of reasons.

Hard to make suggestions with no context but generated code and strace are good tools. Tricky if working within many layers of abstraction.

Meant to type *”comparing generated code”

Thank you. Yes, there are many layers.

Which platform? Nodejs, Deno, Bun, Lambda?

Another possibility is that it is not a race condition and that the log is causing a memory allocation which in turn changes the location of subsequent allocations.

I.e. it could be a memory safety issue; use after free, buffer overrun, etc. ASan can be helpful in this scenario.