Linux: Resource temporarily unavailable error Solution

Source: Internet
Author: User

An error occurs when a large number of threads (2026 threads) are started using jrockit today:
 
Java code
Error starting thread: Resource temporarily unavailable
 
After in-depth queries, problems such as memory and handle count are eliminated, and it is no problem to switch to the root user to open a large number of threads. Try to adjust the ulimit parameters, and finally find that there is a problem with the "max user processes" parameter. by adjusting the size of the root user to 12000, the number of threads also increases.
 
 
Java code
Root @ blog:/home/badqiu # ulimit-
Core file size (blocks,-c) 0
Data seg size (kbytes,-d) unlimited
Scheduling priority (-e) 0
File size (blocks,-f) unlimited
Pending signals (-I) 143360
Max locked memory (kbytes,-l) 32
Max memory size (kbytes,-m) unlimited
Open File (-n) 2048
Pipe size (512 bytes,-p) 8
POSIX message queues (bytes,-q) 819200
Real-time priority (-r) 0
Stack size (kbytes,-s) 8192
Cpu time (seconds,-t) unlimited
Max user processes (-u) 2046
Virtual memory (kbytes,-v) unlimited
File locks (-x) unlimited
 
Takes effect in linux.
Vi/etc/security/limits. conf
 
Java code
* Soft nproc 12000
* Hard nproc 12000
Nproc is "max user processes", the complete description is: nproc-max number of processes
 
Parameter description:
 
The number of threads that a single user can start. Because a process also starts a thread, the number of processes is indirectly limited.
 
Note:
 
This parameter is only useful to common users, and root users are not limited here. Therefore, the root user can start tens of thousands of threads and cannot reproduce this problem.

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.