question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provided socket has been destroyed

See original GitHub issue

Hey there!

I’m trying to track down an issue I’m having when running my SRF instances on Amazon through a Network Load Balancer using Outbound Connections.

I’m by no means certain it’s caused by the NLB, but the error I’m getting is: “Provided socket has been destroyed”.

It only seems to happen when I’m using the Simring, so I’m looking for some insight into the internal workings of the SRF framework.

The error is caused in drachtio-agent.js on this line: assert.ok(params.socket.destroyed !== true, 'provided socket has been destroyed');

Here is an excerpt of my code.

const register = await registrar.getNextRegistration(user, 10000); //Wait for up to 10 seconds for a new registration to happen.
if (!register) {
    info(`No registration happened within timeout for ${user}`);
    res.send(404, () => endSrf()); //===== THIS WORKS! ======
    return;
}

const simring = new Simring(req, res, [register.contact], {
    proxyResponseHeaders: [],
    headers: {
        "from": req.headers.from
    },
    localSdpB: sdp,
    localSdpA: getSdpA.bind(null, {
        'call-id': req.get('Call-Id'),
        "via-branch": via.params.branch,
        'from-tag': from.params.tag
    }, rtpEngineHost)
});

try {
    const {uas, uac} = await simring.start(); //===== THIS IMMEDIATELY FAILS ======
}
catch(err) {
    error("Error during simring: " + err, err);
    endSrf();
}

Essentially I’m wondering what causes that error. It doesn’t appear that the Outbound Connection has been torn down, as the res.send(404, () => endSrf()); works every time. It’s only Simring.start() that throws this error.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jonastelziocommented, Jul 30, 2019

@davehorton your patch seems to have done the trick! I’m now running it with the health checks being directed at the SRF port, and everything appears to be working.

0reactions
davehortoncommented, Jul 30, 2019

Excellent!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Provided socket has been destroyed · Issue #48 · drachtio/drachtio ...
Hey there! I'm trying to track down an issue I'm having when running my SRF instances on Amazon through a Network Load Balancer...
Read more >
Determine when a socket is destroyed NodeJS - Stack Overflow
is there a io.on('disconnect', function(socket) or something? I want io.emit that a particular socket has closed or finished.
Read more >
Socket Programming HOWTO — Python 3.11.1 documentation
When the connect completes, the socket s can be used to send in a request for the text of the page. The same...
Read more >
zmq — PyZMQ 25.0.0b1 documentation
term() if sockets are left open, but means that unclean destruction of contexts (with sockets left open) is not safe if sockets are...
Read more >
A tour of CPPZMQ, the C++ bindings to libzmq
When a socket destructs or if its socket_t::close() method is explicitly called, the underlying libzmq socket will be destroyed via zmq_close(3) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found