Monday, March 19, 2018

Jboss / Wildfly errors when accepting socket Bad file descriptor problem

Jboss/Wildfly random crashes under heavy load:


Jboss/Wildfly crashes randomly with Bad file descriptor. Undertow HTTp server does not restart but admin console and everything else is working and nothing in log files.

How to debug it:

Put this in your configuration file (standalone.xml for Wildfly)
        <logger category="org.xnio.nio">
        <level name="DEBUG"/>
The error:
2018-03-03 17:19:15,273 DEBUG [org.xnio.nio.tcp.server] (default Accept) Exception accepting request, closing server channel TCP server (NIO) <69a407dd>: Bad file descriptor
    at Method)
    at org.xnio.nio.QueuedNioTcpServer.handleReady(
    at org.xnio.nio.QueuedNioTcpServerHandle.handleReady(

What is the reason for that:

The reason is that you are probably running a BSD and the bug is in Java implementation of in latest OpenJDK for BSD (openjdk-1.8.162 at the moment). This was tested on NetBSD 7.1.


There is no solution at the moment. You need to move your Jboss/Wildfly to Linux. You can try changing default selector with java command line arguments (example is solution for Solaris):

java .......

At the moment the only solution to this is not to run it under BSD. Under Linux with EPollSelectorProvider everything works just fine.