Skip to content

Commit d22700f

Browse files
committed
azure-lb: Don't redirect nc listener output to pidfile
The `lb_start()` function spawns an `nc` listener background process and echoes the resulting pid to `$pidfile`. Due to a bug in the redirection, all future data received by the `nc` process is also appended to `$pidfile`. If binary data is received later and appended to `$pidfile`, the monitor operation fails when `grep` searches the now-binary file. ``` line 97: kill: Binary: arguments must be process or job IDs ] line 97: kill: file: arguments must be process or job IDs ] line 97: kill: /var/run/nc_PF2_02.pid: arguments must be process or job IDs ] line 97: kill: matches: arguments must be process or job IDs ] ``` Then the start operation fails during recovery. `lb_start()` spawns a new `nc` process, but the old process is still running and using the configured port. ``` nc_PF2_02_start_0:777:stderr [ Ncat: bind to :::62502: Address already in use. QUITTING. ] ``` This patch fixes the issue by removing the `nc &` command from the section whose output gets redirected to `$pidfile`. Now, only the `nc` PID is echoed to `$pidfile`. Resolves: RHBZ#1850778 Resolves: RHBZ#1850779
1 parent 9708c03 commit d22700f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

heartbeat/azure-lb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ lb_start() {
113113
if ! lb_monitor; then
114114
ocf_log debug "Starting $process: $cmd"
115115
# Execute the command as created above
116-
eval "$cmd & echo \$!" > $pidfile
116+
$cmd &
117+
echo $! > $pidfile
117118
if lb_monitor; then
118119
ocf_log debug "$process: $cmd started successfully, calling monitor"
119120
lb_monitor

0 commit comments

Comments
 (0)