Tcl 8.2.3 uses "vfork" instead of "fork".  Apparently, "vfork" produces a
child process that shares the parent process's signal handlers.  Then the
Tcl code calls "RestoreSignals()" in the child process to make the signal
handlers back to defaults.  But this also changed the parent process's
signal handlers.

It looks like in Tcl 8.3, they stopped using "vfork" and just use a "fork",
which doesn't have this problem.  Here is the part of the change log from
8.3 mentioning this particular problem:

        * unix/configure.in:
        * unix/tcl.m4:
        * unix/tclUnixPipe.c: removed checking for compatible vfork
        function and use of the vfork function.  Modern VM systems rarely
        suffer any performance degradation when fork is used, and it
        solves multiple problems with vfork.  Users that still want vfork
        can add -Dfork=vfork to the compile flags. [Bug: 942 2228 1312]

So to use Tcl 8.2.3 with JDK 1.2.2, we need to patch the unix/tclUnixPipe.c
to use "fork" instead of "vfork".  After making this fix, everything worked
as expected.

-- Jiang Wu
   [EMAIL PROTECTED] 

-----Original Message-----
From: Mo DeJong [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 22, 2000 4:28 PM
To: Jiang Wu
Cc: [EMAIL PROTECTED]
Subject: [Tcl Java] Re: [Tcl Java] TclBlend Core Dump


I just ran your example and got a core dump with Tcl Blend 1.2.5
and JDK-1.2.1_03 on a Solaris 5.6 box. This is a mighty strange
one. Why would the parent process lose the signal handler in a fork().

Mo Dejong
Red Hat Inc.

On Mon, 20 Mar 2000, Jiang Wu wrote:

> Can someone verify that the following scenario will cause a core dump on
> Solaris 2.7?
> 
> Setup: Solaris 2.7, Tcl 8.2.3, TclBlend 1.2.6, JDK 1.2.2
> Steps: Start 'jtclsh' and type the following commands
> 
> package require java
> catch {set x [exec whoami]}
> java::load -classpath foo bar
> 
> ------------------------------------------------
> 
> In JDK 1.2.2, the JVM uses a signal handler to catch SIGSEGV.  "package
> require java" sets up this signal handler in the process.  However, after
> "exec whoami", the parent process loses the signal handler.  I put debug
> printf in the code "TclpCreateProcess(...)" in "tclUnixPipe.c" file.  It
> seems that after the "vfork()" call, only the child process is retaining
the
> signal handler.  The parent process no longer has the signal handler.
> 
>   // signal handler OK
>   pid = vfork();
> 
>   // signal handler OK in child process
>   // signal handler reverted to SIG_DFL in the parent process
> 
> Losing the signal handler causes the process to core dump later on when
> accessing certain Java code.
> 
> -- Jiang Wu
>    [EMAIL PROTECTED]


----------------------------------------------------------------
The TclJava mailing list is sponsored by Scriptics Corporation.
To subscribe:    send mail to [EMAIL PROTECTED]  
                 with the word SUBSCRIBE as the subject.
To unsubscribe:  send mail to [EMAIL PROTECTED] 
                 with the word UNSUBSCRIBE as the subject.
To send to the list, send email to '[EMAIL PROTECTED]'. 
An archive is available at http://www.mail-archive.com/tcljava@scriptics.com

----------------------------------------------------------------
The TclJava mailing list is sponsored by Scriptics Corporation.
To subscribe:    send mail to [EMAIL PROTECTED]  
                 with the word SUBSCRIBE as the subject.
To unsubscribe:  send mail to [EMAIL PROTECTED] 
                 with the word UNSUBSCRIBE as the subject.
To send to the list, send email to '[EMAIL PROTECTED]'. 
An archive is available at http://www.mail-archive.com/tcljava@scriptics.com

Reply via email to