englercj / node-esl

FreeSWITCH ESL implementation for Node.js; implements the full Event Socket Library specified in: http://wiki.freeswitch.org/wiki/Esl
http://englercj.github.com/node-esl/
MIT License
170 stars 111 forks source link

Timeouts #76

Closed nvitaly closed 5 years ago

nvitaly commented 5 years ago

Hello,

we are running node-esl in a busy system. by design, it creates a new connection for each command and we are having around 20 connections per second (very short). Sometimes we are getting timeouts:

authorizing state: null, authed state: false, connecting state: false, connected state: true authorizing state: null, authed state: false, connecting state: true, connected state: false

Could you please suggest what we might be hitting, I do not see TCP attempts for failed connections in tcpdump. linux limits all "unlimited" or crazy high, It must be something internal Node.js

Thank you in advance.

byoungdale commented 5 years ago

There is no internal node.js limit unless you set it yourself in your code. If you are not even seeing TCP attempts in a tcpdump, then my first guess is your operating system file descriptor limits.

How are you starting your node process? Sometimes, even if you have setup your ulimit file descriptor values, they will not be used (see the answers here).

julzvilla commented 5 years ago

@byoungdale I'm working with @nvitaly on this... I was able to narrow down part of the problem on the Node-ESL side.

In a happy case, the connection flow is as follow:

  1. Node creates TCP Socket connection to FreeSwitch
  2. Node receives 'auth/request' event
  3. Node initiates the auth process

When testing 25+ simultaneous connections, I'm seeing that the event in step 2 does not always happen. This prevents the auth process and hence the "timeout" that we're experiencing.

Any idea why that might be happening?

I'm considering skipping that event listener and going straight to the auth process after the TCP connection.

englercj commented 5 years ago

Closing this because it sounds like a ulimit or freeswitch configuration issue. If we get more details or encounter a more specific node problem feel free to open a new issue.