facebook-chat-api icon indicating copy to clipboard operation
facebook-chat-api copied to clipboard

ESOCKETTIMEDOUT in listen.js

Open ptrcnull opened this issue 6 years ago • 11 comments

I've checked #665 and there wasn't any solution to this error. Basically, every few hours I get this error and the only way to make it work again is to restart the whole bot. Stacktrace:

ERR! listen Error: ESOCKETTIMEDOUT
ERR! listen     at ClientRequest.<anonymous> (/usr/local/lib/node_modules/miscord/node_modules/request/request.js:812:19)
ERR! listen     at Object.onceWrapper (events.js:273:13)
ERR! listen     at ClientRequest.emit (events.js:182:13)
ERR! listen     at TLSSocket.emitTimeout (_http_client.js:706:34)
ERR! listen     at Object.onceWrapper (events.js:273:13)
ERR! listen     at TLSSocket.emit (events.js:182:13)
ERR! listen     at TLSSocket.Socket._onTimeout (net.js:444:8)
ERR! listen     at ontimeout (timers.js:427:11)
ERR! listen     at tryOnTimeout (timers.js:289:5)
ERR! listen     at listOnTimeout (timers.js:252:5)
ERR! listen     at Timer.processTimers (timers.js:212:10)

Yes, I do have a stable internet connection. It's hosted on DigitalOcean and I never had any issues with connection on their servers.

ptrcnull avatar Aug 21 '18 12:08 ptrcnull

Maybe this is relevant: https://stackoverflow.com/a/37946399 Sounds like you have a reliable repro, can you play with increasing the UV_THREADPOOL_SIZE? Or possibly the other answer, adding agent: false, pool: {maxSockets: 100} to the settings of request here : https://github.com/Schmavery/facebook-chat-api/blob/7470cfe9b29d30f082f76cacc08748e4e19e8c15/utils.js#L4

Schmavery avatar Aug 21 '18 17:08 Schmavery

I'll try to add it, I have currently 12 bots running so I hope I'll get some results soon

ptrcnull avatar Aug 21 '18 18:08 ptrcnull

Update: the env variable didn't help. I'll try the maxSockets option.

EDIT: it also didn't work. still getting ESOCKETTIMEDOUT

ptrcnull avatar Aug 21 '18 22:08 ptrcnull

Thanks for testing that. o.O 12 bots? I'm assuming they're on different accounts? Otherwise I wouldn't be surprised if there was some sort of rate limiting happening.

Honestly I don't really know much about what's happening here and all I'm doing is looking at stackoverflow... https://stackoverflow.com/a/43857814 This one seems to try to set keepAlive: true somehow. Could be worth a shot if you can figure it out.

Unfortunately the only other guess I would have is to somehow catch it and optionally try to retry the call (or ignore).

Schmavery avatar Aug 22 '18 07:08 Schmavery

12 bots, each on a different account and split in half to 2 separate servers. I'll try that approach, maybe this time it will work.

ptrcnull avatar Aug 22 '18 09:08 ptrcnull

any update? I receive this error too

danielriddell21 avatar Sep 03 '18 12:09 danielriddell21

I've had the same problem few days ago... over 30% of requests were failing but the same script was working fine (with no changes) after 12 hours :/ I'm wondering is this is a facebook's issue ...

ravkr avatar Sep 15 '18 00:09 ravkr

@ravkr Today it probably is a Facebook issue, I'm getting timeouts on servers that never had them...

ptrcnull avatar Sep 15 '18 21:09 ptrcnull

I also have same issue, affter 5h active account now, how to resolved it?? thanks

vanhocpham avatar May 06 '19 08:05 vanhocpham

How's this going? I am experiencing same thing as well

PixelHir avatar Jun 02 '19 16:06 PixelHir

How's this going? I am experiencing same thing as well

But it still active, I try on function api.listen(). It still run ok.

vanhocpham avatar Jun 03 '19 02:06 vanhocpham