32-bit Firebird attempting to create large amount of thread on 64-bit server
We ran into an issue with 32-bit FB 2.5 Final Release on 64-bit machine.
When the problem occurs, task manager shows fbserver.exe process creates
500~800 threads. Firebird.log will have a chunk of messages saying:
XXXX (Server) Fri Jan 21 18:13:28 2011
Operating system call _beginthreadex failed. Error code 8
Oftentimes this is followed by a fbserver crash where fbserver.exe is hung
and consumes 0% CPU. Sometimes this message can be found in the
XXXX (Server) Thu Jan 21 12:15:20 2010
unable to allocate memory from operating system
in spite that the task manager doesn't indicate any memory shortage.
We simplified the test case to a command-line, test program with
multi-threads and each running a single query. With this tool we tested
against servers running various OS and FB versions, added number of test
tool threads and kept close watch on number of thread fbserver.exe uses. (In
all tests mentioned, the page buffer of the test DB is 65535, firebird was
running in super server mode and test programs have about 300 threads in
total.) The test results are as follows:
1. Windows server 2008 R2 (64-bit), Firebird 2.1, 8G RAM
No crash. maximum number of thread fbserver.exe takes is 362.
2. Windows server 2008 R2 (64-bit), Firebird 2.5 32-bit, 8G RAM
Crashed in 10 min. Maximum number of thread fbserver.exe takes is over
3.Windows server 2008 R2 (64-bit), Firebird 2.5 64-bit, 8G RAM
No crash. Maximum number of thread fbserver.exe takes is 820.
4. Windows server 2003(32-bit) SP1, Firebird 2.5 32-bit, 2G RAM
No crash. Maximum number of thread fbserver.exe takes is 407.
5. Windows server 2003(64-bit) SP1, Firebird, 4G RAM
Crashed. Maximum number of thread observed is 471.
It appears that the crash always occur when FB2.5 32-bit is running on
64-bit OS. Also we observed that on 64-bit system, FB2.5 32-bit was trying
to create a lot more thread than FB2.1 did in the same situation, which we
suspect exceeded the limit of thread numbers of the OS and caused the
shortage of memory or other system resources. We notice that it is much more
likely to crash when 32-bit fbserver.exe has more than 500 threads.
Has any one experienced this issue? Any ideas on this problem?
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel