When a client application establishes a session with a Neo4j server via the bolt or bolt+routing protocols, the server allocates a thread to serve as the server-side bolt worker to handle that connection. There is no server-side limitation on the number of bolt worker threads that the Neo4j server will spawn, so it is possible for the JVM to run out of native threads. The exact number depends on server hardware specifications, but is likely in the thousands.
If you find an exception of the type
java.lang.OutOfMemoryError: unable to create new native thread in the debug.log or neo4j.log on the
Neo4j server, this is almost certainly a result of clients not properly closing sessions within your application code.
The remedy for this is to examine your application code for anywhere that you are creating Session objects, and verify that they follow the guidance from the documentation. For example, if you are using the Neo4j Java Driver, use try-with-resources:
Neo4j-Java-Driver GH Project: https://github.com/neo4j/neo4j-java-driver/blob/1.6/examples/src/main/java/org/neo4j/docs/driver/SessionExample.java#L38
Developer Documentation: http://neo4j.com/docs/developer-manual/current/drivers/sessions-transactions/#driver-sessions