-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
chore: fire shutdown signal on anvil node handle drop #8947
Conversation
NodeHandle.fire_shutdown_signal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: why is this not called on Drop?
crates/anvil/src/lib.rs
Outdated
/// | ||
/// Called by long-running tests to make sure anvil instance is terminated. | ||
#[track_caller] | ||
pub fn fire_shutdown_signal(&mut self) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this go into an impl Drop
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, will do and make some tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, weird, I added in drop
+impl Drop for NodeHandle {
+ fn drop(&mut self) {
+ if let Some(signal) = self._signal.take() {
+ signal.fire().unwrap()
+ }
+ }
+}
and then got again a failure like
failed to spawn node: Os { code: 98, kind: AddrInUse, message: "Address already in use" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
proof::test_account_proof
going to make some more tests to see if consistently happens
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added in 277d62c ptal
NodeHandle.fire_shutdown_signal
Motivation
ref #8946 (review)
Solution