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

xworker events does not get populated #39

Open
bugzpodder opened this issue Sep 18, 2023 · 8 comments
Open

xworker events does not get populated #39

bugzpodder opened this issue Sep 18, 2023 · 8 comments
Labels
3rd party Dependent on 3rd party changes

Comments

@bugzpodder
Copy link
Contributor

demo: https://bugzpodder.pyscriptapps.com/xworker-sync-hangs-when-raise-error-copy-copy-copy/latest/

I have specified onmessage (expecting pyodide:ready) and onerror (exepectng error to get passed here) callback and they does not get called in the code.

Let me know if I am doing something wrong.

@WebReflection
Copy link
Contributor

this is how we set the onerror to the PyWorker https://github.com/pyscript/pyscript/blob/next/pyscript.core/src/core.js#L78-L82

@WebReflection
Copy link
Contributor

@bugzpodder is this still an issue or you changed anything and now it's all good? Thanks!

@bugzpodder
Copy link
Contributor Author

bugzpodder commented Sep 30, 2023

it's unclear to me. I haven't gotten either onmessage and onerror working but I understand for onmessage you can do something like js.postMessage. In your code it seems that worker.onerror should work but so far I haven't successfully gotten it actually working in my example.

[edit] tested again js.postMessage works as a proxy to onmessage. onerror doesnt seem to work. latest polyscript: https://pyscript.com/@bugzpodder/xworker-sync-hangs-when-raise-error-copy-copy-copy-copy-77754-copy-copy/latest

@bugzpodder
Copy link
Contributor Author

bugzpodder commented Oct 3, 2023

ok was able to get 'pyodide:done' and 'pyodide:ready' customevent on a div with target id from a worker. I was listening to postMessage so nothing was there. now need to figure out onerror..

@WebReflection
Copy link
Contributor

ok was able to get 'pyodide:done' and 'pyodide:ready' customevent on a div with target id from a worker

hopefully in inverted order 😅

I was listening to postMessage so nothing was there. now need to figure out onerror..

I'll try to figure out what is it that doesn't work

@WebReflection
Copy link
Contributor

it was a bit convoluted to run your example locally and understand what's going on ... I'd love to have issues with no home-made bootstrap logic, if possible, simply to speedup possible investigations and fixes, thanks.

that being said, I think this is a classic case where in pyodide we can't handle those errors:
pyodide/pyodide#3938

until that bug is fixed and we work to understand how to benefit eventually from that fix, I am afraid there's not much I can do in here as I can't catch that error myself so it's a bit of a gotcha we need to live with for the time being, but at least the error is shown in devtools so this is a half blocking situation.

I will flag this as 3rd party issue and work once that gets resolved.

@WebReflection WebReflection added the 3rd party Dependent on 3rd party changes label Oct 3, 2023
@bugzpodder
Copy link
Contributor Author

Thanks. what does worker.onerror do if anything: https://github.com/pyscript/pyscript/blob/main/pyscript.core/src/core.js#L61

is it trapping stderr (i don't see it being invoked either)

@WebReflection
Copy link
Contributor

It’s meant for plugins but it’s not triggered unless stderr is explicitly used via print file=stderr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3rd party Dependent on 3rd party changes
Projects
None yet
Development

No branches or pull requests

2 participants