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

Memory: improve error handling for "out of bounds memory access" #603

Open
evacchi opened this issue Oct 24, 2024 · 3 comments
Open

Memory: improve error handling for "out of bounds memory access" #603

evacchi opened this issue Oct 24, 2024 · 3 comments

Comments

@evacchi
Copy link
Collaborator

evacchi commented Oct 24, 2024

  • Current exception message does not carry any information about where the error occurred
  • Moreover, the exception is often raised by catching an IndexOutOfBoundsException, even when we are already aware of the limits; we should be able to check those limits explicitly, avoiding an expensive exception to be created
@electrum
Copy link
Collaborator

While I generally agree about not creating exceptions needlessly, does it actually matter here? When OOB access occurs, the WASM program is terminated.

I just noticed that Memory has a mix of UninstantiableException and WasmRuntimeException, which should be cleaned up.

@lkesteloot
Copy link

I've spent the last few hours tracking down a crash due to this exception, and having context (index, bounds, stack trace) might have made this easier.

Also, just as a social/psychological thing: Seeing the plain "out of bounds memory access" exception with no information made me think that no one was using Chicory, because if anyone did, they'd have fixed this exception to include useful information. (I might be wrong about this, I'm just reporting how the exception made me see the project.)

@andreaTP
Copy link
Collaborator

Hi @lkesteloot and thanks a lot for your interest in the project!

For context, most of the "text" part of the exceptions is driven by the expectations in the Wasm Testsuite.
In our case, most of the time, we use a debugger to get relevant information about the failure, and that's why we are not terribly irked by this issue.

That said, I agree that this is a rough edge and we should improve.
I added a commit on top of my in-fly #698 to slightly improve the situation, and I'm happy to hear suggestions on how to improve further.

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

4 participants