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

Race condition on error handling #15

Open
garethbowen opened this issue May 12, 2016 · 7 comments
Open

Race condition on error handling #15

garethbowen opened this issue May 12, 2016 · 7 comments

Comments

@garethbowen
Copy link
Contributor

garethbowen commented May 12, 2016

If I try to get a doc that doesn't exist immediately on page load I get an uncaught exception in promise. If I try to get the same doc after a 1 second delay then the error is handled as expected. If I remove worker-pouch the 404s are handled as expected.

I've done some digging around to try and get more information but unfortunately I haven't gotten far, but here's what I have...

uncaught-exception

doc-not-found

I'm not sure if it's relevant but I use angular-pouchdb.

Let me know if there's anything else I can do to help.

@nolanlawson
Copy link
Member

Sounds like a race condition with the worker. That's really weird; I thought I waited for the worker to initialize before sending out any messages.

I don't have time to look into this right now, so any PRs would be happily accepted. :)

@nolanlawson
Copy link
Member

Actually yeah, that makes exactly zero sense because the browser is supposed to handle this automatically when I call worker.postMessage().

Could this be a bug in Chrome? Can you reproduce in Firefox as well?

@garethbowen
Copy link
Contributor Author

I can't reproduce in Firefox, just Chromium (v49). Good call.

@nolanlawson
Copy link
Member

Hm, if you can find a minimally reproducible test case, this might be a good bug to file on Firefox itself. In theory all webworker postMessage()s are ordered (both to and from the web worker). If Firefox behaves differently from Chrome (and Edge/Safari), then this could be a useful bug to send to Mozilla (they are very fast to fix bugs in my experience).

@NNemec
Copy link

NNemec commented Jan 14, 2017

I seem to have the same issue in my project. (Running Chrome v53 in electron.io, can't easily try out any other browser)
Was there any new insight on this since the initial discussion?

@NNemec
Copy link

NNemec commented Jan 14, 2017

Got it to work now in my case: Turned out that delaying the first call of db.get until db.info was finished did the trick.
Not sure whether it was the same issue, though.

@PascalTemel
Copy link

I came across the same issue in an angular2 project. The comment above helped me solve my issue.

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

4 participants