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

Embind causes "Cannot have multiple async operations in flight at once" assertion #18412

Open
msorvig opened this issue Dec 21, 2022 · 1 comment

Comments

@msorvig
Copy link
Contributor

msorvig commented Dec 21, 2022

Version of emscripten/emsdk:
Reproduced wth 3.1.14 (relevant Emscripten code appears to be unchanged in later versions)

We're getting "Assertion failed: Cannot have multiple async operations in flight at once", with following stack trace:

abort	@	VM977:1009
assert	@	VM977:508
whenDone	@	VM977:4714
qtStdWebEventCallbackActivate	@	VM1024:11

Where the debugger shows this implementaton for qtStdWebEventCallbackActivate:

(function anonymous(throwBindingError,invoker,fn,runDestructors,retType,classParam,argType0,Asyncify
) {
return function qtStdWebEventCallbackActivate(arg0) {
if (arguments.length !== 1) {
throwBindingError('function qtStdWebEventCallbackActivate called with ' + arguments.length + ' arguments, expected 1 args!');
}
var arg0Wired = argType0.toWireType(null, arg0); // emscripten::val
invoker(fn, arg0Wired);
function onDone() {
}
return Asyncify.currData ? Asyncify.whenDone().then(onDone) : onDone();
}

})

Where whenDone() is:

 whenDone: function() {
  assert(Asyncify.currData, "Tried to wait for an async operation when none is in progress.");
  assert(!Asyncify.asyncPromiseHandlers, "Cannot have multiple async operations in flight at once");
  return new Promise((resolve, reject) => {
   Asyncify.asyncPromiseHandlers = {
    resolve: resolve,
    reject: reject
   };
  });
 },

The assertion is triggered in a case where there is an async operation in progress, which has already registered promise handlers. Should asyncPromiseHandlers support registering multiple promises?

See https://bugreports.qt.io/browse/QTBUG-102827 for the corresponding Qt bug, with a (Qt) example which reproduces the bug.

@fwcd
Copy link

fwcd commented Mar 8, 2024

Potentially related: #16291

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