question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Draco decoding errors result in uncaught promise rejections.

See original GitHub issue

Describe the bug

When decoding a GLTF model with Draco compression, in some cases if the decoding process fails a promise in GLTFLoader is rejected but not caught. Thus in my code neither the onError nor the onLoad arguments are ever executed.

I believe I have a fix here: https://github.com/mrdoob/three.js/compare/dev...twastvedt:dracoCatchPromise. Tested with the Draco example. I’m happy to create a PR, but I’m sure I’m ignorant of what all is at play here, so wanted to make sure first. My fix substitutes the current use of decodeDracoFile, which is marked deprecated in DRACOLoader, with decodeGeometry, which returns a promise that we can catch.

To Reproduce

Steps to reproduce the behavior:

  1. Go to https://jsfiddle.net/srq463dg/
  2. Note that in the console the onError method (line 58) never executes.
  3. Open developer tools and note that an error has occurred in the Draco loader (“THREE.DRACOLoader: Decoding failed: Failed to decode point attributes”).

Note: The errorModel data url in the fiddle is a valid gltf model that has been truncated. In my app’s environment there is a string length limit imposed on models, thus this entire investigation.

Code

loader.load(errorModel, function (data) {
    		console.log("Loaded model");
        scene.add(data.scene);
    }, null, function (error) {
    	console.log(`In error handler: ${error}`);
    });

Expected behavior

Any error in the Draco loader should cause the onError argument of GLTFLoader.load to be executed.

Platform:

  • Device: Desktop
  • OS: Windows
  • Browser: Chrome
  • Three.js version: dev

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
donmccurdycommented, Sep 22, 2021

I think we may need to overhaul DRACOLoader a bit anyway (see https://github.com/mrdoob/three.js/issues/22445 …) and have it use the new WorkerPool utility. Probably better to resolve this all at the same time, I’ll self-assign it in that case.

0reactions
fanciful-marmotcommented, Apr 29, 2022

I’ve run into a similar unhandled promise rejection error with DRACO decoding in some environments where there isn’t enough memory for the wasm decoder to run properly. I get an unhandled promise rejection with memory access out of bounds. I can setup an example that illustrates the problem if needed but it’s similar to what’s described in the issue.

It would be great if I could handle the error properly and fallback to something else. Is there an update on this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Uncaught (in promise): Unhandled promise rejections
This connect expected to error but I should able to caught promise rejections. But the results that I get said unhandled promise rejection....
Read more >
Draco decoder for plain drc file not gltf, got error - Questions
Hello, I tried to decode the plain .drc file within draco example(bunny.drc). ... but I got error like: Uncaught (in promise) abort().
Read more >
WebAssembly and multi-threading - Unlimited 3D
Multi-threaded decoding of Draco-compressed glTF file. Once again, C++ exception handling in WebAssembly drops performance almost twice in this ...
Read more >
words
... bugging buggy bugle bugled bugler bugles bugling bugs Buick build builder builders ... declining DECnet decode decoded decoder decoders decodes decoding ......
Read more >
Tracking Unhandled Promise Rejections
When a promise is rejected, it looks for a rejection handler. If it finds one, like in the example above, it calls the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found