Closed softins closed 7 years ago
Hello Tony,
Thanks for reporting. Just confirm you nopoll_conn_shutdown never releases/frees (you can check it in the code). That is, nopoll_conn_shutdown never will cause memory problems (because it just updates internal states).
From there, the rest of the description must be caused by something different (passing to nopoll_conn_get_msg a reference that is already released previous, which, of cause will generate problems).
Best Regards,
Thank you for your quick response. You are right, of course, and I said I was still learning about nopoll! It looks like the issue was another thread, when it wanted to close down the connection, was calling nopoll_conn_close()
, when maybe it should be calling nopoll_conn_shutdown()
instead. Changing it to do the latter seems to have overcome the problem I was having.
Good :-) Best Regards,
nopoll_conn_get_msg()
calls__nopoll_conn_receive()
. If the connection has been closed, either by the remote party or another local thread,__nopoll_conn_receive()
logs a critical error such asand then calls
nopoll_conn_shutdown()
, which freesconn
.However, when it returns 0 to
nopoll_conn_get_msg()
, the latter continues to use the staleconn
in calls tonopoll_log()
. This could result in a crash, and at the least results in a spurious error message such asSuggestion would be to remove
nopoll_conn_shutdown()
from__nopoll_conn_receive()
, also remove these lines fromnopoll_conn_get_msg()
:and allow the lines just after that to shut down the connection.
However, I'm not yet familiar enough with nopoll to confidently submit a PR.