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

Socket hang up error #13

Closed
amishas157 opened this issue May 1, 2017 · 6 comments
Closed

Socket hang up error #13

amishas157 opened this issue May 1, 2017 · 6 comments

Comments

@amishas157
Copy link
Contributor

I am using vt2geojson for requesting vector tiles geojson in osm-compare, to get a set of features but getting following issue in few requests.
Traceback:

/app/node_modules/@mapbox/vt2geojson/index.js:34
            if (err) throw err;
                     ^
Error: socket hang up
    at createHangUpError (_http_client.js:250:15)
    at Socket.socketOnEnd (_http_client.js:342:23)
    at emitNone (events.js:91:20)
    at Socket.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:926:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickDomainCallback (internal/process/next_tick.js:122:9)

The code is here, where I am making the query.

Not sure what this means and what's causing this issue. Would be great to get some help debugging it.

cc @mapsam

@amishas157
Copy link
Contributor Author

Per voice w/ @lukasmartinelli , seems like error coming due to request getting timeout. To resolve we can try few things:

  • returning the callback with error, from vt2geojson instead of throwing it.
  • If request fails, retry it using node-retry.

Challenges: Hard to reproduce the issue locally :(

cc @batpad

@geohacker
Copy link

What if we write a script to run vt2geojson fast, to see if that can reproduce the issue? But all of the above sounds good to me.

@amishas157
Copy link
Contributor Author

@geohacker
This is a small script which I used to test it locally https://jsfiddle.net/c6ej7ekc/
And on running it , got the following error:

/Users/AmishaSingla/Documents/osm-compare/node_modules/@mapbox/vt2geojson/index.js:36
                throw err;
                ^

Error: getaddrinfo ENOTFOUND a.tiles.mapbox.com a.tiles.mapbox.com:80
    at errnoException (dns.js:27:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:78:26)

And from this module, seems like this error also belongs to the same family.

When the connection fails with one of ECONNRESET, ENOTFOUND, ESOCKETTIMEDOUT, ETIMEDOUT, ECONNREFUSED, EHOSTUNREACH, EPIPE, EAI_AGAIN or when an HTTP 5xx error occurrs, the request will automatically be re-attempted as these are often recoverable errors and will go away on retry

@amishas157
Copy link
Contributor Author

Retrying the request for 5 times if the first request fails.
Here is the patch: https://github.com/mapbox/osm-compare/blob/feature-overlaps/lib/get_vector_tile_features.js#L27-#L39

@amishas157
Copy link
Contributor Author

amishas157 commented May 9, 2017

Seems like we are not getting error anymore, as whenever request fails #1 log shows that the number of retry attempts done to fetch tiles.

Next action

@amishas157
Copy link
Contributor Author

amishas157 commented May 10, 2017

Check if we can merge this PR: #14

The PR is merged . Issue good to close now.

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