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 races #198

Open
1 task done
dnzbk opened this issue Mar 11, 2024 · 0 comments
Open
1 task done

Data races #198

dnzbk opened this issue Mar 11, 2024 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@dnzbk
Copy link
Collaborator

dnzbk commented Mar 11, 2024

Is there already an issue for your problem?

  • I have checked older issues, open and closed

NZBGet Version

v23-stable

Platform

All

Environment

OS version: Windows 11 WSL2 Debian 12, x86_64
CPU architecture: 64bit
Running in Docker: No

Current Behavior

GCC thread sanitizer warns of a lot of issues regarding data race.

Expected Behavior

All data race issues should be resolved.

Steps To Reproduce

  1. Build the Debug version with `-fsanitize=thread' flag;
  2. Run the binary;

Logs

==================
WARNING: ThreadSanitizer: data race (pid=1399)
Write of size 8 at 0x7b4c00000310 by main thread:
#0 CString::Set(char const*, int) /home/asus/nzbget/daemon/util/NString.cpp:123 (nzbget+0x23e427)
#1 CString::operator=(char const*) /home/asus/nzbget/daemon/util/NString.h:70 (nzbget+0x1c0b8)
#2 NCursesFrontend::SetHint(char const*) /home/asus/nzbget/daemon/frontend/NCursesFrontend.cpp:639 (nzbget+0xa266e)
#3 NCursesFrontend::~NCursesFrontend() /home/asus/nzbget/daemon/frontend/NCursesFrontend.cpp:171 (nzbget+0xa06f3)
#4 NCursesFrontend::~NCursesFrontend() /home/asus/nzbget/daemon/frontend/NCursesFrontend.cpp:172 (nzbget+0xa0741)
#5 std::default_delete::operator()(Thread*) const (nzbget+0xbc0a8)
#6 std::unique_ptr<Thread, std::default_delete >::~unique_ptr() /usr/include/c++/12/bits/unique_ptr.h:396 (nzbget+0xb67d4)
#7 NZBGet::~NZBGet() /home/asus/nzbget/daemon/main/nzbget.cpp:249 (nzbget+0xaf92b)
#8 std::default_delete::operator()(NZBGet*) const (nzbget+0xc1913)
#9 std::__uniq_ptr_impl<NZBGet, std::default_delete >::reset(NZBGet*) (nzbget+0xc19ab)
#10 std::unique_ptr<NZBGet, std::default_delete >::reset(NZBGet*) (nzbget+0xba951)
#11 RunMain() /home/asus/nzbget/daemon/main/nzbget.cpp:1046 (nzbget+0xb3252)
#12 main /home/asus/nzbget/daemon/main/nzbget.cpp:154 (nzbget+0xaf843)

Previous read of size 8 at 0x7b4c00000310 by thread T2:
#0 CString::Empty() const /home/asus/nzbget/daemon/util/NString.h:78 (nzbget+0x1c13e)
#1 NCursesFrontend::PrintKeyInputBar() /home/asus/nzbget/daemon/frontend/NCursesFrontend.cpp:579 (nzbget+0xa2325)
#2 NCursesFrontend::Update(int) /home/asus/nzbget/daemon/frontend/NCursesFrontend.cpp:279 (nzbget+0xa0b75)
#3 NCursesFrontend::Run() /home/asus/nzbget/daemon/frontend/NCursesFrontend.cpp:208 (nzbget+0xa0872)
#4 Thread::thread_handler() /home/asus/nzbget/daemon/util/Thread.cpp:115 (nzbget+0x24c930)
#5 operator() /home/asus/nzbget/daemon/util/Thread.cpp:63 (nzbget+0x24c665)
#6 __invoke_impl<void, Thread::Start()::<lambda()> > /usr/include/c++/12/bits/invoke.h:61 (nzbget+0x24cf5a)
#7 __invoke<Thread::Start()::<lambda()> > /usr/include/c++/12/bits/invoke.h:96 (nzbget+0x24ced5)
#8 _M_invoke<0> /usr/include/c++/12/bits/std_thread.h:252 (nzbget+0x24ce3a)
#9 operator() /usr/include/c++/12/bits/std_thread.h:259 (nzbget+0x24cde4)
#10 _M_run /usr/include/c++/12/bits/std_thread.h:210 (nzbget+0x24cd9e)
#11 (libstdc++.so.6+0xd44a2)

As if synchronized via sleep:
#0 usleep ../../../../src/libsanitizer/tsan/tsan_interceptors_posix.cpp:351 (libtsan.so.2+0x61e11)
#1 Util::Sleep(int) /home/asus/nzbget/daemon/util/Util.cpp:821 (nzbget+0x24fc43)
#2 NZBGet::StopFrontend() /home/asus/nzbget/daemon/main/nzbget.cpp:624 (nzbget+0xb15e5)
#3 NZBGet::Run(bool) /home/asus/nzbget/daemon/main/nzbget.cpp:741 (nzbget+0xb1f36)
#4 RunMain() /home/asus/nzbget/daemon/main/nzbget.cpp:1042 (nzbget+0xb31f5)
#5 main /home/asus/nzbget/daemon/main/nzbget.cpp:154 (nzbget+0xaf843)

       ...

==================
ThreadSanitizer: reported 93 warnings

Extra information

No response

@dnzbk dnzbk added the bug Something isn't working label Mar 11, 2024
@dnzbk dnzbk self-assigned this Mar 11, 2024
@luckedea luckedea added this to the v25 milestone May 8, 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
Projects
None yet
Development

No branches or pull requests

2 participants