Skip to content

Instantly share code, notes, and snippets.

@ivanenok
Created August 24, 2015 10:09
Show Gist options
  • Save ivanenok/ceb7a88cb314018fd83c to your computer and use it in GitHub Desktop.
Save ivanenok/ceb7a88cb314018fd83c to your computer and use it in GitHub Desktop.
Looks like problem with leak on file descriptors in EPollSelectorImpl constructor.
http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8u40-b25/sun/nio/ch/EPollSelectorImpl.java
We can catch problem if a pipe was created but EPollArrayWrapper initialization failed.
This problems may happenes if descriptors count near limit.
EPollSelectorImpl(SelectorProvider sp) throws IOException {
super(sp);
long pipeFds = IOUtil.makePipe(false);
fd0 = (int) (pipeFds >>> 32);
fd1 = (int) pipeFds;
pollWrapper = new EPollArrayWrapper();
pollWrapper.initInterrupt(fd0, fd1);
fdToKey = new HashMap<>();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment