PR# 12838 "Cannot create thread" exception when using process library

Problem Report Summary
Submitter: aleitner
Category: EiffelThreads
Priority: High
Date: 2007/05/23
Class: Bug
Severity: Serious
Number: 12838
Release: 6.0.6.8510 GPL Edition
Confidential: No
Status: Closed
Responsible:
Environment: Mozilla/5.0 (X11; U; Linux i686; en; rv:1.8.1.3) Gecko/20061201 Epiphany/2.18 Firefox/2.0.0.3 (Ubuntu-feisty)
Synopsis: "Cannot create thread" exception when using process library

Description
When using AutoTest I (almost) repeatedly get a "Cannot create thread" exception. This happens during a phase when I do the following in a loop a number of times:

1) Create new process object
2) Start process
3) Read and write from stdin/stdout/stderr from this process
4) Terminate the process
5) Forget the process object

The exception is thrown in step 2) when the process is started. This problem is very important to me, if you need me to reproduce it either on my machine or on another please let me know.

Exception tag:
Code: 18 (External event.) Tag: Cannot create thread

Exception message:
Cannot create thread


Call stack:

ObjectClassRoutine
------------------
[0xB74352F0] PROCESS_INPUT_LISTENER_THREAD create_thread (From THREAD) ( @ 0 )
[0xB74352F0] PROCESS_INPUT_LISTENER_THREAD launch (From THREAD) ( @ 3 )
[0xB74352F4] PROCESS_IMP start_listening_threads ( @ 5 )
[0xB74352F4] PROCESS_IMP initialize_after_launch ( @ 5 )
[0xB74352F4] PROCESS_IMP launch ( @ 16 )
[0xB74352F8] AUT_INTERPRETER_PROXY launch_process_with_retry <R> ( @ 8 )
[0xB74352F8] AUT_INTERPRETER_PROXY start ( @ 4 )
[0xB74352FC] AUT_REQUEST_PLAYER start ( @ 3 )
[0xB7435300] AUTO_TEST execute_task ( @ 2 )
[0xB7435300] AUTO_TEST minimize_witnesses ( @ 23 )
[0xB7435300] AUTO_TEST execute ( @ 31 )

To Reproduce
See description
Problem Report Interactions
From:manus_eiffel    Date:2007/05/24    Status: Closed    Download   
This is fixed in rev#68619.

From:aleitner    Date:2007/05/23    Download   
With the attributes applied the problem seems to be gone. Thanks Manu and Jason for the prompt fix!

From:manus_eiffel    Date:2007/05/23    Status: Analyzed    Download   
The issue is that on Linux to actually finish a thread calling `exit' is not enough, you have to call `native_join' in the parent thread. This is ridiculous and I'm surprised that the new thread implementation on Linux does that. I'm not sure where to report the bug because this is really a major burden, since most thread implementation do not need to be `joined'.


From:aleitner    Date:2007/05/23    Download   
My program specifically "Voids" the process object after terminating the process and recreates it before starting a new process. Is there anything more I can do?

I had Jason have a look at it and he concluded that there is a >50% chance the problem is in EiffelThreads.

Andreas

From:alexk_es    Date:2007/05/23    Download   
Could it be because the implementation does not release associated Process and Thread handles so that they are finally exhausted for the application?