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

Calling into a component that includes the println macro hangs #449

Open
DamianReeves opened this issue Jun 12, 2024 · 5 comments
Open

Calling into a component that includes the println macro hangs #449

DamianReeves opened this issue Jun 12, 2024 · 5 comments

Comments

@DamianReeves
Copy link

DamianReeves commented Jun 12, 2024

Calling into the component built here, results in a hang as long as a println! is included.

As seen here:
https://github.com/DamianReeves/wasm-components-ftw/blob/5a85c47fdc62288cb46952484f760231073c5152/crates/morphir-platform/src/lib.rs#L11-L15

If I remove the println things work fine.

Not sure if its relevant, but if I transpile with tracing, I notice when I insert a println! call, my code seems to hang on the following wasi call is traces:

[module="wasi:cli/[email protected]", function="get-stdin"] call
@guybedford
Copy link
Collaborator

Thanks for posting. Unfortunately I was unable to build this test case on arm64. Can you just share the direct component binary that is causing the issue?

@DamianReeves
Copy link
Author

Sure thing: Here you go!

dist.zip

@guybedford
Copy link
Collaborator

It seems you've built the full preview2-shim library into a single file on Node.js. Unfortunately I think this might be breaking some invariants of the syncification that spawns a worker here:

var _rawDebug = nodeProcess._rawDebug || console.error.bind(console);
var workerPath = fileURLToPath(new URL("./worker-thread.js", import.meta.url));
var httpIncomingHandlers = new Map;
var instanceId = Math.round(Math.random() * 1000).toString();
var DEBUG_DEFAULT = false;
var DEBUG = env.PREVIEW2_SHIM_DEBUG === "0" ? false : env.PREVIEW2_SHIM_DEBUG === "1" ? true : DEBUG_DEFAULT;
var ioCall = createSyncFn(workerPath, DEBUG, (type, id, payload) => {

@DamianReeves
Copy link
Author

It seems you've built the full preview2-shim library into a single file on Node.js. Unfortunately I think this might be breaking some invariants of the syncification that spawns a worker here:

So does this mean I need to change my bundling code not to bundle the preview-shim?

@guybedford
Copy link
Collaborator

Yes exactly, or at least not bundle in the worker invocation as that must be a separate file.

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