Skip to content

Commit f14fdba

Browse files
Kumar NishitGitHub Enterprise
authored andcommitted
backporting changelog changes and fix for 3837 to 9.4.0.x stream (#725)
* 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
1 parent ff43f7a commit f14fdba

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 9.4.0.6-r1 (2024-10)
44

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

78
## 9.4.0.5-r1 (2024-09)
89

cmd/runmqserver/signals.go

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
© Copyright IBM Corporation 2017, 2023
2+
© Copyright IBM Corporation 2017, 2024
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -52,12 +52,21 @@ func signalHandler(qmgr string, startupCtx context.Context) chan int {
5252

5353
// Start handling signals
5454
go func() {
55+
shutdownCtx, shutdownComplete := context.WithCancel(context.Background())
56+
defer func() {
57+
shutdownComplete()
58+
}()
59+
stopTriggered := false
5560
for {
5661
select {
5762
case sig := <-stopSignals:
63+
if stopTriggered {
64+
continue
65+
}
5866
log.Printf("Signal received: %v", sig)
59-
signal.Stop(reapSignals)
6067
signal.Stop(stopSignals)
68+
stopTriggered = true
69+
6170
// If a stop signal is received during the startup process continue processing control signals until the main thread marks startup as complete
6271
// Don't close the control channel until the main thread has been allowed to finish spawning processes and marks startup as complete
6372
// Continue to process job control signals to avoid a deadlock
@@ -73,8 +82,15 @@ func signalHandler(qmgr string, startupCtx context.Context) chan int {
7382
}
7483
}
7584
metrics.StopMetricsGathering(log)
76-
// #nosec G104
77-
stopQueueManager(qmgr)
85+
86+
// Shutdown queue manager in separate goroutine to allow reaping to continue in parallel
87+
go func() {
88+
_ = stopQueueManager(qmgr)
89+
shutdownComplete()
90+
}()
91+
case <-shutdownCtx.Done():
92+
signal.Stop(reapSignals)
93+
7894
// One final reap
7995
// This occurs after all startup processes have been spawned
8096
reapZombies()

0 commit comments

Comments
 (0)