Skip to content

Comments

panic with string message again for cycle panics#898

Merged
carljm merged 1 commit intosalsa-rs:masterfrom
carljm:revert-unexpectedcycle
Jun 4, 2025
Merged

panic with string message again for cycle panics#898
carljm merged 1 commit intosalsa-rs:masterfrom
carljm:revert-unexpectedcycle

Conversation

@carljm
Copy link
Contributor

@carljm carljm commented Jun 4, 2025

Switch back to regular panic with string message, instead of resume_unwind with custom payload, for cycle panics.

This avoids having the default behavior be silent panic with no information, and allows the use of a panic hook to collect additional information, if needed.

It's not clear what the use case is for catching cycle panics specifically and treating them differently from other panics; they are not more recoverable.

Fixes #891

@carljm carljm requested review from MichaReiser and Veykril June 4, 2025 00:50
@netlify
Copy link

netlify bot commented Jun 4, 2025

Deploy Preview for salsa-rs canceled.

Name Link
🔨 Latest commit 0f6d406
🔍 Latest deploy log https://app.netlify.com/projects/salsa-rs/deploys/683f9871513c9b0008b7efde

@codspeed-hq
Copy link

codspeed-hq bot commented Jun 4, 2025

CodSpeed Performance Report

Merging #898 will improve performances by 5.52%

Comparing carljm:revert-unexpectedcycle (0f6d406) with master (ac6fe53)

Summary

⚡ 2 improvements
✅ 10 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
amortized[InternedInput] 3.3 µs 3.1 µs +4.66%
new[InternedInput] 5.6 µs 5.3 µs +5.52%

panic!(
"dependency graph cycle when querying {database_key_index:#?}, \
set cycle_fn/cycle_initial to fixpoint iterate.\n\
Query stack:\n{stack:#?}",
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I'm a bit undecided if we should print the query stack here. I think it's a useful default behavior, but it can be redundant when using a custom panic hook handler.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had the same question, and I know it ends up being redundant output for us in ty... but I think for Salsa we should optimize for the default experience, not the assumption that someone has installed a custom panic hook. And this is clearly valuable debugging information.

Someone with a custom panic hook can also eliminate this from the printed message, if they care enough to do so.

@Veykril
Copy link
Member

Veykril commented Jun 4, 2025

I do think we want to roll back #883 then as well fwiw. The user can capture the normal backtrace themselves then if desired

@carljm
Copy link
Contributor Author

carljm commented Jun 4, 2025

do think we want to roll back #883 then as well fwiw. The user can capture the normal backtrace themselves then if desired

Agreed, but doesn't this PR already do that by removing the UnexpectedCycle struct entirely?

@Veykril
Copy link
Member

Veykril commented Jun 4, 2025

Oh ye it does sorry :) Mixed this up with QueryBacktrace

@carljm carljm added this pull request to the merge queue Jun 4, 2025
Merged via the queue into salsa-rs:master with commit a95bae5 Jun 4, 2025
12 checks passed
@carljm carljm deleted the revert-unexpectedcycle branch June 4, 2025 15:24
@github-actions github-actions bot mentioned this pull request Jun 4, 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.

No cycle error in logs

3 participants