Thanks to visit codestin.com
Credit goes to github.com

Skip to content

net_kernel hang forever because of tls_sender racing #5708

@zzydxm

Description

@zzydxm

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

Metadata

Metadata

Assignees

Labels

bugIssue is reported as a bugteam:PSAssigned to OTP team PS

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions