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

Emscripten wrapper modifies Node.js globals #629

Closed
donmccurdy opened this issue Sep 18, 2020 · 6 comments
Closed

Emscripten wrapper modifies Node.js globals #629

donmccurdy opened this issue Sep 18, 2020 · 6 comments

Comments

@donmccurdy
Copy link
Contributor

donmccurdy commented Sep 18, 2020

I'm trying to integrate Draco into glTF-Transform, and have hit an issue with the generated Emscripten wrapper. It includes the following:

process["on"]("uncaughtException",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});process["on"]("unhandledRejection",abort);

The effect of that, unfortunately, is to create noisy output that obscures my own stack traces and user-facing warnings, where my CLI library would normally handle errors. Is it possible to build (and ideally publish) the npm package without this in the wrapper?

@donmccurdy
Copy link
Contributor Author

These may be the compile flags that would solve my issue:

https://github.com/emscripten-core/emscripten/blob/b053c3f20dc9825ac2cd7e2fd7921862a9367a1e/src/settings.js#L584-L594

@FrankGalligan
Copy link
Collaborator

We are planning on a new release this month. We can investigate adding these options.

@donmccurdy
Copy link
Contributor Author

In the latest release, 1.4.0, I'm seeing a different but still similar line in both the encoder and the decoder:

process.on("uncaughtException",function(a){throw a;});process.on("unhandledRejection",l);

This has a similar effect as before unfortunately, obscuring errors from my own application with a stack trace that seems to come from Draco:

RuntimeError: abort(g: "MY ERROR MESSAGE HERE".). Build with -s ASSERTIONS=1 for more info.
    at process.l (/Users/donmccurdy/Projects/glTF-Transform/node_modules/draco3dgltf/draco_encoder_gltf_nodejs.js:14:152)
    at process.emit (events.js:214:15)
    at processPromiseRejections (internal/process/promises.js:201:33)
    at processTicksAndRejections (internal/process/task_queues.js:86:32)

Both the encoder and decoder include a similar line.

@FrankGalligan
Copy link
Collaborator

@donmccurdy Does 1.4.0 not even work now? Or just the same brokenness for you as 1.3.6?

@donmccurdy
Copy link
Contributor Author

donmccurdy commented Dec 2, 2020

It seems like v1.4.0 just hasn't fixed this particular issue — as far as I can tell it's behaving basically the same as v1.3.6, but I haven't managed to get my own implementation (donmccurdy/glTF-Transform#147) fully updated yet, and haven't tried to update three.js.

@donmccurdy
Copy link
Contributor Author

Confirmed fixed in v1.4.1, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
@donmccurdy @FrankGalligan and others