Frequently encountered java.lang.OutOfMemoryError:unable to create new native thread workaround

Source: Internet
Author: User

Simply share the solution to a similar problem

just in on a machine on XXX The user encountered this problem when the pressure measurement, even XXX They're not going to get in.

Description XXX The user cannot create a thread with multiple threads (of course Root user does not have this problem)

Maximum number of threads the system can create: (maxprocessmemory-jvmmemory– system memory )/(threadstacksize) = number of threads

There are two ways of doing this:

reduce the threadstacksize under XXX

Increase the number of nproc under XXX

Modify

[[Email protected]]$ ulimit-a

Core FileSize (blocks,-c) 0

Data Segsize (Kbytes,-D) Unlimited

Schedulingpriority (-e) 0

FileSize (blocks,-f) Unlimited

Pendingsignals (-i) 256636

Max Lockedmemory (Kbytes, L) 64

Max Memorysize (Kbytes,-m) unlimited

Openfiles (-N) 65536

Pipesize (512bytes,-P) 8

POSIX messagequeues (bytes,-Q) 819200

Real-timepriority (-R) 0

stacksize (Kbytes,-s) 10240----- can reduce this, it is recommended to JVM–XSS Reduction in

CPUTime (seconds,-t) unlimited

Max Userprocesses (-u) 1024x768----- can increase this to 32000

Virtualmemory (Kbytes,-V) Unlimited

Filelocks (-X) Unlimited

Modify/etc/security/limits.conf

* Soft Nofile 65536
* Hard Nofile 65536
XXX Soft Nproc 32000
XXX Hard Nproc 32000
XXX Soft Stack 1024
XXX Hard Stack 1024

Frequently encountered java.lang.OutOfMemoryError:unable to create new native thread resolution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.