Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session Randomly dropped by the server | ECONNRESET #251

Open
sam08sk opened this issue Mar 22, 2024 · 9 comments
Open

Session Randomly dropped by the server | ECONNRESET #251

sam08sk opened this issue Mar 22, 2024 · 9 comments

Comments

@sam08sk
Copy link

sam08sk commented Mar 22, 2024

Hello,

I have a decent understanding of this library. However, I cannot resolve a random disconnection issue that keeps happening. Every few minutes or sometimes hours, the client gets disconnected from the SMPP server and gives only the following error in the logs

2024-03-22T11:30:38: Error: read ECONNRESET
2024-03-22T11:30:38:     at TCP.onStreamRead (node:internal/stream_base_commons:217:20) {
2024-03-22T11:30:38:   errno: -104,
2024-03-22T11:30:38:   code: 'ECONNRESET',
2024-03-22T11:30:38:   syscall: 'read'
2024-03-22T11:30:38: }

I have tried inspecting this but there is no error I can pinpoint that cause this. TCP dump taken reveals that the server sends [FIN, ACK] packet that causes disconnection. My best guess is that the client does not send "enquire_link" quickly enough and this causes disconnection. The client cannot change the enquire_link_interval period which is 60 seconds. Is there a way to increase the window we wait for enquire_link PDU before we disconnect? Is my understanding flawed here?

Also, I tried handling this by using session.on("error", (){}) but it doesn't work. I cannot even catch and log this error.

I would appreciate any help.

-Thanks in advance

@dotsinspace
Copy link

dotsinspace commented Mar 23, 2024

Same...Have you find the solution ?

@dotsinspace
Copy link

This is why i start hating this library...no support nothing.

@sam08sk
Copy link
Author

sam08sk commented Apr 22, 2024

@juliangut @farhadi Hey guys, I just need some direction here. What part is responsible for dropping the connection if the server doesn't receive enquire_link_pdu in time? And where is this time interval written? Is it 60s, or 30s? I would really appreciate any guidance.

You've done solid work here, especially with the proxy protocol support.

-Thanks in advance

@dotsinspace
Copy link

@sam08sk enquire_link can be set to anything generally its between 50 to 60. now you have to make sure to respond to the client on event enquire_link with response..thats it and it should not be a issue.

How you have used the proxy protocol..truly i didn't know what it does...Please help

@sam08sk
Copy link
Author

sam08sk commented Apr 30, 2024

@dotsinspace The client is sending enquire_link every 60 seconds, the server randomly sends a disconnect signal (FIN packet) to the client which causes the disconnection. This does not happen if the client is sending enquire_link every 30 seconds. So I am wondering where this particular setting could be.

The proxy protocol is only used in complex systems. Where there is an external load balancer that faces the internet, and then an internal load balancer in front of our SMPP server. The original IP of the client is lost in this kind of setup and can be preserved in the proxy protocol. Nginx has similar support. To get the original IP of the client in these kinds of setups, the proxy protocol is a must-have.

-Cheers

@dotsinspace
Copy link

@sam08sk you can set this setting on your side in auto_enquire_link_period. Please make to add enquire_link as per client need. over and all if enquire_link is 30 then client has to send packet within 30seconds to make sure that connection is live. same for you if you are creating session. you have to make sure to set auto_enquire_link_period as per your need.

This library has one huge issue and that is ( Contributers ) are not responding or anyone is not responding on issues of this library.

@sam08sk
Copy link
Author

sam08sk commented May 2, 2024

@dotsinspace Thank you for your response. A look at the source reveals that the auto_enquire_link_period option is for the client, not the server, am I right? On the server side, there is no such option. I am only accepting SMPP connections from clients, I am not connecting to any server via SMPP using this library. When these clients connect, if they don't send enquire_link for a "time" the connection is dropped by this library. Where is this "time" set?

I understand the inability to respond, such is the nature of open source I guess. I appreciate you taking the time and suggest a possible solution.

-Cheers

@dotsinspace
Copy link

As far as i know the process. when client connects then Client has to make sure that they send enquire_link in timely manner for which your server has to respond back to the client with ROK on enquire_link_resp. now coming to the time part...i think you should try it with 55s to 60s. Why because library doesn't provide any straight forward documentation on it and i have tested it..and 55s to 60s ensures smooth connection else you can set setTimeout on socket using JS Proxy.

@dotsinspace
Copy link

dotsinspace commented May 14, 2024

@sam08sk did you found out the reason for CONNECTION RESET ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants