Skip to content

Commit

Permalink
backporting changelog changes and fix for 3837 to 9.4.0.x stream (#725)
Browse files Browse the repository at this point in the history
* backporting changelog changes and fix for 3837 to 9.4.0.x stream

* remove 9.4.0.5-r1 changelog entry from 9.4.0.6 changelog
  • Loading branch information
Kumar Nishit authored and GitHub Enterprise committed Oct 16, 2024
1 parent ff43f7a commit f14fdba
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 9.4.0.6-r1 (2024-10)

* Updated to MQ version 9.4.0.6
* Changed shutdown flow to continue reaping orphan processes during queue manager shutdown

## 9.4.0.5-r1 (2024-09)

Expand Down
24 changes: 20 additions & 4 deletions cmd/runmqserver/signals.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
© Copyright IBM Corporation 2017, 2023
© Copyright IBM Corporation 2017, 2024
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -52,12 +52,21 @@ func signalHandler(qmgr string, startupCtx context.Context) chan int {

// Start handling signals
go func() {
shutdownCtx, shutdownComplete := context.WithCancel(context.Background())
defer func() {
shutdownComplete()
}()
stopTriggered := false
for {
select {
case sig := <-stopSignals:
if stopTriggered {
continue
}
log.Printf("Signal received: %v", sig)
signal.Stop(reapSignals)
signal.Stop(stopSignals)
stopTriggered = true

// If a stop signal is received during the startup process continue processing control signals until the main thread marks startup as complete
// Don't close the control channel until the main thread has been allowed to finish spawning processes and marks startup as complete
// Continue to process job control signals to avoid a deadlock
Expand All @@ -73,8 +82,15 @@ func signalHandler(qmgr string, startupCtx context.Context) chan int {
}
}
metrics.StopMetricsGathering(log)
// #nosec G104
stopQueueManager(qmgr)

// Shutdown queue manager in separate goroutine to allow reaping to continue in parallel
go func() {
_ = stopQueueManager(qmgr)
shutdownComplete()
}()
case <-shutdownCtx.Done():
signal.Stop(reapSignals)

// One final reap
// This occurs after all startup processes have been spawned
reapZombies()
Expand Down

0 comments on commit f14fdba

Please sign in to comment.