Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data race between ThreadPool.Performance.read and ...Performance.add #866

Open
IntegratedQuantum opened this issue Dec 31, 2024 · 0 comments
Labels
bug something isn't working in the intended way engine

Comments

@IntegratedQuantum
Copy link
Member

Trace:

  Read of size 8 at 0x7ffff7e2b088 by main thread:
    #0 __tsan_memcpy ??:? (Cubyzig+0xda8dfb)
    #1 utils.ThreadPool.Performance.read /home/mint/Cubyz/src/utils.zig:1118 (Cubyzig+0x54703f)
    #2 windows.debug.render /home/mint/Cubyz/src/gui/windows/debug.zig:71 (Cubyzig+0x4a6072)
    #3 GuiWindow.render /home/mint/Cubyz/src/gui/GuiWindow.zig:488 (Cubyzig+0x4c2e84)
    #4 gui.updateAndRenderGui /home/mint/Cubyz/src/gui/gui.zig:548 (Cubyzig+0x475968)
    #5 main.main /home/mint/Cubyz/src/main.zig:669 (Cubyzig+0x46473c)
    #6 start.callMain /home/mint/Cubyz/compiler/zig/lib/std/start.zig:608 (Cubyzig+0x46321b)
    #7 start.callMainWithArgs /home/mint/Cubyz/compiler/zig/lib/std/start.zig:577 (Cubyzig+0x46321b)
    #8 start.main /home/mint/Cubyz/compiler/zig/lib/std/start.zig:592 (Cubyzig+0x46321b)
    #9 __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58 (libc.so.6+0x29d8f) (BuildId: 490fef8403240c91833978d494d39e537409b92e)

  Previous atomic write of size 4 at 0x7ffff7e2b08c by thread T5:
    #0 atomic.Value(u32).swap /home/mint/Cubyz/compiler/zig/lib/std/atomic.zig:48 (Cubyzig+0x5a2d50)
    #1 Thread.Mutex.FutexImpl.lockSlow /home/mint/Cubyz/compiler/zig/lib/std/Thread/Mutex.zig:189 (Cubyzig+0x5a2d50)
    #2 Thread.Mutex.FutexImpl.lock /home/mint/Cubyz/compiler/zig/lib/std/Thread/Mutex.zig:154 (Cubyzig+0x4ed91c)
    #3 Thread.Mutex.DebugImpl.lock /home/mint/Cubyz/compiler/zig/lib/std/Thread/Mutex.zig:74 (Cubyzig+0x479452)
    #4 Thread.Mutex.lock /home/mint/Cubyz/compiler/zig/lib/std/Thread/Mutex.zig:34 (Cubyzig+0x479452)
    #5 utils.ThreadPool.Performance.add /home/mint/Cubyz/src/utils.zig:1099 (Cubyzig+0x71a595)
    #6 utils.ThreadPool.run /home/mint/Cubyz/src/utils.zig:1205 (Cubyzig+0x6789bc)
    #7 Thread.callFn__anon_31500 /home/mint/Cubyz/compiler/zig/lib/std/Thread.zig:409 (Cubyzig+0x5b539d)
    #8 Thread.PosixThreadImpl.spawn__anon_15663.Instance.entryFn /home/mint/Cubyz/compiler/zig/lib/std/Thread.zig:678 (Cubyzig+0x50379f)

Not a big deal since this value is never read after copying, but it still clogs up the thread sanitizer output.

@IntegratedQuantum IntegratedQuantum added bug something isn't working in the intended way engine labels Dec 31, 2024
@IntegratedQuantum IntegratedQuantum added this to the Long-Term Goals milestone Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something isn't working in the intended way engine
Projects
None yet
Development

No branches or pull requests

1 participant