Skip to content

[FEATURE REQUEST]: Improve error logging with new inc_ref() feature #4426

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

Closed
3 tasks done
EthanSteinberg opened this issue Dec 27, 2022 · 2 comments · Fixed by #4427
Closed
3 tasks done

[FEATURE REQUEST]: Improve error logging with new inc_ref() feature #4426

EthanSteinberg opened this issue Dec 27, 2022 · 2 comments · Fixed by #4427
Labels
triage New bug, unverified

Comments

@EthanSteinberg
Copy link
Collaborator

EthanSteinberg commented Dec 27, 2022

Required prerequisites

What version (or hash if on master) of pybind11 are you using?

2.10.2

Problem description

In 2.10.2, @rwgk added a really neat feature to detect undefined behavior by double checking the GIL on reference counter calls.

Unfortunately (as experienced by our users, scipy/scipy#17644), the error messages here are really bad, especially on Windows.

We need a better error message strategy here to avoid user confusion.

This is tricky because this feels like a regression to our users when we really want to better inform them about UB in their code.

Reproducible example code

https://github.com/tylerjereddy/pybind_repro is a really nice Windows example that has terrible error messaging.

Is this a regression? Put the last known working version here if it is.

2.10.1

@EthanSteinberg EthanSteinberg added the triage New bug, unverified label Dec 27, 2022
@EthanSteinberg
Copy link
Collaborator Author

I'll assign myself as I already have pybind_repro set up on Windows so I can easily play with different error reporting strategies.

One key thing is that we must not throw exceptions in the DLL load process. We probably want to do some raw printf calls here.

@Skylion007
Copy link
Collaborator

Skylion007 commented Dec 27, 2022

Similar issues here as well: pytorch/pytorch#91251 Not sure if it's the exact same cause, but there is no good stack trace to follow either.

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

Successfully merging a pull request may close this issue.

2 participants