This kind of exception is often misleading as the causex of it can be quite different. The first thing you might try in the checklist is reducing the stack size. The JVM has an interesting implementation, the design of which I don’t completely understand, but the implication is that the more memory is allocated for the heap (not necessarily used by the heap), the less memory available in the stack, and since threads are made from the stack, in practice this means more “memory” in the heap sense (which is usually what people talk about) results in less threads being able to run concurrently. At operating system level, Linux users you can control the amount of resources (and in particular file descriptors) you are going to use in the limits.conf file or usint the ulimit command: # vi /etc/security/limits.conf In either case, if the amount of file descriptors you are allowed to use is less the number of threads you are going to create, then this could be the issue. One more thing you could finally investigate is the number of process per user: ulimit -a the default number of process per users is 1024 by default. So adding the following to your $HOME/.profile could solve the issue: ulimit -u 4096 |
|