-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Need an explicit way to signal when it is safe to destroy an endpoint #501
Comments
Firstly, you'll want to get rid of the call to To rephrase the issue then: In the case where you are using a shared Asio io_service pool where you can't simply wait until the asio pool is empty. When is it safe to let the server endpoint go out of scope? I don't have a great answer immediately. A stopgap would be to simply wait at least as long as the close handshake timeout (default is 5 seconds, but you can configure that). Longer term, I will look at two changes:
|
change number 1 is in pull #537 |
adds related changelog entry and fix one overzealous find and replace operation.
@jupp0r's patch has been committed to develop. This should fix the crash when log entries are printed after an endpoint is deallocated. Any further testing from folks who were experiencing this problem would be appreciated. |
Seems to work for me. I had an accept loop that would occasionally die for no discernible reason -- analyzing the problem led me to discover that my code was affected by this issue. I upgraded from websocketpp 0.7.0 to develop a month ago, and my accept loop doesn't die anymore. |
I have a application that allows creating and removing new servers at runtime.
To do this I have a wrapper class that contains a instance of
In the constructor I initialize the server instance using this code:
Inside my destructor I stop listening and iterate over all connections calling close on them.
Afterwards I call stop on the server
However I have a problem.
Some time later when the server tries to write anything to the log it crashes while locking the mutex in logger/basic.hpp
I suppose that some operations are still running in the asio pool which try to access the already closed log file.
Is this the correct way to shutdown the server ?
How can I force the server to wait for all its asynchronous tasks to exit.
I can not shutdown the asio pool because it is shared by several tasks.
I'm not sure whether my code is wrong or not.
The text was updated successfully, but these errors were encountered: