Opened 8 years ago

Closed 8 years ago

#10347 closed Bug Report - General (Fixed)

Updating to v0.25pre-4551-g769dfae prevents mythbackend shutdown

Reported by: Bill Meek <keemllib@…> Owned by: beirdo
Priority: minor Milestone: 0.25
Component: MythTV - MythSystem Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

On changeset 4550, shutdown happens as expected. After updating to 4551 when my local shutdown script runs, mythbackend reports a 1 is returned, however, when running the script manually, a 0 is returned.

preSDWUCheckCommand /usr/local/sbin/LocalPreShutdownTests.sh

SystemManager system-unix.cpp:326 (run) Managed child has exited! \
command=/usr/local/sbin/LocalPreShutdownTests.sh, status=256, result=1

$ LocalPreShutdownTests.sh ; echo "LocalPreShutdownTests.sh Returns: $?"
LocalPreShutdownTests.sh Returns: 0

Attachments (3)

mythbackend.20120216193628.4911.log (13.7 KB) - added by Bill Meek <keemllib@…> 8 years ago.
version.txt (770 bytes) - added by Bill Meek <keemllib@…> 8 years ago.
LocalPreShutdownTests.sh (1.6 KB) - added by Bill Meek <keemllib@…> 8 years ago.
Yes, I was following along on http://irc.mythtv.org/ircLog/channel/1/2012-02-17 ;)

Download all attachments as: .zip

Change History (10)

Changed 8 years ago by Bill Meek <keemllib@…>

Changed 8 years ago by Bill Meek <keemllib@…>

Attachment: version.txt added

Changed 8 years ago by Bill Meek <keemllib@…>

Attachment: LocalPreShutdownTests.sh added

Yes, I was following along on http://irc.mythtv.org/ircLog/channel/1/2012-02-17 ;)

comment:1 Changed 8 years ago by beirdo

I see no reason that the changes would affect that script. Please find out which term on that final if is false so we can trace it back to the actual issue.

comment:2 in reply to:  1 Changed 8 years ago by Bill Meek <keemllib@…>

Replying to beirdo:

Please find out which term on that final if is false...

It is NC=2 (not 1), or result of netstat|grep 2>&1

I changed the script to simply "grep foo /etc/hosts". Then ran it with and without "2>&1" appended.

For these tests, there is no foo in /etc/hosts and result=value is from system-unix.cpp:326 in the log.

4450-774ceca

grep foo /etc/hosts 2>&1 result=1
grep foo /etc/hosts      result=1

4451-769dfae

grep foo /etc/hosts 2>&1 result=2 <------
grep foo /etc/hosts      result=1

comment:3 Changed 8 years ago by beirdo

On the original line you had 2>&1 > /dev/null. Thus, no matter what I do with stderr or stdout in our code, you aren't supposed to be writing to either. I don't see an issue here.

However, let me try something to see if it helps with what I can only describe as a very oddly broken set of circumstances.

You may also want to try changing the line to:

(grep foo /etc/hosts) 2>&1 > /dev/null

or:

((grep foo /etc/hosts) 2>&1) > /dev/null

Meanwhile, I'll go see if I can unbork this.

comment:4 Changed 8 years ago by Github

More elegantly redirect stdout/stderr rather than just closing

Refs #10347

This should fix this bug, although it could be bypassed by fiddling the script itself. This should be more foolproof.

Branch: master Changeset: 8f9a9b11be2ba004c9a1df8dfc7546179ce0e699

comment:5 Changed 8 years ago by beirdo

OK, please let me know if this change fixes the problem.

comment:6 in reply to:  5 Changed 8 years ago by Bill Meek <keemllib@…>

Replying to beirdo:

OK, please let me know if this change fixes the problem.

Short answer, yes its fixed. Thank you.

I'm now running on 4574-a25b8de.

Now both the grep with and without redirection return 1. I didn't try your comment:3 tests on 4551, but did test them on 4574 and they too return 1.

Finally, the original script was restored and the machine just shutdown.

So, a better title would have been: "Updating to 769dfae can cause errors in scripts with redirection"

comment:7 Changed 8 years ago by Raymond Wagner

Milestone: unknown0.25
Resolution: Fixed
Status: newclosed

Reported as fixed.

Note: See TracTickets for help on using tickets.