Warning Please read the Ticket HowTo before creating or commenting on a ticket. Failure to do so may cause your ticket to be rejected or result in a slower response.

Opened 23 months ago

Closed 10 months ago

#10841 closed Bug Report - General (Fixed)

SignalHandling returns from SEGFAULT signal handler

Reported by: danielk Owned by: beirdo
Priority: minor Milestone: 0.26.1
Component: MythTV - General Version: Master Head
Severity: medium Keywords:
Cc: Ticket locked: no


If you return from a SIGFAULT, SIGFPE, SIGBUS, or SIGILL the offending code is re-run and the signal is raised again.

If the fault occurs in the the UI thread where SignalHandler::handleSignal() is run in it will never run since we never get the opportunity to continue on to where the QSocketNotifier events are handled.

This leads the write() in SignalHandler::signalHandler() to block forever, deadlocking the UI thread.

Attachments (1)

segfault-handling-poc-v1.patch (1.2 KB) - added by danielk 23 months ago.
Proof-of-concept fix.

Download all attachments as: .zip

Change History (7)

Changed 23 months ago by danielk

Proof-of-concept fix.

comment:1 Changed 23 months ago by Daniel Thor Kristjansson <danielk@…>

In 546fdac8d1e952422c91278be3187ae87aded28e/mythtv:

Refs #10841. A fix for SEGFAULT handling.

We may want to handle this differently later, but this works.
We don't return from signalHandler if the signal is SEGV, ILL, BUS, or FPE.
This ensures the signal isn't immediately re-raised on return.
Also, after waiting 1 second for any cleanup actions which will
only happen if this signal didn't occur in the UI thread, we
call the default handler which will generate a core if necessary
and then exit the program.

comment:2 Changed 23 months ago by Daniel Thor Kristjansson <danielk@…>

In 6f218b1ab4ad067f564eb07919560970cbb77de2/mythtv:

Refs #10841. Add stdlib include for free.

comment:3 Changed 23 months ago by Daniel Thor Kristjansson <danielk@…>

In 62f3c643d80e617aa718421795ca3ac216e3c7cc/mythtv:

Refs #10841. Define SIGBUS as SIGSEGV on windows systems.

comment:4 Changed 23 months ago by beirdo

  • Owner set to beirdo
  • Status changed from new to assigned

I think what you have so far will work, but I'm considering restructuring it so the signal handlers are in their own thread, which should simplify things a bit. If this hasn't been changed by Aug 1, please remind me to close it as fixed :)

comment:5 Changed 19 months ago by kenni

  • Milestone changed from 0.26 to 0.26.1

comment:6 Changed 10 months ago by beirdo

  • Resolution set to Fixed
  • Status changed from assigned to closed

This is well past Aug 1, 2012. Let's consider this fixed.

Add Comment

Modify Ticket

as closed .
The resolution will be deleted. Next status will be 'new'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.