Comments (7)
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!
from hafas-client.
@derhuerst thanks for the tipp.
@Issam-Jendoubi could ne a better approach, let's discuss that.
from hafas-client.
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
- checking how many requests you're actually sending to them.
- investigating if this error appears with specific requests (e.g. specific HAFAS methods or specific stop IDs) only, in oder to rule out other possible causes.
- implementing a caching mechanism. β You could use
cached-hafas-client
, but it has rather conservative default TTLs, so consider tweaking them. - possibly requesting from more IP addresses.
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?
from hafas-client.
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.
from hafas-client.
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.
from hafas-client.
what we see:
ECONRESET
seemingly happens randomly- exact same request sometimes work, sometimes not
- no matter if we run it locally or in production, so there's no IP blocking
- there might be an algorithm when
ECONRESET
happens, but we see no pattern - we "solved" by just retrying the same calls. the second, least the third attempt mostly work
from hafas-client.
we "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:
Lines 15 to 31 in 4cb7062
from hafas-client.
Related Issues (20)
- Make hafas-client work in browser / webpack HOT 9
- With hafas-client@6 and db profile, getting earlier journeys is broken HOT 1
- Is there a way to query journeys from a certain timepoint to a certain time point? HOT 9
- SNCB: switch to new rest.exe API HOT 2
- PKP error - something changed? HOT 6
- DB endpoint responds with CLIENTVERSION when using user agents from docs HOT 13
- DB: make routing mode configurable, so that cancelled trips can be queried & pagination works HOT 10
- DB: server errors with stop() and ver > 1.16 HOT 6
- DB: support "best price search" HOT 10
- XSS vulnerability in some HAFAS instances HOT 3
- DB: get URL to offers HOT 20
- journeys(): Walks have wrong distance HOT 4
- /journeys invalid poi HOT 1
- support environments without support for createRequire() & JSON modules HOT 4
- wrong date parsed for next-day DEVI legs on overnight journeys HOT 4
- journeys(): Add attribute `additional` for stopovers HOT 2
- ERR_REQUIRE_ESM HOT 1
- refreshJourney never fills price HOT 2
- refreshToken: always returns 404 from/to KΓΆln/Bonn Flughafen station HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hafas-client.