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

fix: stacktraces for custom exception handling #3343

Merged
merged 9 commits into from
Dec 17, 2024

Conversation

pfackeldey
Copy link
Collaborator

@pfackeldey pfackeldey commented Dec 15, 2024

This PR fixes stack traces for awkward's custom error handling. It allows to use debuggers like "pdb" that try to go through the stack traces again, before they've been evicted from the stack (or wrongly ordered?) (I'm not sure what causes that exactly). This PR does not affect the custom decoration of errors.

@pfackeldey
Copy link
Collaborator Author

Could you have a look @henryiii on this PR? I remember you had some ideas about it in one of the recent awkward meetings

Copy link
Member

@jpivarski jpivarski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good! (Minor comment below.)

The JAX test failures should be dealt with elsewhere and in one place, perhaps as a single PR that fixes or removes them and then gets merged into all of these pending PRs.

src/awkward/_errors.py Outdated Show resolved Hide resolved
pfackeldey and others added 2 commits December 16, 2024 12:37
Co-authored-by: Jim Pivarski <jpivarski@users.noreply.github.com>
@pfackeldey
Copy link
Collaborator Author

Great! The jax test fix is in #3340 already :)

@henryiii
Copy link
Member

henryiii commented Dec 16, 2024

I don't think it's related, but there's a lot of annotations like:

jax.errors.UnexpectedTracerError: Encountered an unexpected tracer. A function transformed by JAX had a side effect, allowing for a reference to an intermediate value with type float64[3] wrapped in a JVPTracer to escape the scope of the transformation.
JAX transformations require that functions explicitly return their outputs, and disallow saving intermediate values to global state.
To catch the leak earlier, try setting the environment variable JAX_CHECK_TRACER_LEAKS or using the `jax.checking_leaks` context manager.
See https://jax.readthedocs.io/en/latest/errors.html#jax.errors.UnexpectedTracerError

being produced.

Edit: Ah, I see Jim mentioned this. Edit: And Peter mentioned a fix. I'm behind. :)

@pfackeldey pfackeldey merged commit 564126d into main Dec 17, 2024
39 checks passed
@pfackeldey pfackeldey deleted the pfackeldey/fix_error_stacktraces branch December 17, 2024 22:19
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

Successfully merging this pull request may close these issues.

3 participants