-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Describe the bug
When testing new OTP build we found that erlang:disconnect_node may cause net_kernel hang forever.
This is because net_kernel does exit(Ctrlr, disconnect) and infinitely wait for a {'EXIT',Ctrlr,Reason} reply.
However, tls_sender will trap the EXIT message and ignore it when dist_handle = undefined. This could happen when handshake is not complete.
After this, as long as the connection is alive (i.e. peer node does not close the connection), net_kernel will hang.
To Reproduce
Repeatedly call erlang:disconnect_node when establishing ssl dist connection
Expected behavior
when receiving disconnect request, tls_sender should shutdown even without dist_handle
I have checked that adding this clause in tls_sender fixes this problem:
handle_common(info, {'EXIT', _Dist, disconnect}, StateData) ->
{stop, {shutdown, disconnect}, StateData};
Affected versions
After this commit b0f82ee