-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
the mining threads leak a mutex and there is unreasonable string::empty() usage #2514
Comments
You refer to this by "mutex leak" ? Can you point to the line where you think the mutex is destroyed early?
Ah. That will be useful. Not the first time I wrote empty when I meant clear.
It is more useful if you link to exact places in the code when you discuss them. |
By mutex leak I mean a thread is terminated (joined) without unlocking a mutex it owns its lock you prevent the thread from start mining before affinity setting by using a mutex Now the work_main method owns the lock and starts to work :
but after this in the next line the mutex is released so the unique_lock no longer owns it and it has to be unlocked manually
according to this https://en.cppreference.com/w/cpp/thread/unique_lock/release and from here https://en.cppreference.com/w/cpp/thread/mutex/~mutex so this line should be removed so unique_lock unlocks the mutex on exit or replaced by this :
For the telemetry it is accessed only by one thread which is ex_main So there is no need to use any mutex, and those are the mutexes I mean : again no need for exclusive lock or shared lock |
Ah. Got it. Another empty vs clear :>
@psychocrypt Did that lock fall out of favour, or is this something you never got round to?
C++14 feature I'm afraid. Back when I wrote this, most distros struggled with having compliant C++11 gcc version. |
thx for the bug report: first bug |
solve partly fireice-uk#2514 Remove a mutex which is not needed at all because all data are accessed from one thread only.
@cppdev-123 you are right the mutex in telemetry is absolute bullshit and useless. |
fix fireice-uk#2514 - use `unlock()` instead of `relase()` - fix NVIDIA affinity setting
fix the release issue #2530 |
I close this issue because all reported problems should be fixed when #2530 is merged. Thanks again for reporting! |
in the work main function there is a mutex leak
in this code :
if the thread exits after releasing the mutex and the class is destructed (deleted) in debug builds this will hit a break point saying : mutex destroyed while busy
also in the executor.cpp there are two uses for the method empty of the string class like this :
motd.empty();
note that this method is marked with nodiscard in c++17 to issue a compiler warning
also in the telemetry class the telem member of executor class is accessed by the ex_main thread only so why using an array for mutex (one per running backend) ?
the miner works well when these mutexes are removed from the code
The text was updated successfully, but these errors were encountered: