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

Skip to content

Potential process leak in net_kernel with TLS distribution #5332

@aartamonau

Description

@aartamonau

Describe the bug
I've been looking at inet_tls_dist and noticed the following behavior.

A recent patch changed inet_tls_dist to do the TLS handshake in subprocesses: 14bc45e. If the subprocess receives an error from the call to inet_tcp:accept(), it exits. This in turn terminates the acceptor. But it is possible that one of the other subprocesses has just sent an {accept, ...} message to net_kernel here. This process will get killed as well. When handling the {accept,...} message, net_kernel will spawn a new process via inet_tls_dist:accept_connection() and tell AcceptPid to pass the socket to the new process. But by this point AcceptPid is either dead or about to die, and so it will never pass the socket and unblock the accept_connection() process. As far as I can tell, there's no code that would clean these processes up once net_kernel receives the EXIT message from the acceptor.

To Reproduce
Found via code inspection, I have not attempted reproducing it.

Expected behavior
There should be no leak.

Affected versions
OTP-24.1.3

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