public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcj/22211] New: Thread.interrupt sometimes causes abort if thread is already dead
@ 2005-06-28  2:30 greenrd at greenrd dot org
  2005-06-28  9:18 ` [Bug libgcj/22211] " greenrd at greenrd dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: greenrd at greenrd dot org @ 2005-06-28  2:30 UTC (permalink / raw)
  To: java-prs

Thread.interrupt does not check if the thread is alive - it just signals the
thread regardless. This sometimes causes a segfault followed by an abort,
because the native thread library gets passed stale data.

Unable to create a reproducable test case - but I would hope it's self-evident
that the existing code in _Jv_ThreadInterrupt is bogus.

To fix this correctly, two things need to happen. (1) When interrupting, don't
do anything if the thread is not alive. (2) Properly synchronize access to the
alive_flag, to avoid races.

-- 
           Summary: Thread.interrupt sometimes causes abort if thread is
                    already dead
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libgcj
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: greenrd at greenrd dot org
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22211


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libgcj/22211] Thread.interrupt sometimes causes abort if thread is already dead
  2005-06-28  2:30 [Bug libgcj/22211] New: Thread.interrupt sometimes causes abort if thread is already dead greenrd at greenrd dot org
@ 2005-06-28  9:18 ` greenrd at greenrd dot org
  2005-06-28 15:13 ` greenrd at greenrd dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: greenrd at greenrd dot org @ 2005-06-28  9:18 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From greenrd at greenrd dot org  2005-06-28 09:18 -------
Working on a patch, but bugzilla won't let me own this bug because it hasn't
been confirmed.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22211


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libgcj/22211] Thread.interrupt sometimes causes abort if thread is already dead
  2005-06-28  2:30 [Bug libgcj/22211] New: Thread.interrupt sometimes causes abort if thread is already dead greenrd at greenrd dot org
  2005-06-28  9:18 ` [Bug libgcj/22211] " greenrd at greenrd dot org
@ 2005-06-28 15:13 ` greenrd at greenrd dot org
  2005-06-29 14:50 ` mlists at juma dot me dot uk
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: greenrd at greenrd dot org @ 2005-06-28 15:13 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From greenrd at greenrd dot org  2005-06-28 15:12 -------
Ignore previous comment. As a (probably overzealous) legal precaution, I will
not be submitting a patch. (For the record, I do not believe any of my previous
contributions are problematic in any way.)

Consider this bug unassigned again.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22211


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libgcj/22211] Thread.interrupt sometimes causes abort if thread is already dead
  2005-06-28  2:30 [Bug libgcj/22211] New: Thread.interrupt sometimes causes abort if thread is already dead greenrd at greenrd dot org
  2005-06-28  9:18 ` [Bug libgcj/22211] " greenrd at greenrd dot org
  2005-06-28 15:13 ` greenrd at greenrd dot org
@ 2005-06-29 14:50 ` mlists at juma dot me dot uk
  2005-06-29 17:06 ` tromey at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mlists at juma dot me dot uk @ 2005-06-29 14:50 UTC (permalink / raw)
  To: java-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mlists at juma dot me dot uk


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22211


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libgcj/22211] Thread.interrupt sometimes causes abort if thread is already dead
  2005-06-28  2:30 [Bug libgcj/22211] New: Thread.interrupt sometimes causes abort if thread is already dead greenrd at greenrd dot org
                   ` (2 preceding siblings ...)
  2005-06-29 14:50 ` mlists at juma dot me dot uk
@ 2005-06-29 17:06 ` tromey at gcc dot gnu dot org
  2005-06-29 17:20 ` greenrd at greenrd dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: tromey at gcc dot gnu dot org @ 2005-06-29 17:06 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From tromey at gcc dot gnu dot org  2005-06-29 17:06 -------
I have a patch for this.
Could you try it with RSSOwl if I send it to you?


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |tromey at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-06-29 17:06:27
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22211


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libgcj/22211] Thread.interrupt sometimes causes abort if thread is already dead
  2005-06-28  2:30 [Bug libgcj/22211] New: Thread.interrupt sometimes causes abort if thread is already dead greenrd at greenrd dot org
                   ` (3 preceding siblings ...)
  2005-06-29 17:06 ` tromey at gcc dot gnu dot org
@ 2005-06-29 17:20 ` greenrd at greenrd dot org
  2005-06-29 17:22 ` tromey at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: greenrd at greenrd dot org @ 2005-06-29 17:20 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From greenrd at greenrd dot org  2005-06-29 17:20 -------
Sure.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22211


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libgcj/22211] Thread.interrupt sometimes causes abort if thread is already dead
  2005-06-28  2:30 [Bug libgcj/22211] New: Thread.interrupt sometimes causes abort if thread is already dead greenrd at greenrd dot org
                   ` (4 preceding siblings ...)
  2005-06-29 17:20 ` greenrd at greenrd dot org
@ 2005-06-29 17:22 ` tromey at gcc dot gnu dot org
  2005-06-29 17:36 ` cvs-commit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: tromey at gcc dot gnu dot org @ 2005-06-29 17:22 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From tromey at gcc dot gnu dot org  2005-06-29 17:22 -------
Actually, I wrote a very simple test case and I'm simply going to
check in my fix.  The test just makes a Thread and calls interrupt
on it before starting it.  With gij this currently aborts.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22211


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libgcj/22211] Thread.interrupt sometimes causes abort if thread is already dead
  2005-06-28  2:30 [Bug libgcj/22211] New: Thread.interrupt sometimes causes abort if thread is already dead greenrd at greenrd dot org
                   ` (5 preceding siblings ...)
  2005-06-29 17:22 ` tromey at gcc dot gnu dot org
@ 2005-06-29 17:36 ` cvs-commit at gcc dot gnu dot org
  2005-06-29 17:42 ` tromey at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-06-29 17:36 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-06-29 17:36 -------
Subject: Bug 22211

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	tromey@gcc.gnu.org	2005-06-29 17:36:16

Modified files:
	libjava        : ChangeLog 
	libjava/java/lang: Thread.java natThread.cc 
Added files:
	libjava/testsuite/libjava.lang: pr22211.java 

Log message:
	PR libgcj/22211:
	* testsuite/libjava.lang/pr22211.java: New file.
	* java/lang/natThread.cc (finish_): Synchronize when updating
	alive_flag.
	(_Jv_AttachCurrentThread): Likewise.
	(interrupt): Only call _Jv_ThreadInterrupt if thread is alive.
	* java/lang/Thread.java (isAlive): Now synchronized.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&r1=1.3682&r2=1.3683
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/java/lang/Thread.java.diff?cvsroot=gcc&r1=1.35&r2=1.36
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/java/lang/natThread.cc.diff?cvsroot=gcc&r1=1.30&r2=1.31
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/testsuite/libjava.lang/pr22211.java.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22211


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libgcj/22211] Thread.interrupt sometimes causes abort if thread is already dead
  2005-06-28  2:30 [Bug libgcj/22211] New: Thread.interrupt sometimes causes abort if thread is already dead greenrd at greenrd dot org
                   ` (6 preceding siblings ...)
  2005-06-29 17:36 ` cvs-commit at gcc dot gnu dot org
@ 2005-06-29 17:42 ` tromey at gcc dot gnu dot org
  2005-06-29 17:49 ` [Bug libgcj/22211] [4.0 only] " pinskia at gcc dot gnu dot org
  2005-08-09  0:11 ` greenrd at greenrd dot org
  9 siblings, 0 replies; 11+ messages in thread
From: tromey at gcc dot gnu dot org @ 2005-06-29 17:42 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From tromey at gcc dot gnu dot org  2005-06-29 17:42 -------
I checked this in to cvs trunk.
It should go in 4.0 as well once the branch reopens.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22211


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libgcj/22211] [4.0 only] Thread.interrupt sometimes causes abort if thread is already dead
  2005-06-28  2:30 [Bug libgcj/22211] New: Thread.interrupt sometimes causes abort if thread is already dead greenrd at greenrd dot org
                   ` (7 preceding siblings ...)
  2005-06-29 17:42 ` tromey at gcc dot gnu dot org
@ 2005-06-29 17:49 ` pinskia at gcc dot gnu dot org
  2005-08-09  0:11 ` greenrd at greenrd dot org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-29 17:49 UTC (permalink / raw)
  To: java-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Thread.interrupt sometimes  |[4.0 only] Thread.interrupt
                   |causes abort if thread is   |sometimes causes abort if
                   |already dead                |thread is already dead
   Target Milestone|---                         |4.0.2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22211


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug libgcj/22211] [4.0 only] Thread.interrupt sometimes causes abort if thread is already dead
  2005-06-28  2:30 [Bug libgcj/22211] New: Thread.interrupt sometimes causes abort if thread is already dead greenrd at greenrd dot org
                   ` (8 preceding siblings ...)
  2005-06-29 17:49 ` [Bug libgcj/22211] [4.0 only] " pinskia at gcc dot gnu dot org
@ 2005-08-09  0:11 ` greenrd at greenrd dot org
  9 siblings, 0 replies; 11+ messages in thread
From: greenrd at greenrd dot org @ 2005-08-09  0:11 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From greenrd at greenrd dot org  2005-08-09 00:11 -------
(In reply to comment #7)
> I checked this in to cvs trunk.
> It should go in 4.0 as well once the branch reopens.

Ping.



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22211


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2005-08-09  0:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-28  2:30 [Bug libgcj/22211] New: Thread.interrupt sometimes causes abort if thread is already dead greenrd at greenrd dot org
2005-06-28  9:18 ` [Bug libgcj/22211] " greenrd at greenrd dot org
2005-06-28 15:13 ` greenrd at greenrd dot org
2005-06-29 14:50 ` mlists at juma dot me dot uk
2005-06-29 17:06 ` tromey at gcc dot gnu dot org
2005-06-29 17:20 ` greenrd at greenrd dot org
2005-06-29 17:22 ` tromey at gcc dot gnu dot org
2005-06-29 17:36 ` cvs-commit at gcc dot gnu dot org
2005-06-29 17:42 ` tromey at gcc dot gnu dot org
2005-06-29 17:49 ` [Bug libgcj/22211] [4.0 only] " pinskia at gcc dot gnu dot org
2005-08-09  0:11 ` greenrd at greenrd dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).