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 double panic when exceeding the branch limit in Drop #245

Merged
merged 3 commits into from
Dec 4, 2021

Conversation

hawkw
Copy link
Member

@hawkw hawkw commented Dec 4, 2021

Loom will panic if the maximum number of branches is exceeded. If a
type's Drop impl performs a branch (for example, a MutexGuard or
Arc, or a user-defined type that performs atomic operations in its
Drop impl), we will hit the assertion a second time, resulting in a
double panic. This sucks, because it makes these test failures much
harder to debug.

This branch fixes the issue by changing the assertion checking path
length to also check if the current thread is panicking. If we're
already panicking, we don't make the assertion, to avoid causing a
double panic. I've added a test that reproduces this double panic, as
well.

I've also fixed a typo in the assertion message. :)

Signed-off-by: Eliza Weisman eliza@buoyant.io

hawkw added 3 commits December 4, 2021 12:57
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Loom will panic if the maximum number of branches is exceeded. If a
type's `Drop` impl performs a branch (for example, a `MutexGuard` or
`Arc`, or a user-defined type that performs atomic operations in its
`Drop` impl), we will hit the assertion a _second_ time, resulting in a
double panic. This sucks, because it makes these test failures much
harder to debug.

This branch fixes the issue by changing the assertion checking path
length to also check if the current thread is panicking. If we're
already panicking, we don't make the assertion, to avoid causing a
double panic. I've added a test that reproduces this double panic, as
well.

I've also fixed a typo in the assertion message. :)
@hawkw hawkw requested a review from carllerche December 4, 2021 20:59
@hawkw hawkw merged commit 9a546f6 into master Dec 4, 2021
@taiki-e taiki-e deleted the eliza/fix-double-panic-in-drop branch December 13, 2021 02:39
hawkw added a commit that referenced this pull request May 10, 2022
# 0.5.5 (May 10, 2022)

### Added

- sync: Add `Arc::from_std` without `T: Sized` bound (#226)
- sync: Implement `Debug` for `AtomicPtr` for all `T` (#255)
- logs: Add location tracking for threads and atomic operations (#258)
- logs: Add additional location tracking to `Arc`, `alloc`, and `mpsc`
  (#265)
- logs: Improve `tracing` configuration for `LOOM_LOG` (#266)
- logs: Add a span for the current model's iteration (#267)

### Documented

- Add note about in-memory representation of atomic types (#253)
- Document `LOOM_LOG` syntax (#257)

### Fixed

- Fix double panic when exceeding the branch limit in `Drop` (#245)
- cell: Allow using `{Mut,Const}Ptr::{deref,with}` when the pointee is
  `!Sized` (#247)
- thread: Fix semantics of `thread::park` after `Thread::unpark` (#250)
@hawkw hawkw mentioned this pull request May 10, 2022
hawkw added a commit that referenced this pull request May 13, 2022
# 0.5.5 (May 10, 2022)

### Added

- sync: Add `Arc::from_std` without `T: Sized` bound (#226)
- sync: Implement `Debug` for `AtomicPtr` for all `T` (#255)
- logs: Add location tracking for threads and atomic operations (#258)
- logs: Add additional location tracking to `Arc`, `alloc`, and `mpsc`
  (#265)
- logs: Improve `tracing` configuration for `LOOM_LOG` (#266)
- logs: Add a span for the current model's iteration (#267)

### Documented

- Add note about in-memory representation of atomic types (#253)
- Document `LOOM_LOG` syntax (#257)

### Fixed

- Fix double panic when exceeding the branch limit in `Drop` (#245)
- cell: Allow using `{Mut,Const}Ptr::{deref,with}` when the pointee is
  `!Sized` (#247)
- thread: Fix semantics of `thread::park` after `Thread::unpark` (#250)
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.

2 participants