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

Add support for stackdump on 18.09 and below docker engine #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified docker-signal.exe
Binary file not shown.
9 changes: 9 additions & 0 deletions docker-signal.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package main
// on on Windows to either dump its stacks or it's debugger event.
// Works across dockerd.exe; containerd.exe; containerd-shim-runhcs-v1.exe
// Flags: -pid=daemonpid [-debugger]
// For docker engine 18.09 and below Flags: -pid=daemonpid -legacy

// go build -o signal-event.exe

Expand Down Expand Up @@ -49,17 +50,25 @@ func main() {
var (
pid int
debugger bool
legacy bool
)
flag.BoolVar(&debugger, "debugger", false, "Signal a debugger event rather than stackdump.")
flag.BoolVar(&legacy, "legacy", false, "Trigger a stackdump for 18.09 and below docker engine")
Copy link
Member

Choose a reason for hiding this comment

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

wondering if instead we should add back the flag that was added in #1 (with the typos fixed 😅)

Note that I see that older versions were tagged, so alternatively it would be possible to just download v0.1 or v0.2 for situations where an older daemon is used, in which case no changes would be needed for the current version

Choose a reason for hiding this comment

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

I had discussed the option of >1 versions of the binary with @ameyag prior to this change being created. I was trying to think of a better way to handle this, and at the time the command-line option looked to be the path of least resistance. Another option would be to give the binaries unique filenames that reflect the versions they support, but this feels awkward.

Also note that Microsoft has a troubleshooting page which links to this. Even with submitting a doc issue or PR, we don't have a say over how quickly the page gets updated to reflect the change in this repo.

Another way of phrasing this: what's the best way to signal a user to let them know that they've downloaded the wrong binary?

flag.IntVar(&pid, "pid", -1, "PID of process to signal")
flag.Parse()
if pid == -1 {
fmt.Println("Error: pid must be supplied")
return
}
if debugger && legacy {
fmt.Println("Error: debugger is not available on legacy platforms")
return
}
key := "stackdump"
if debugger {
key = "debugger"
} else if legacy {
key = "docker-daemon"
}

ev := fmt.Sprintf("Global\\%s-%s", key, fmt.Sprint(pid))
Expand Down