Skip to content

DebuggerAgent: unhandled socket error event #781

Closed
@3y3

Description

@3y3

debugger_agent doesn't handle correctly socket closing.

Test case:

node --debug test

Test.js

var spawn = require('child_process').spawn;

function Debugger(port) {
  var connection = require('net').createConnection(port)
    .on('error', console.error.bind(console))
    .on('close', process.exit.bind(process))
    .setEncoding('utf8');

  process.on('exit', connection.end);
}

var _debugger = spawn('node', ['-e', '(' + Debugger + ')(5858)']);
setTimeout(_debugger.kill.bind(_debugger), 1000);

After fix this issue by:

diff --git a/deps/debugger-agent/lib/_debugger_agent.js b/deps/debugger-agent/lib/_debugger_agent.js
index 680c5e9..13f2a9f 100644
--- a/deps/debugger-agent/lib/_debugger_agent.js
+++ b/deps/debugger-agent/lib/_debugger_agent.js
@@ -97,6 +97,7 @@ function Client(agent, socket) {
   this.on('data', this.onCommand);

   var self = this;
+  this.socket.on('error', function() {});
   this.socket.on('close', function() {
     self.destroy();
   });

I receive next error:
Assertion failed: (err) == (0), file src\agent.cc, line 164
UV_EBUSY

So, I'm incompetent to fix uv errors, therefore I opened this issue.
I think this is for @indutny

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions