Opened 12 years ago

Closed 12 years ago

#4381 closed defect (fixed)

Using a Miscellaneous Status Information (see ticket #4049) makes mythbackend segfault occasionnally...

Reported by: anonymous Owned by: paulh
Priority: minor Milestone: 0.21
Component: mythtv Version: head
Severity: medium Keywords:
Cc: stuartm Ticket locked: no

Description

If one uses the myth_sensors.sh (and setups Mythtv accordingly) the backend (frequently) crashes instead of displaying the information in the backend status page (of Mythweb ot the other at port 6544).

Sometimes only refreshing the page a couple of time does the trick, other times doing something else such as recording/watching live tv helps in getting the segfault...

I've attached a log of gdb but I am unfamiliar with the tool so I hope this is the required info...

Thank you!

Nick

Attachments (4)

gdb.txt (35.5 KB) - added by anonymous 12 years ago.
gdb log
mythtv-misc_status_info_popen.patch (4.5 KB) - added by sphery <mtdean@…> 12 years ago.
mythtv-misc_status_info_popen-20080124.patch (4.5 KB) - added by sphery <mtdean@…> 12 years ago.
Updated patch--fixes i18n issue with original patch--thanks to Nicolas Riendeau
mythtv-misc_status_info_popen-20080124-2.patch (4.5 KB) - added by sphery <mtdean@…> 12 years ago.
More proper fix. Uses QString::fromLocal8Bit().

Download all attachments as: .zip

Change History (10)

Changed 12 years ago by anonymous

Attachment: gdb.txt added

gdb log

Changed 12 years ago by sphery <mtdean@…>

comment:1 Changed 12 years ago by sphery <mtdean@…>

The attached patch, mythtv-misc_status_info_popen.patch, changes the miscellaneous status info section to use popen() rather than the non-thread-safe QProcess class. When testing before the patch, I was generally able to cause a segfault within an hour by running:

while [ 1 ]; do wget http://localhost:6544/ -O /dev/null; done

in 2 terminals (> 2 responses per second) with a miscellaneous status script. After the patch, I was able to run under the same conditions for > 5 hours without a segfault. It even works with the miscellaneous status script set to the program I wrote to always segfault.

In making the change, I removed the 10-second timeout to keep the patch simple. Without the timeout, rather than waiting 10-seconds then returning the status page without any of the miscellaneous status information, the status page request will actually wait for output. Since the 10-second limit was rather arbitrary, and since a slow response may encourage users to fix their status scripts, I didn't think the timeout was worth the extra code required (especially since we could easily switch back to using QProcess after the QT4 transition). If a timeout is still required/desired, please let me know and I'll fix the patch. I also modified the README, removing mention of the timeout and recommending users create fast-running scripts or pre-compute values if necessary.

This patch may break the Win32 compile, but as I don't have a system for testing, I didn't attempt to fix it. If nothing else, disabling the miscellaneous status info section from HttpStatus? and the setting in backendsettings.cpp for the mingw build would allow it to compile.

Thanks to Anduin, both Stuarts, and others on IRC for helping.

comment:2 Changed 12 years ago by knightr@…

Hi!

Thanks for fixing this problem!

I'll try it this weekend (most probably later today) and report back...

Thank you!

Nick

comment:3 Changed 12 years ago by stuartm

Cc: stuartm added

comment:4 Changed 12 years ago by knightr@…

Hi!

I have not been able to make it segfault since I applied the patch this morning.

I did both the things that used to make it crash under normal operation and calling it repetively while doing other things and none of them caused any problem.

It would be nice to eventually give back to mythbackend control over misbehaving programs (in the form of a timeout) but as far as I am concerned this fix gets the job done.

Thank you!

Nick

PS: There is one small issue with the the myth_sensors.sh script for which I did a workaround (there might be a better way to do it than what I did though...). I'll probably post about it on the ML or submit another ticket this week...

Changed 12 years ago by sphery <mtdean@…>

Updated patch--fixes i18n issue with original patch--thanks to Nicolas Riendeau

Changed 12 years ago by sphery <mtdean@…>

More proper fix. Uses QString::fromLocal8Bit().

comment:5 Changed 12 years ago by paulh

Owner: changed from Isaac Richards to paulh
Status: newassigned

comment:6 Changed 12 years ago by paulh

Resolution: fixed
Status: assignedclosed

(In [15683]) Fix some random backend crashes when retrieving the status page and using a miscellaneous status information script.

This patch uses popen() to run the script rather than the non-thread-safe QProcess class.

Patch by Michael T. Dean. Closes #4381.

Note: See TracTickets for help on using tickets.