JDK-6494786 : client VM throws IOException while running Solaris Web Start Wizards SDK car utility
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 6
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris
  • CPU: sparc
  • Submitted: 2006-11-16
  • Updated: 2010-04-02
  • Resolved: 2006-12-04
Related Reports
Duplicate :  
Description
JDK:  	JDK6 solaris-sparc, starts to fail on b47.  The car utility works fine with JDK5u9 client vm.

To Reproduce the bug:
=====================

- login to trigger.sfbay
- cd /export/bug
- java -client car -x -v -f sysid.class
- You'll see the IOException at the end.
Uh oh: java.io.IOException: Bad file number
java.io.IOException: Bad file number	
	at java.io.FileInputStream.readBytes(Native Method)
	at java.io.FileInputStream.read(FileInputStream.java:199)
	at java.util.zip.InflaterInputStream.fill(InflaterInputStream.java:221)
	at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:141)
	at java.io.DataInputStream.readFully(DataInputStream.java:170)
	....

Comments
EVALUATION ###@###.### wrote: > > I took a quick look at the car class and this does appear to be a duplicate of the finalization issue that we have been discussing. In its extractSection and printSection prints it creates a FileInputStream that is based on the a RandomAccessFile's file descriptor. If any of these FileInputStreams are GC'ed then the finalizer will close the file (and subsequent access to archiveFile, or attempts to create a new FileInputStream based on its file descriptor) will fail. I would suggest we close it as a dup. > > this is long standing problem with the java.io.FileInputStream and FileOutputStream classes (issue dates back to the original implementation 10 years ago). We have been discussing a solution for jdk7. If you need to workaround the issue then open the FileInputStream with "filename" rather than archiveFile.getFD. That will open a new file descriptor to the file but it will be closed when the object is finalized. --- ###@###.### wrote: This turns out to be true, it is the finalization bug. I tried it with the fix we were discussing for 6322678 and it seems to run fine without the exception. I will close it as a dup of 6322678.
04-12-2006

EVALUATION The car sources are part of Solaris Web Start (aka Install SDK) master workspace, which can be found at: /net/installzone.eng/export/install/InstallSDK/installsdk-master/tools/src/car.java
21-11-2006

EVALUATION It would speed up our process of working on this bug, if the source code of Car class is provided to us, so that I can reproduce the bug. Also, I cannot get to run the car.class on trigger.sfbay to produce this error, as I get the following exception: Oh oh: java.io.FileNotFoundException: com/sun/wizards/core/ArchiveReader.class (Permission denied) java.io.FileNotFoundException: com/sun/wizards/core/ArchiveReader.class (Permission denied) at java.io.FileOutputStream.open(Native Method) at java.io.FileOutputStream.<init>(FileOutputStream.java:179) at java.io.FileOutputStream.<init>(FileOutputStream.java:131) at car.extractSection(car.java:369) at car.extractSections(car.java:308) at car.main(car.java:550) That's because my user id in the "staff" group and the file is created by the "green" group and the file does not have read-all permission.
20-11-2006

EVALUATION Is it possible to get a pointer to the source to car class? It looks like its extractSelect method constructs a number of FileInputStream objects with the same FileDescriptor object. One of the FileInputStream gets unreferenced and is GC'ed. When its finalizer runs it closes the file which pulls the rug out from under the other FileInputStrems that are in-use.
17-11-2006