Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are a couple of scenarios where file handles might not be being closed:</p> <ol> <li>There might be some other code that opens files.</li> <li>There might be some other bit of code that calls <code>createChannel(...)</code> and doesn't call <code>fillContactBuffer(...)</code></li> <li><p>If <code>channel.position(0)</code> throws an exception, the channel won't be closed. The fix is to rearrange the code so that the following statements are inside the <code>try</code> block.</p> <pre><code>channel.position(0); return new FileChannelImpl(channel); </code></pre></li> </ol> <p>EDIT: Looking at the stack trace, it seems that the two methods are in different code-bases. I'd point the finger of blame at the <code>createChannel</code> method. It is potentially leaky, even if it is not the source of your problems. It needs an in internal <code>finally</code> clause to make sure that the channel is closed in the event of an exception. </p> <p>Something like this should do the trick. Note that you need to make sure that the <code>finally</code> block does not closes the channel on success!</p> <pre><code>public static com.vlc.edge.FileChannel createChannel(final File file) { final FileChannel channel = null; try { channel = new FileInputStream(file).getChannel(); channel.position(0); FileChannel res = new FileChannelImpl(channel); channel = null; return res; } catch (FileNotFoundException e) { throw new VlcRuntimeException("Failed to open file: " + file, e); } catch (IOException e) { throw new VlcRuntimeException(e); } finally { if (channel != null) { try { channel.close(); } catch (...) { ... } } } } </code></pre> <hr> <p><strong>FOLLOWUP</strong> much later</p> <p>Given that file handle leakage has been eliminated as a possible cause, my next theory would be that the server side is actually interrupting its own threads using <code>Thread.interrupt()</code>. Some low-level I/O calls respond to an interrupt by throwing an exception, and the root exception being thrown here <em>looks</em> like one such exception.</p> <p>This doesn't explain <em>why</em> this is happening, but at a wild guess I'd say that it was the server-side framework trying to resolve an overload or deadlock problem.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload