Thread: [Cppcms-users] "booster::thread: failed to create a thread" error while running application
Brought to you by:
artyom-beilis
From: Abhishek K. <abh...@gm...> - 2011-08-19 05:28:55
|
Hi, I am facing this error on my linux server which is running CentOS. When I try to run any of the example applications, be it hello_world, message_board, the compilation happens correctly without any errors, but when I try to run the application, example for message board: ./mb -c config.js I get the following error: "booster::thread: failed to create a thread" and the Application doesn't starts. Let me know if anymore information I can provide on it, and this is the only one- line error I get while trying to run the application. Please help. Uptil now, I have been doing all my compilations on windows only, as I expected that compilation won't be difficult on linux box as it is on windows, and now I decided to move on production linux box facing this error. Also let me know if this could be an issue in server configurations. Thanks |
From: Artyom B. <art...@ya...> - 2011-08-19 12:22:53
|
----- Original Message ----- > From: Abhishek Kaushik <abh...@gm...> > To: cpp...@li... > Cc: > Sent: Friday, August 19, 2011 8:28 AM > Subject: [Cppcms-users] "booster::thread: failed to create a thread" error while running application > > Hi, > > > I am facing this error on my linux server which is running CentOS. > > When I try to run any of the example applications, be it hello_world, > message_board, the compilation happens correctly without any errors, > > but when I try to run the application, example for message board: > ./mb -c config.js > > I get the following error: > "booster::thread: failed to create a thread" > > and the Application doesn't starts. > Let me know if anymore information I can provide on it, and this is the only > one- > line error I get while trying to run the application. Hello, This is very strange as it fails to create a new thread which should not happen, is there any chances that you have to few resources or you have a problems with ulimit? Provide an output of ulimit -a Have you changed service.worker_threads and/or service.worker_processes options in configuration files? To what value? To investigate the problem more: Please apply these changes: Index: pthread.cpp =================================================================== --- pthread.cpp (revision 1913) +++ pthread.cpp (working copy) @@ -65,9 +65,10 @@ } else { // failed to create - delete the object + int err = errno; delete ptr; ptr = 0; - throw runtime_error("booster::thread: failed to create a thread"); + throw runtime_error(std::string("booster::thread: failed to create a thread:") + strerror(err)); } } thread::~thread() On the file booster/lib/thread/src/pthread.cpp And try to run and see what is the reason of the error. Also: 1. Please tell me what version of CentOS are you running? (provide also uname -a) 2. Current limits ulimit -a 3. What platform (x86, x86_64, arm, PPC etc). 4. What version of CppCMS do you use? 5. What compiler and what version of compiler do you use. 6. Please run make test and see if tests are pass or fail and what exactly fails (provide a log) 7. Please provide a backtrace of the exception. At the topmost level where you catch the exception: catch(std::exception const &e) { std::cerr<<"Caught exception: "<<e.what()<<std::endl; std::cerr<<booster::trace(e) << std::endl; return 1; } It would print a full stack trace of where the exception had occurred. (You also need to add) #include <booster/backtrace.h> > Please help. > > Uptil now, I have been doing all my compilations on windows only, as I expected > that compilation won't be difficult on linux box as it is on windows, and > now I > decided to move on production linux box facing this error. > Actually Linux is the primary development platform so I'd rather expect the other way, it is much harder to configure/run code on Windows then on Linux. > Also let me know if this could be an issue in server configurations. > Maybe, take a notes on ulimit and other resources. > Thanks > Best, Artyom |
From: Abhishek K. <abh...@gm...> - 2011-08-20 16:45:22
|
Hello Artyom, based on your requirements about my system, I have the following: 1. My cat /proc/version say: Linux version 2.6.32-42.1.BHsmp (ke...@bl...) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-50)) #1 SMP Tue Jun 28 17:06:41 MDT 2011 2. ulimit -a says: core file size (blocks, -c) 0 data seg size (kbytes, -d) 204800 scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 257876 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) 204800 open files (-n) 1024 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) 3600 max user processes (-u) 115 virtual memory (kbytes, -v) 2097152 file locks (-x) unlimited 3.its x86_64 platform 4.cppcms version in 0.99.9 5.I use gcc version 4.1.2 20080704 6.The following tests FAILED: 13 - status_test (Failed) 14 - async_status_test (Failed) 15 - form_test (Failed) 16 - cookie_test (Failed) 17 - internal_forwarder_test (Failed) 18 - forwarder_test (Failed) 19 - jsonrpc_test (Failed) 52 - test_backtrace_backtrace (Failed) Errors while running CTest gmake: *** [test] Error 8 7. I am not able to know the exact location where to place the catch block, would just say: running ./mb -c config.js outputs: booster::thread: failed to create a thread and after applying the patch it now outputs: booster::thread: failed to create a thread:Resource temporarily unavailable. Let me know I could help in this any more, I am able to go good in windows with cppcms, may be some bad configuration on server making this problem :( Best Regards, |
From: Artyom B. <art...@ya...> - 2011-08-20 19:48:02
|
Hello, First of all you have quite tide ulimits. With this options I've played a little with service.worker_threads and with a value above 100 it failed to create threads. 200MB of total memory and 215 max user process (basically threads and so on) By default CppCMS starts 5*#CPUs so if you have some 8 core machine or something like that it would start 40 threads. You may change this options (service.worker_threads) also I'd suggest to play with ulimits and the option I've mentioned and see what exactly makes the problem. See: http://art-blog.no-ip.info/wikipp/en/page/cppcms_1x_config#service.worker_threads >6.The following tests FAILED: > 13 - status_test (Failed) > 14 - async_status_test (Failed) > 15 - form_test (Failed) > 16 - cookie_test (Failed) > 17 - internal_forwarder_test (Failed) > 18 - forwarder_test (Failed) > 19 - jsonrpc_test (Failed) > 52 - test_backtrace_backtrace (Failed) >Errors while running CTest Send the log: Testing/Temporary/LastTest.log, because it is quite starange that these tests failed. Have you disabled some modules? Bottom line: Take a look on the ulimits they seems to be either too tight or somebody did "too good" job in hardening the OS you are working on. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.sf.net/ CppDB - C++ SQL Connectivity: http://cppcms.sf.net/sql/cppdb/ |
From: Abhishek K. <abh...@gm...> - 2011-08-21 07:24:20
|
Hi Artyom, Thanks for detailing regarding the reasons for threads to fail to start, it's helpful for me take betters options. The detailed test log can be found at: http://enabledsoft.com/cppcms/cppcms-0.99.9/Testing/Temporary/LastTest.log I have just disabled ICU. Regards, |
From: Abhishek K. <abh...@gm...> - 2011-08-21 07:42:30
|
Wow!! Hey Artyom, By configuring the worker_thread options, my applications run successfully... first I set it to 1, it started and then 2, it still started then 4, it still started and then 5, it still works. but don't why, it doesn't starts without worker_thread options, this is the case with message board application.. Anyway, Really awesome now, I can proceed with my further work.. Let me know if I can provide you any more infos. Heartfully thankful for your guidance artyom :) Abhishek Kaushik <abhisheklinux@...> writes: |