Skip to content

Conversation

@hinthornw
Copy link
Contributor

@hinthornw hinthornw commented Jun 28, 2025

When extracting frames for dict tracebacks, it's possible for exception cause chains to have cycles if a user calls raise e from <something in its chain>. Tracking the seen IDs would let the traceback break early in this case.

Thanks for maintaining a great library!

@hinthornw hinthornw force-pushed the wfh/handle_cycles branch from 38f242a to 17f627f Compare June 28, 2025 00:17
@hynek
Copy link
Owner

hynek commented Jul 23, 2025

hey sorry for the late answer – it's been… busy. Is this a fix to the same thing as #727? It looks similar but the approach looks very different?

cc @sscherfke

@sscherfke
Copy link
Contributor

@hinthornw Does the current structlog version fix the issue for you? #727 should have fixed the issue. Otherwise, please provide more details and a minimal example.

@hinthornw
Copy link
Contributor Author

hinthornw commented Sep 3, 2025

Thanks for the reply, @sscherfke and @hynek !

No, it is not the same thing as #727
No, main does not fix this.

My minimal example is in the test case I added to this pr.

Or shorter:

try:
   raise ValueError("...")
except Exception as e:
    raise e from e

Creates an infinite recursion in the logging traceback.

I know that code snippet is dumb. I have a server implementation that executes user code. It uses structlog because you all have made a great library. User code can do somewhat dumb things like this code snippet. Structlog's current behavior makes a single error (impacting 1 request) terminal for the server.

@hynek
Copy link
Owner

hynek commented Sep 11, 2025

I hope #739 has fixed it now on main, since he took over your test (and I've co-authored you).

sorry for the delays, all the timings on this whole story were terrible

@hynek hynek closed this Sep 11, 2025
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