Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4764778
Votes 2
Synopsis Interrupted thread can't load classes from classes directory (sol)
Category java:classes_lang
Reported Against 1.3 , 1.4.2 , mantis , 1.4.2_05 , merlin-rc1
Release Fixed mustang(b71)
State 10-Fix Delivered, Verified, bug
Priority: 2-High
Related Bugs 6317397 , 4385444 , 6375934 , 4549130 , 4989068 , 4992463 , 5019664 , 4415048
Submit Date 17-OCT-2002
Description
It is important to note that this program only fails on
internal builds that don't have images made. If you have made
images, then it works. I assume that if one includes classes of
their own not in a jar, then maybe they can't load their classes
if the thread is interrupted...

import java.nio.channels.*;

public class Blah {
    public static void main(String[] args) throws Exception {
        Thread.currentThread().interrupt();
        SocketChannel.open().close(); // Any class not yet loaded
    }
}

/export/mantis> /export/cache1/build/solaris-sparc/bin/java Blah
Exception in thread "main" java.lang.NoClassDefFoundError: java/nio/channels/SocketChannel
        at Blah.main(Blah.java:6)

This bug has been present for several years.
Work Around
N/A
Evaluation
I suspect that some activity involved in class loading/intialization (probably IO) is failing with an InterruptedException, which is silently translated to a NoClassDefFoundError.  This is clearly a bug and should be fixed.

  xxxxx@xxxxx   2003-01-14

This is also a problem if the class being searched for is on the
user class path instead of the bootclasspath.  See the shell
transcript below:

------------------------------------------------------------------
$ cat Bug.java
public class Bug {
    public static void main(String[] args) {
	class Empty {}
	Thread.currentThread().interrupt();
	new Empty();
    }
}
$ jver 6.0 jr Bug
==> javac -source 1.6 -Xlint:all Bug.java
==> java -esa -ea Bug
Exception in thread "main" java.lang.NoClassDefFoundError: Bug$1Empty
	at Bug.main(Bug.java:5)
Command java -esa -ea Bug failed: rc=1
------------------------------------------------------------------

so this may be a rather more important bug to fix.

  xxxxx@xxxxx   2004-01-24
Posted Date : 2006-01-23 22:34:55.0

The following is perhaps the canonical minimal ThreadPool test:
----------------------------------------------------------
import java.util.concurrent.*;

public class Bug2 {

    public static void main(String[] args) throws Throwable {
	ExecutorService es = Executors.newFixedThreadPool(10);
	for (int i = 0; i < 10; i++)
	    es.submit(new Runnable() { public void run() {}});
	es.shutdown();
    }
}
----------------------------------------------------------
This test has serious reliability problems when run on Solaris
with mustang b51
(there may be more than one bug at hand here)
When run repeatedly, it may succeed, or hang, or give:

Exception in thread "pool-1-thread-1" java.lang.InterruptedException
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:705)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:735)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1067)
	at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:187)
	at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:263)
	at java.util.concurrent.ThreadPoolExecutor.workerDone(ThreadPoolExecutor.java:551)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:698)
	at java.lang.Thread.run(Thread.java:611)

or

java.lang.NoClassDefFoundError: Lsun/nio/ch/Interruptible;
	at java.lang.Class.getDeclaredFields0(Native Method)
	at java.lang.Class.privateGetDeclaredFields(Class.java:2243)
	at java.lang.Class.getDeclaredField(Class.java:1863)
	at java.util.concurrent.locks.LockSupport.<clinit>(LockSupport.java:95)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:705)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:735)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1067)
	at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:187)
	at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:263)
	at java.util.concurrent.ThreadPoolExecutor.interruptIdleWorkers(ThreadPoolExecutor.java:536)
	at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:512)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:693)
	at java.lang.Thread.run(Thread.java:611)
Posted Date : 2005-09-11 15:57:43.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang