Error Bad File Descriptor Java
Contents |
here for a quick overview of the site Help
Write Error Bad File Descriptor
Center Detailed answers to any questions you might have socket error bad file descriptor Meta Discuss the workings and policies of this site About Us Learn more about wget error bad file descriptor Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges
Bad File Descriptor Error In C
Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Bad File Descriptor IOException in Java using javax.xml up vote 4 down vote favorite
Python Socket Error Bad File Descriptor
I'm using the standard javax.xml package to parse some XML files on a linux machine. My code is as follows: try { // Prepare parser DocumentBuilder documentBuilder = documentBuilderFactory .newDocumentBuilder(); Document document = documentBuilder.parse(file.getAbsolutePath()); // This is line 397 XPath xPath = xPathFactory.newXPath(); ... } catch(IOException e) { ... } A single DocumentBuilderFactory is accessed by multiple threads, as is a single XPathFactory, I believe this to be acceptable usage. I occasionally see the following error when parsing an XML file using the above code. java.io.IOException: Bad file descriptor at java.io.FileInputStream.readBytes(Native Method) at java.io.FileInputStream.read(FileInputStream.java:229) at java.io.BufferedInputStream.fill(BufferedInputStream.java:229) at java.io.BufferedInputStream.read(BufferedInputStream.java:246) at org.apache.xerces.impl.XMLEntityManager$RewindableInputStream.read(Unknown Source) at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source) at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at javax.xml.parsers.DocumentBuilder.parse(Unknown Source) at mypackage.MyXmlParser.parseFile(MyXmlParser.java:397) at mypackage.MyXmlParser.access$500(MyXmlParser.java:51) at mypackage.MyXmlParser$1.call(MyXmlParser.java:337) at mypackage.MyXmlParser$1.call(MyXmlParser.java:328) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:284) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurren
it was our buggy software to blame, a closer look at the problem seems to point elsewhere. Our current research seems to indicate that a bug in Sun's JDK under Linux (maybe others) is at fault here. Background We have been seeing ls write error bad file descriptor a large number of the 'Bad file descriptor' exceptions in various places around our software. We
Exception In Thread Main Java.io.ioexception Bad File Descriptor
initially thought that we were someone double closing or otherwise improperly using file handles. However, after a more aggressively review of the code java.net.socketexception: bad file descriptor in question as well as the JDK, we came to the conclusion that aside from creating input or output streams using the FileDescriptor constructor (which we were not doing) there should be no way to get these problems. In addition, http://stackoverflow.com/questions/10286233/bad-file-descriptor-ioexception-in-java-using-javax-xml many of the places which were throwing the exceptions (see below) were in 3rd party libraries including Lucene and Berkeley Database JE. Our application is a search system which is using ActiveMQ JMS to receive, index, and store documents. We use 10s of JMS queues and topics to coordinate a distributed collection of search nodes. This translates into 10s of sockets which are mostly TCP but some UDP and multicast packets. Local disk descriptors to standard SCSI disks or http://256stuff.com/gray/docs/misc/java_bad_file_descriptor_close_bug.shtml hardware/software raid configurations. No network filesystems are being used. Mostly EXT3, some XFS, and Some temporary filesystems but otherwise nothing exotic. Possible Solution In November 2007, a guy sent me mail mentioning that they had experiences the same problem with their software. After much work with their Sun support contract, the bug has been fixed. Here's the Sun bug database entry. It states that the fix will be in Java 1.5u14 and 1.6u4. To quote: When a close() operation on an OS file descriptor is succesful, the record of the FD is set to -1, and on subsequent close() operations the actual call to the OS' close() is not performed. If an error occurs in the OS' close(), we do not set our record of the FD to -1, so subsequent calls will re-attempt the close(). We should not re-attempt the close(). As of February 26, 2007, more testing has revealed that our problems seem to be coming from concurrency issues in Sun's 1.5 JDK (through v.11) combined with Lucene v2.0's calling close() in FSIndexInput.finalize() and FSIndexOutput.finalize() methods -- a real no-no. Looks like v2.1 has 2 bug fixes that would resolve this (669 and 750). We think that the problem is a race condition between a user thread which has caused close and the finalizer which is also calling close. The fact that the FileDescriptor has already been closed is not properly synchronized bet
category IBM Redbooks: Building a Sample Website Using IBM Web Content Manager 7.0 IBM Redbooks: Building and bad file Implementing a Social Portal IBM Redbooks: Building and Implementing Social Digital Experiences IBM Redbooks: Developing Exceptional Multi-Channel Web Experiences V7: IBM Web Content Manager bad file descriptor Product Documentation V7: IBM WebSphere Portal Enable for z/OS Product Documentation V7: IBM WebSphere Portal Express Product Documentation V7: WebSphere Portal Product Documentation V8: IBM Web Content Manager Product Documentation V8: IBM WebSphere Portal Express Product Documentation V8: IBM WebSphere Portal Product Documentation (includes z/OS) Custom Search Scope... Search Share ▼ Subscribe ▼ Share ▼ Subscribe ▼ IBM Banking TemplateSelect version 1.0.0 2.0.0 3.0.0 IBM Banking template for WebSphere Portal