mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-31 18:48:08 +00:00
Receiving a SIGUSR2 makes Vault log the running goroutines' stacks. (#6240)
* Receiving a SIGUSR2 makes Vault log the running goroutines' stacks.
This commit is contained in:
@@ -466,6 +466,7 @@ func initCommands(ui, serverCmdUi cli.Ui, runOpts *RunOptions) {
|
||||
PhysicalBackends: physicalBackends,
|
||||
ShutdownCh: MakeShutdownCh(),
|
||||
SighupCh: MakeSighupCh(),
|
||||
SigUSR2Ch: MakeSigUSR2Ch(),
|
||||
}, nil
|
||||
},
|
||||
"ssh": func() (cli.Command, error) {
|
||||
@@ -628,3 +629,20 @@ func MakeSighupCh() chan struct{} {
|
||||
}()
|
||||
return resultCh
|
||||
}
|
||||
|
||||
// MakeSigUSR2Ch returns a channel that can be used for SIGUSR2
|
||||
// goroutine logging. This channel will send a message for every
|
||||
// SIGUSR2 received.
|
||||
func MakeSigUSR2Ch() chan struct{} {
|
||||
resultCh := make(chan struct{})
|
||||
|
||||
signalCh := make(chan os.Signal, 4)
|
||||
signal.Notify(signalCh, syscall.SIGUSR2)
|
||||
go func() {
|
||||
for {
|
||||
<-signalCh
|
||||
resultCh <- struct{}{}
|
||||
}
|
||||
}()
|
||||
return resultCh
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user