Skip to content

Writing to socket in Node.js 19 passes null in callback #47229

@armanbilge

Description

@armanbilge

Version

v19.8.1

Platform

Linux armanbilge-sandbox-g0l1nfjuvbe 5.15.0-47-generic #51-Ubuntu SMP Thu Aug 11 07:51:15 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

const net = require("net");

const server = net.createServer();

server.listen(
  "tmp.sock",
  function() {
    const socket = new net.Socket();
    socket.connect(
      "tmp.sock",
      function() {
        socket.write(
          "hello world",
          function(x) {
            console.log(x);
            socket.destroy();
            server.close();
          }
        );
      }
    )
  }
);

How often does it reproduce? Is there a required condition?

No response

What is the expected behavior? Why is that the expected behavior?

$ npx node@18 unix.js 
undefined

What do you see instead?

$ npx node@19 unix.js 
null

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    netIssues and PRs related to the net subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions