JDK-6503428 : (ch) Assertion failure in NativeThreadSet.add
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 5.0,6u26
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2006-12-12
  • Updated: 2014-01-16
  • Resolved: 2011-05-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7
6u71Fixed 7 b06Fixed
Related Reports
Duplicate :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.5.0_08"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_08-b03)
Java HotSpot(TM) Client VM (build 1.5.0_08-b03, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Linux samantm 2.6.16.21-0.15-smp #1 SMP Tue Jul 25 15:28:49 UTC 2006 i686 i686 i386 GNU/Linux

A DESCRIPTION OF THE PROBLEM :
Received an assertion failure when attempting to read from a FileChannel.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
This is a difficult bug to reproduce due to the multithreaded nature of the problem.  Looking at the source of sun.nio.ch.NativeThreadSet reveals an off-by-one error on line 32.  This issue can be resolved by changing

	    if (used > elts.length) {

to

	    if (used >= elts.length) {



EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No assertion failure.

ERROR MESSAGES/STACK TRACES THAT OCCUR :

java.lang.AssertionError
	at sun.nio.ch.NativeThreadSet.add(NativeThreadSet.java:46)
	at sun.nio.ch.FileChannelImpl.write(FileChannelImpl.java:649)
	at com.orchestral.rhapsody.blobstore.file.FileWritableBlob.write(FileWritableBlob.java:115)
	at com.orchestral.rhapsody.blobstore.file.rolling.RollingFileWritableBlob.write(RollingFileWritableBlob.java:51)
	at com.orchestral.rhapsody.message.internal.MessageImpl.persist(MessageImpl.java:380)
	at com.orchestral.rhapsody.execution.communicationpoint.spi.ConnectionExecutorStrategy$2.execute(ConnectionExecutorStrategy.java:52)
	at com.orchestral.rhapsody.execution.communicationpoint.spi.ConnectionExecutor.run(ConnectionExecutor.java:110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
	at java.lang.Thread.run(Thread.java:595)

REPRODUCIBILITY :
This bug can be reproduced occasionally.

Comments
EVALUATION Good find! Will fix early in jdk7.
12-12-2006