forked from openzfs/zfs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
save local variables from Responder::response_task() for debugging (o…
…penzfs#279) We've seen an unexplained hang where it seems like `Responder::response_task()` is not sending responses that it should. To diagnose this, we would like to be able to look at its local variables if we hit this hang again. Specifically, the `rx: mpsc::UnboundedReceiver<ResponseMessage>` and `output: BufWriter<unix::OwnedWriteHalf>`. This commit adds a new debugging mechanism, `DebugPointerSet` which is based on `lazy_static_ptr!`. It allows us to save several pointers (of the same type) in a way that will let us find them from the debugger. This additional mechanism is needed because (unlike existing users of `lazy_static_ptr!`) there are multiple objects that we need to track (the number not known at compile time, since it depends on the number of active connections), and we want to hold references to the objects (rx, output) without holding any locks. `response_task()` uses `DebugPointerSet` to save its `rx` and `output` in a way that we can find them in the debugger if it hangs or crashes. Example use: ``` (gdb) p zettaobject::server::Responder::response_task::RESPOND_RECEIVERS_PTR.p.value.set.ptr.pointer.data.data.value $5 = HashSet(size=1) = { util::lazy_static_ptr::DebugPointer<(tokio::sync::mpsc::unbounded::UnboundedReceiver<zettaobject::server::ResponseMessage>, tokio::io::util::buf_writer::BufWriter<tokio::net::unix::split_owned::OwnedWriteHalf>)> ( 0x7fc3247b6850 )} (gdb) p *(0x7fc3247b6850 as *const (tokio::sync::mpsc::unbounded::UnboundedReceiver<zettaobject::server::ResponseMessage>,tokio::io::util::buf_writer::BufWriter<tokio::net::unix::split_owned::OwnedWriteHalf>)) ... head: core::ptr::non_null::NonNull<tokio::sync::mpsc::block::Block<zettaobject::server::ResponseMessage>> { pointer: 0x7fc011140bb0 }, ... fd: 15 ... buf: Vec(size=1176) = {2, 0, 0, 0, 16, 0, 0, 0, ... ```
- Loading branch information
Showing
4 changed files
with
145 additions
and
11 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters