Robin Dunn <robin <at> alldunn.com> writes:
Gal Aviel wrote:
> Hello All,
>
> I am pretty desperate by now, thinking about using Tkinter
> (at least it works out of the box ..).
>
> I compiled wxPython 2.6.3.3 against GTK 1.2.10 and tried running WorkBench
> 1.4.0 (Subversion GUI from pysvn.subversion.org). Also tried SPE (Stani's
> Python editor). I've tried both under MS-Windows and they worked 100%.
>
> The symptom : The apps seem to run (mostly) OK, but after a few minutes,
> they crash with a msg "Terminated" on my xterm.
>
> Versions : Linux intel machine RedHat WS 3, and the following software
> compiled from source using gcc 3.2.3 : Python - 2.4.3, wxGTK - 2.6.3.3,
> glib - 1.2.10, gtk+ - 1.2.10, subversion-1.3.2. I didn't use GTK2
> because it was too slow.
>
> I tried finding out where the "Terminated" error msg is coming from ,
> so I grepped the source trees of the above packages, and found :
> glib-1.2.10/gstrfuncs.c: case SIGTERM: return "Terminated";
>
> Any ideas ?The TERM signal is typically sent to a process by its parent, the user
or the system when it wants to have the process shut itself down safely.
It is possible for a process to send itself a TERM signal, but that
is not typically done. So the thing to do is to try and track down
where that signal is being sent from and investigate why it is doing so.
Gentelman,
Thanks very much for your help.
When running on a different Linux machine, there is no problem -
the SPE and Subversion WorkBench don't crash.
I tried to debug the problem by modifying the python source code, i.e.
changing Modules/python.c to instal a hanlder for the TERM signal and
printing the fields that I get (see below).
I got wierd results, it looks like PID 0 is sending me the signal. The errno,
signal code, etc are all bad - they are big negative integers.
Of course the handler below ignores the signal basically, so it keeps getting
it every about 5min. Something with the O/S I guess. When running tkinter I see
same issues.
So it's the O/S.
Thanks again, and here's my Modules/python.c :
/* Minimal main program -- everything is loaded from the library */
#include "Python.h"
#ifdef __FreeBSD__
#include <floatingpoint.h>
#endif
/* gal */
#include <stdio.h>
#include <signal.h>
#include <errno.h>
#include <ucontext.h>
static void myhandler (unsigned int sn , siginfo_t si , struct ucontext *sc)
{
unsigned int mnip;
int i;
printf(" gal's signal number = %d, signal errno = %d, signal code = %d\n",
si.si_signo,si.si_errno,si.si_code);
printf(" senders' pid = %x, sender's uid = %d, \n",si.si_pid,si.si_uid);
}
int
main(int argc, char **argv)
{
/* 754 requires that FP exceptions run in "no stop" mode by default,
* and until C vendors implement C99's ways to control FP exceptions,
* Python requires non-stop mode. Alas, some platforms enable FP
* exceptions by default. Here we disable them.
*/
#ifdef __FreeBSD__
fp_except_t m;
m = fpgetmask();
fpsetmask(m & ~FP_X_OFL);
#endif
/* gal - install signal handler */
struct sigaction s;
s.sa_flags = SA_SIGINFO;
s.sa_sigaction = (void *)myhandler;
if(sigaction (SIGTERM,&s,(struct sigaction *)NULL)) {
printf("Sigaction returned error = %d\n", errno);
exit(0);
}
return Py_Main(argc, argv);
}