-
Notifications
You must be signed in to change notification settings - Fork 46
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
Client may crash during shutdown when ShutdownTask is being run #430
Conversation
…ect after runnable is finished. An e.g. scenario: ShutdownTask is started, client is shutdown and client destructor is being executed which causes the ClientConnectionManagerImpl to be destructed and the shared_ptr in connectionManager.shutdownThreads is destructed and since there is no other reference to the thread, the thread object is also destructed while the thread did not finish the runnableThread method. This fix simply do not delete the heap allocated shutdown thread. We assume that there will not be too many of such threads, and hence the leak can be ignored.
Windows test PASSed. |
Linux test PASSed. |
…e the illegal memory access when the client is shutdown e.g. during heartbeat failure and the client object is destructed already (the destructor waits on a latch which is released once the ShutdownTask::run is finished. Hence the ShutdownTask thread should not access the possibly destructed client on thread destructor where the name of the thread is written. fixes hazelcast#428 fixes hazelcast#429 Cleaned up unused header file and corrected the exception print at the ClientPartitionServiceImpl.
Windows test PASSed. |
Linux test PASSed. |
1 similar comment
Linux test PASSed. |
Windows test PASSed. |
Have built against latest hazelcast::master as of 2nd July, and re-run test for #428 & #429. Now seeing SEGV in non-debug version of hazelcast library, or abort debug of hazelcast library (see below) Core was generated by `sif /opt/engine/conf/sif.cfg'. |
@siwhiting Thanks for the feedback, seems like we could not solve the problem yet. I commented here: #429 (comment) and reopened the issue. We need a better approach to not let the client instance impl. destruct until the shutdown thread completes. |
Fix for issues #428 and #429. Do not access any object after runnable is finished. An e.g. scenario: ShutdownTask is started, client is shutdown and client destructor is being executed which causes the ClientConnectionManagerImpl to be destructed and the shared_ptr in connectionManager.shutdownThreads is destructed and since there is no other reference to the thread, the thread object is also destructed while the thread did not finish the runnableThread method.
Do not access any client object after ShutdownTask runnable is finished. Obtain the client name at the constructor of ShutdownTask to eliminate the illegal memory access when the client is shutdown e.g. during heartbeat failure and the client object is destructed already (the destructor waits on a latch which is released once the ShutdownTask::run is finished. Hence the ShutdownTask thread should not access the possibly destructed client on thread destructor where the name of the thread is written.
fixes #428
fixes #429