Closed VanDerLars closed 1 year ago
ECONNRESET
is the error code that Node.js returns if the TCP has been closed unexpectedly, usually either due to a lossy connection or due to a firewall closing it or dropping packets.
It might be that they're rate-limiting requests from your servers' IP addresses. I've observed similar behaviour with my servers.
I would suggest
cached-hafas-client
, but it has rather conservative default TTLs, so consider tweaking them.Also we monitor the Hafas Endpoint of Deutsche Bahn (reiseauskunft.bahn.de) with updown.io. The availability constantly got worse over the last weeks.
Do you monitor their endpoint directly, or do you monitor your API which pings their endpoint?
Do you monitor their endpoint directly, or do you monitor your API which pings their endpoint?
We monitor their endpoint directly.
Actually, we were able to reproduce the issue locally. So, it seems that even if they have rate-limiting, it is not IP-based.
Actually, we were able to reproduce the issue locally. So, it seems that even if they have rate-limiting, it is not IP-based.
I'm not entirely sure about this. I've definitely run into IP-based rate limits even while developing locally, albeit with many requests. There might also be multiple limits in place, based on multiple factors.
I'll close this Issue, given that I don't have control over how HaCon and/or DB run the HAFAS endpoint.
You're very welcome to post more findings about the ECONNRESET
errors though!
what we see:
ECONRESET
seemingly happens randomlyECONRESET
happens, but we see no patternwe "solved" by just retrying the same calls. the second, least the third attempt mostly work
Note that hafts-client
provides retry.js
for this. Its current logic merely aborts on ENOTFOUND
errors and retries otherwise:
@derhuerst thanks for the tipp.
@Issam-Jendoubi could ne a better approach, let's discuss that.
Since some days we see the following behavior:
We make a call over Hafas Client and we get the following error message instead of the result:
{"error":{"message":"request to https://reiseauskunft.bahn.de/bin/mgate.exe?checksum=660a896737929f3e112c5e5679151ba7 failed, reason: read ECONNRESET","type":"system","errno":"ECONNRESET","code":"ECONNRESET"}}
When we retry the exact same call one or two times, then the result comes often.
Also we monitor the Hafas Endpoint of Deutsche Bahn (reiseauskunft.bahn.de) with updown.io. The availability constantly got worse over the last weeks.
What could be the reason?
Do you know a way how to avoid the ECONNRESET error?