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

Invalid Extended Type at offset 0 val 7 #5

Closed
natanavra opened this issue Mar 31, 2020 · 5 comments
Closed

Invalid Extended Type at offset 0 val 7 #5

natanavra opened this issue Mar 31, 2020 · 5 comments

Comments

@natanavra
Copy link

Hard to re-produce as it is inconsistent and happens only sometimes.
Seems like the db becomes corrupted and maxmind is unable to read the file.
The solution is to npm remove geolite2-redist and npm install to re-download the db.

Any ideas?

@GitSquared
Copy link
Owner

GitSquared commented Mar 31, 2020

Interesting.

res.on('entry', entry => {
if (entry.path.endsWith('.mmdb')) {
const dstFilename = path.join(outPath, path.basename(entry.path));
entry.pipe(fs.createWriteStream(dstFilename));
}

The downloader script directly overwrites the database files. I guess if you kill the app while geolite2-redist is updating/unzipping, or if you lose internet connectivity, the files are effectively left in a corrupted state.

Solution: write to temporary files. Rename them if checksums pass. Delete any temporary files on startup.

Will publish an update soon.

@natanavra
Copy link
Author

Seems like this issue is still there, haven't seen the error for a while

ENOENT: no such file or directory, rename '.../node_modules/geolite2-redist/dbs-tmp
ENOENT: no such file or directory, open '.../node_modules/geolite2-redist/dbs/GeoLite2-City.mmdb'

@GitSquared
Copy link
Owner

Have you upgraded the lib lately? Can you confirm it stops working after printing out these errors?

@natanavra
Copy link
Author

natanavra commented May 24, 2020

I'm on the latest 1.0.7
The app crashes with "uncaught exception", seems like it's working after a restart
But in general, totally came out of the blue in a production deployment

@GitSquared
Copy link
Owner

I'll look into it.

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