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

Error: Unhandled promise rejection with DOMException #644

Closed
cgalvarez opened this issue May 16, 2018 · 2 comments
Closed

Error: Unhandled promise rejection with DOMException #644

cgalvarez opened this issue May 16, 2018 · 2 comments

Comments

@cgalvarez
Copy link

Case

Bug

Issue

Unhandled rejection of a promise because of collection/database destroyed.

I am developing an electron app, but I've forked this repo and run the existent tests suite, and I see the same error in the console. Just exec npm test on the command line, and you start getting messages like next:

Chromium 66.0.3359 (Ubuntu 0.0.0) ERROR: 'Unhandled promise rejection', DOMException{stack: 'Error: Failed to execute 'postMessage' on 'BroadcastChannel': Channel is closed
    at RxBroadcastChannel.write (http://localhost:9876/absolute/tmp/e6d4e52c99ac17934ce607ff820c9e47.browserify?fbce54803a3b6962a6ae0622114a9a1f87750a7d:7175:28)
    at Socket._callee3$ (http://localhost:9876/absolute/tmp/e6d4e52c99ac17934ce607ff820c9e47.browserify?fbce54803a3b6962a6ae0622114a9a1f87750a7d:12360:48)
    at tryCatch (http://localhost:9876/absolute/tmp/e6d4e52c99ac17934ce607ff820c9e47.browserify?fbce54803a3b6962a6ae0622114a9a1f87750a7d:216655:40)
    at Generator.invoke [as _invoke] (http://localhost:9876/absolute/tmp/e6d4e52c99ac17934ce607ff820c9e47.browserify?fbce54803a3b6962a6ae0622114a9a1f87750a7d:216889:22)
    at Generator.prototype.(anonymous function) [as next] (http://localhost:9876/absolute/tmp/e6d4e52c99ac17934ce607ff820c9e47.browserify?fbce54803a3b6962a6ae0622114a9a1f87750a7d:216707:21)
    at step (http://localhost:9876/absolute/tmp/e6d4e52c99ac17934ce607ff820c9e47.browserify?fbce54803a3b6962a6ae0622114a9a1f87750a7d:24501:30)
    at http://localhost:9876/absolute/tmp/e6d4e52c99ac17934ce607ff820c9e47.browserify?fbce54803a3b6962a6ae0622114a9a1f87750a7d:24512:13
    at run (http://localhost:9876/absolute/tmp/e6d4e52c99ac17934ce607ff820c9e47.browserify?fbce54803a3b6962a6ae0622114a9a1f87750a7d:44251:22)
    at http://localhost:9876/absolute/tmp/e6d4e52c99ac17934ce607ff820c9e47.browserify?fbce54803a3b6962a6ae0622114a9a1f87750a7d:44268:30
    at MutationObserver.flush (http://localhost:9876/absolute/tmp/e6d4e52c99ac17934ce607ff820c9e47.browserify?fbce54803a3b6962a6ae0622114a9a1f87750a7d:43479:9)'}

As the promise is rejected asynchronously, the current tests pass without being reported. I've tried to catch them with a bug report unit test case with either window.addEventListener('unhandledrejection', catcher) or process.on('unhandledRejection', catcher) with no luck. 1164 tests throw previous error passing as successful.

IMPORTANT: Seems to be chromium-engine related, since all the throwing tests throw in Chrome/Chromium, and none in Firefox. electron uses chromium too, so this must mean something!

Info

  • Environment: (Node.js/browser/electron/etc..)
    • System: Ubuntu 16.04
    • Node.js: 10.1.0
    • npm: 5.6.0
    • electron: 2.0.0
    • browser: reported with npm test's karma browser suites:
      • Chrome 66.0.3359 (Linux 0.0.0)
      • Chromium 66.0.3359 (Ubuntu 0.0.0)
  • Adapter: the ones used in the RxDB test suites.
  • Stack: the one used by RxDB.

Code

npm test

Attachments

The complete output from running npm test on my computer locally:

log.txt

@pubkey pubkey closed this as completed in 5fd6e29 May 16, 2018
@pubkey
Copy link
Owner

pubkey commented May 16, 2018

Hi @cgalvarez
I fixed this now.
The reason was that after each test we run a database.destroy() to free up memory. Then it happened that the broadcast-channel which is used as performance-optimisation when possible (newer chrome) still wrote to the channel which produced the error.

This happened only in the tests since in real-life you would not create and destroy databases so often.

@cgalvarez
Copy link
Author

Hi @pubkey ! Thank you very much for fixing this so fast! Incredible! 😉

In my case, I was destroying collection and database right after creating the user account because the credentials are used for encrypting the database, so I want the user to sign in again after creating the encrypted database. That's why I was destroying the collection/database right after inserting a document, and suppose it is why I noticed the error in the electron app console.

Anyway, thank you very much again! Great work!! 👏 🙌 🎉 🎉

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