coder/slog

Race in isTTY?

ammario opened this issue · 5 comments

We just saw this data race in coder/coder.

I'm assuming it was introduced here #167, but haven't thoroughly investigated.

@ammario It's the opposite, the issue was fixed in #167 and due to the revert, this issue became much more prevalent.

The problem must be that an os.File was wrapped without implementing SyscallConn and passed to entryhuman, which used the old behavior of .Fd() which is unsafe.

Actually, perhaps the fix in #167 was incomplete, it seems syncwriter always(?) wraps the writer, but does not implement SyscallConn, so the fix was never effective and reverted to the old unsafe behavior. Scratch that, it seems w2 (unwrapped) is what's passed to entryhuman.Fmt, so that does not seem to be the problem.

The actual issue is that #167 wasn't used. The linked error shows slog v1.5.3 being used. #167 wasn't merged until v1.5.4.

Ok.. So revert the revert?

Unreverted by #187