Skip to content

net: handle.onread called again after UV_EOF #32487

Closed
@ronag

Description

@ronag

A continuation of https://github.com/nodejs/node/pull/31806/files#r382938926.

On the following platforms the handle.onread is invoked again after UV_EOF unless the handle is handle.close():ed in the same tick as UV_EOF occurs.

  • win10-COMPILED_BY-vs2019
  • win2012r2-COMPILED_BY-vs2019-x86

https://github.com/nodejs/node/blob/master/lib/internal/stream_base_commons.js#L163
https://github.com/nodejs/node/blob/master/lib/net.js#L242

The workaround in #31806 is to call handle.readStop() after UV_EOF which seems to resolve the issue.

We didn't notice this previously since handle.onread is assigned a noop and/or handle.close is called, inside Socket._destroy which in turn was invoked synchronously with 'end'.

I have a VM where this is easily reproducible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    libuvIssues and PRs related to the libuv dependency or the uv binding.netIssues and PRs related to the net subsystem.windowsIssues and PRs related to the Windows platform.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions