Skip to content

ignore PoisonError in http_server - #6567

Merged
ry merged 1 commit into
denoland:masterfrom
ry:ignore_poison
Jun 29, 2020
Merged

ry merged 1 commit into
denoland:masterfrom
ry:ignore_poison

Conversation

@ry

@ry ry commented Jun 29, 2020

Copy link
Copy Markdown
Member

From the Mutex documentation:

The mutexes in this module implement a strategy called "poisoning" where a mutex is considered poisoned whenever a thread panics while holding the mutex. Once a mutex is poisoned, all other threads are unable to access the data by default as it is likely tainted (some invariant is not being upheld).

For a mutex, this means that the lock and try_lock methods return a Result which indicates whether a mutex has been poisoned or not. Most usage of a mutex will simply unwrap() these results, propagating panics among threads to ensure that a possibly invalid invariant is not witnessed.

A poisoned mutex, however, does not prevent all access to the underlying data. The PoisonError type has an into_inner method which will return the guard that would have otherwise been returned on a successful lock. This allows access to the data, despite the lock being poisoned.

Test threads panic regularly. We don't want that to effect subsequent tests.

@ry ry changed the title ignore PoisonError in test_server ignore PoisonError in http_server Jun 29, 2020
@ry
ry requested review from bartlomieju and piscisaureus June 29, 2020 20:27

@bartlomieju bartlomieju left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, let's see how it works in practice

@ry
ry merged commit a19d6a2 into denoland:master Jun 29, 2020
@ry
ry deleted the ignore_poison branch June 29, 2020 21:04
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

⌂ Proxy