Opened 11 years ago

Closed 11 years ago

#3985 closed Bug (worksforme)

Exiting verification child process exits transmission with no error on mipsel player + fix

Reported by: WillemB Owned by:
Priority: Normal Milestone: None Set
Component: Daemon Version: 2.13
Severity: Normal Keywords: exit verify mipsel realtime signal
Cc:

Description

First of all I am not a C++ programmer, just have some general knowledge.

I have a mipsel based media player and have been having problems with transmission exiting with no errors. The exits happened at 99.9% verification. Even GDB said it exited normally. This was very strange since none of the exit() commands was used (tagged them with fprintf's). So I've been diving into the problem and have fixed it for my situation.

The problem imo was due to the POSIX real-time signals causing a shutdown. MAN PAGE: The default action for an unhandled real-time signal is to terminate the receiving process.

I found a solution in adding the following at the beginning of the main function.

        sigset_t alarm_sig;
        int i;

        /* Block all real time signals so they can be used for the timers.
           Note: this has to be done in main() before any threads are created
           so they all inherit the same mask. Doing it later is subject to
           race conditions */
        sigemptyset (&alarm_sig);
        for (i = SIGRTMIN; i <= SIGRTMAX; i++)
                sigaddset (&alarm_sig, i);
        sigprocmask (SIG_BLOCK, &alarm_sig, NULL);

The code was cut and paste from http://www.embedded-linux.co.uk/tutorial/periodic_threads

Could you please add this in the near future!!

Change History (4)

comment:1 Changed 11 years ago by WillemB

  • Component changed from Transmission to Daemon

comment:2 Changed 11 years ago by jordan

  • Milestone changed from 2.20 to None Set
  • Priority changed from High to Normal
  • Version changed from 2.13+ to 2.13

WillemB, I'm curious, do you know which signal is being sent that causes the exit()? I'm wondering if blanket-ignoring all of them may not be the best fix.

comment:3 Changed 11 years ago by WillemB

Jordan, the events I have been receiving have been SIG32 and SIG33 events. The SIG33 is probably the culprit. I read that only SIG32,33,34 are implemented. I also got a SIGPIPE event which I block using signal(SIGPIPE, SIG_IGN).

In the man page of SIGNAL I read: Linux supports 32 real-time signals, numbered from 32 (SIGRTMIN) to 63 (SIGRTMAX). ... Unlike standard signals, real-time signals have no predefined meanings: the entire set of real-time signals can be used for application-defined purposes. (Note, however, that the LinuxThreads? implementation uses the first three real-time signals.)

This would make blanket ignoring OK as long as no code relies on them. The first three signals should be looked at since they are used by LinuxThreads?.

Currently running longer than I ever have been.

As I said i'm no C++ programmer and I trust you can make a better fix than I can :).

Last edited 11 years ago by WillemB (previous) (diff)

comment:4 Changed 11 years ago by jordan

  • Resolution set to worksforme
  • Status changed from new to closed
19:46:33 < Blaat> Still have the ticket running for SIG32 to 34 masking ;-)  (i'm WillemB)
19:47:04 < Blaat> No hurry..
19:48:39 <@jordan> Blaat: what I find odd about that is that nobody else is reporting it
19:48:54 <@jordan> Blaat: actually your patch looks fine, especially considering all your disclaimers :)
19:49:12 <@jordan> Blaat: I just wonder why it's affecting you and (apparently) nobody else
20:07:50 < Blaat> Jordan, just had dinner. I don't know why I have this problem
20:08:19 < Blaat> probably because I have a half-ass firmwared media-player box
20:08:32 < Blaat> and i'm using a crosscompile toolchain
20:08:51 < Blaat> so maybe something in there isn't "normal"
20:10:53 < Blaat> anyway for me it would be a solution and maybe more people with mispel boxes are reporting crashes which might be related.
20:11:25 < Blaat> You can close the ticket if you want I'll add the code for myself :)
Note: See TracTickets for help on using tickets.