Comments (5)
Ugh, we should keep the locking IO but fix this. Want to add an additional test that has a failed load and demonstrates the problem?
https://github.com/mapbox/node-tilejson/blob/master/test/tilejson.test.js#L118
Then let's look into what's going on and fix.
from node-tilejson.
@yhahn Interestingly, the locking IO seems to work just fine in a for loop, performing the file IO only once, but calling many callbacks. I was able to reproduce the issue using Step
though https://github.com/mapbox/node-tilejson/blob/broken-locking/test/tilejson.test.js#L188-222
from node-tilejson.
@yhahn "Fixed" in 4978876 by switching from EventEmitter to a simple array of callbacks and a while loop. I'm uncertain if this actually addresses the underlying problem, but all tests are passing now. My theory is that this problem was caused by relying on the many
callback to move to the next step before deleting the lock, in which case a new many
callback was added to the (still existing and locked) EventEmitter from the next step, and never executed because the EventEmitter then gets deleted afterwards. A race condition may still exist here (will the next callback always be added before the while loop exits?), would like to discuss how this should be handled correctly.
from node-tilejson.
O_o
Only small thing I would vet here is whether the callbacks should be called using pop()
or shift()
. I'm assuming the caller will expect the first callbacks added to be called first once the lock is release.
from node-tilejson.
@yhahn Ack, yea good catch, shift()
would probably make more sense here, done in 81de5f4
from node-tilejson.
Related Issues (13)
- needs first tag and npm publish
- Add caching HOT 2
- Use locking cache to prevent duplicate parallel downloads
- Retry downloads after failure
- npm owner add HOT 1
- Add configurable retry HOT 3
- Use "request" instead of "get" HOT 7
- README HOT 1
- Tests failing in master branch HOT 1
- Changelog HOT 1
- support for HiDPI
- Update agentkeepalive
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 node-tilejson.