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

[WASM] JsException: Exception was thrown while running JavaScript code kotlinx.coroutines.error_$external_fun #4213

Open
Omico opened this issue Aug 13, 2024 · 6 comments
Labels

Comments

@Omico
Copy link

Omico commented Aug 13, 2024

Describe the bug

The webview is blocked.

Provide a Reproducer

git clone https://github.com/OmicoDev/wwm/tree/optimize-loading-font-on-wasm
Run wwm.web.run run configuration.
See the browser console.

@Omico Omico added the bug label Aug 13, 2024
@dkhalanskyjb
Copy link
Collaborator

@igoriakovlev, looking into this, I see the following stack trace:

    error_$external_fun wasmJs.uninstantiated.mjs:4786
    error_$external_fun__externalAdapter wasmJs.wasm:5090143
    propagateExceptionFinalResort wasmJs.wasm:5092112
    handleUncaughtCoroutineException wasmJs.wasm:5044474
    handleCoroutineException wasmJs.wasm:4922944

Looks like console.error doesn't work for some reason. What could be the reason, and what can we use instead?

@dkhalanskyjb
Copy link
Collaborator

dkhalanskyjb commented Aug 16, 2024

@Omico, in any case, the reason you're seeing this is that some coroutines that in your codebase are throwing uncaught exceptions. Please read https://kotlinlang.org/docs/exception-handling.html . The issue on our side is that the error message you get is unhelpful for identifying the problem.

@igoriakovlev
Copy link
Contributor

@dkhalanskyjb It works in a same way as in Kotlin/Js. Kotlin/Wasm 2.0.10 does not supports yet js exception info retrieving (now in WIP) so the only thing we can log now is JSException's message.

@dkhalanskyjb
Copy link
Collaborator

dkhalanskyjb commented Aug 16, 2024 via email

@Omico
Copy link
Author

Omico commented Aug 16, 2024

I'm unfamiliar with web development, but based on what I know now, I highly suspect this issue is because the content I want to store exceeds the localstorage limit. https://developer.mozilla.org/en-US/docs/Web/API/Storage_API/Storage_quotas_and_eviction_criteria#web_storage

However, the Coroutines API cannot provide any helpful information for this error. I hope we can have a better debug experience in similar scenarios.

@igoriakovlev
Copy link
Contributor

@igoriakovlev, I don't think it works the same way on JS. On JS, console.error works and prints and error to the log, but on Wasm, it crashes for some reason.

On Fri, Aug 16, 2024, 2:49 PM igoriakovlev @.> wrote: @dkhalanskyjb https://github.com/dkhalanskyjb It works in a same way as in Kotlin/Js. Kotlin/Wasm 2.0.10 does not supports yet js exception info retrieving (now in WIP) so the only thing we can log now is JSException's message. — Reply to this email directly, view it on GitHub <#4213 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMT73TOIPGEYY4WUV2TESSTZRXYNBAVCNFSM6AAAAABMOSKBJSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJTGQ2TCMBUGY . You are receiving this because you were mentioned.Message ID: @.>

@dkhalanskyjb I do not see that it craches, for me it prints the error and stack for the place where console.error was called. The same way as KotlinJs do.

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

No branches or pull requests

3 participants