Bug 2310 - 1) testSyscallInterrupt(frysk.proc.TestSyscallInterrupt)java.lang.NullPointerException
Summary: 1) testSyscallInterrupt(frysk.proc.TestSyscallInterrupt)java.lang.NullPointer...
Status: RESOLVED FIXED
Alias: None
Product: frysk
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Stan Cox
URL:
Keywords:
Depends on: 2311
Blocks: 1582
  Show dependency treegraph
 
Reported: 2006-02-09 16:35 UTC by Adam Jocksch
Modified: 2006-10-18 19:29 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Jocksch 2006-02-09 16:35:50 UTC
1)
testSyscallInterrupt(frysk.proc.TestSyscallInterrupt)java.lang.NullPointerException
   at frysk.proc.LinuxHost$PollWaitOnSigChld$2.terminated(int, boolean, int,
boolean)
(/home/ajocksch/head/build/frysk-0.0.1.2006.02.09/frysk-core/frysk/proc/LinuxHost.java:310)
   at .processStatus(int, int, frysk.sys.Wait$Observer)
(/home/ajocksch/head/build/frysk-0.0.1.2006.02.09/frysk-sys/frysk/sys/cni/Wait.cxx:87)
   at frysk.sys.Wait.waitAllNoHang(frysk.sys.Wait$Observer)
(/home/ajocksch/head/build/frysk-0.0.1.2006.02.09/frysk-sys/frysk/sys/cni/Wait.cxx:164)
   at frysk.proc.LinuxHost$PollWaitOnSigChld.execute()
(/home/ajocksch/head/build/frysk-0.0.1.2006.02.09/frysk-core/frysk/proc/LinuxHost.java:316)
   at frysk.event.EventLoop.runEventLoop(boolean)
(/home/ajocksch/head/build/frysk-0.0.1.2006.02.09/frysk-core/frysk/event/EventLoop.java:311)
   at frysk.event.EventLoop.runPolling(long)
(/home/ajocksch/head/build/frysk-0.0.1.2006.02.09/frysk-core/frysk/event/EventLoop.java:396)
   at frysk.proc.TestLib.assertRunUntilStop(java.lang.String)
(/home/ajocksch/head/build/frysk-0.0.1.2006.02.09/frysk-core/frysk/proc/TestLib.java:87)
   at frysk.proc.TestLib$AckHandler.await()
(/home/ajocksch/head/build/frysk-0.0.1.2006.02.09/frysk-core/frysk/proc/TestLib.java:200)
   at frysk.proc.TestLib$Child.TestLib$Child(frysk.proc.TestLib, int,
java.lang.String[])
(/home/ajocksch/head/build/frysk-0.0.1.2006.02.09/frysk-core/frysk/proc/TestLib.java:254)
   at frysk.proc.TestLib$Child.TestLib$Child(frysk.proc.TestLib,
java.lang.String[])
(/home/ajocksch/head/build/frysk-0.0.1.2006.02.09/frysk-core/frysk/proc/TestLib.java:215)
   at
frysk.proc.TestSyscallInterrupt$PipeReadChild.TestSyscallInterrupt$PipeReadChild(frysk.proc.TestSyscallInterrupt,
java.lang.String[])
(/home/ajocksch/head/build/frysk-0.0.1.2006.02.09/frysk-core/frysk/proc/TestSyscallInterrupt.java:65)
   at
frysk.proc.TestSyscallInterrupt$PipeReadChild.TestSyscallInterrupt$PipeReadChild(frysk.proc.TestSyscallInterrupt,
boolean)
(/home/ajocksch/head/build/frysk-0.0.1.2006.02.09/frysk-core/frysk/proc/TestSyscallInterrupt.java:65)
   at frysk.proc.TestSyscallInterrupt.testSyscallInterrupt()
(/home/ajocksch/head/build/frysk-0.0.1.2006.02.09/frysk-core/frysk/proc/TestSyscallInterrupt.java:224)
   at frysk.junit.Runner.Runner(java.lang.String[], java.util.Collection)
(/home/ajocksch/head/build/frysk-0.0.1.2006.02.09/frysk-imports/frysk/junit/Runner.java:211)
   at TestRunner.main(java.lang.String[])
(/home/ajocksch/head/build/frysk-0.0.1.2006.02.09/_build/frysk-core/TestRunner.java:59)
   at gnu.java.lang.MainThread.call_main() (/usr/lib/libgcj.s
Comment 1 Andrew Cagney 2006-02-09 20:51:54 UTC
+2006-02-09  Andrew Cagney  <cagney@redhat.com>
+
+       * funit-syscallint.c (main): Fix return status check for <<read>>,
+       and <<write>.
+
Comment 2 Andrew Cagney 2006-02-09 21:01:13 UTC
There's an underlying problem here, an abort by the program funit-syscallint
should not lead to a NullPointerException in frysk.  Need to tease this out and
create a new testcase where the test program aborts.

Notes on the code.  Wait.cxx contains:

  else if (WIFSIGNALED (status))
    observer->terminated (pid, true, WTERMSIG (status), WCOREDUMP (status));
  else if (WIFSTOPPED (status)) {

which <<can't happen>> -- checking code up the stack shows that <<observer>>
comes from a nested class variable which, at that point, definitly has to be live.

Assigning to stan since he's seen similar.
Comment 3 Andrew Cagney 2006-02-09 21:25:43 UTC
If you revert the below the crash will occure:

Index: frysk-core/frysk/pkglibexecdir/funit-syscallint.c
===================================================================
RCS file: /cvs/frysk/frysk-core/frysk/pkglibexecdir/funit-syscallint.c,v
retrieving revision 1.2
diff -p -u -r1.2 funit-syscallint.c
--- frysk-core/frysk/pkglibexecdir/funit-syscallint.c   8 Feb 2006 20:52:00
-0000       1.2
+++ frysk-core/frysk/pkglibexecdir/funit-syscallint.c   9 Feb 2006 20:50:41 -0000
@@ -104,7 +104,7 @@ int main (int argc, char **argv)
     }
     // Wait until we get a signal and then allow program to finish.
     sigsuspend (&a);
-    if (write (fd[1], "a", 1)){
+    if (write (fd[1], "a", 1) < 0) {
       perror ("write");
       abort ();
     }
@@ -129,13 +129,13 @@ int main (int argc, char **argv)
       action.sa_flags = SA_RESTART;
     sigaction (SIGUSR1, &action, NULL);
     // Wait until child is ready.
-    if (read (fd2[0], buf, 1)){
+    if (read (fd2[0], buf, 1) < 0) {
       perror ("read");
       abort ();
     }
     // Indicate to frysk that parent and child processes are ready.
     tkill (fryskPid, fryskSig);
-    if (read (fd[0], buf, 1)){
+    if (read (fd[0], buf, 1) < 0) {
       perror ("read");
       abort ();
     }
Comment 4 Stan Cox 2006-02-27 17:56:08 UTC
<cagney> if it used Fork.daemon, the process would be be re-parented, and that
stray event wouldn't occur

        * TestSyscallInterrupt.java (TestSyscallInterrupt): Use fork.daemon.
        (ProcDestroyedObserver): Remove parent check.