Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 165948

Summary: Launching a process fails
Product: z_Archived Reporter: Michael Spivak-Baranov <Michael.Spivak.Baranov>
Component: TPTPAssignee: Igor Alelekov <igor.alelekov>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P1 CC: guru.nagarajan, karla.callaghan
Version: unspecifiedKeywords: plan
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard: closed460
Attachments:
Description Flags
first-pause_exit-yes_output-yes_servicelog.log
none
no-pause_exit-no_output-no_servicelog.log
none
second-pause_exit-yes_output-no_servicelog.log
none
two-pauses_exit-yes_output-yes_servicelog.log
none
test3_two-pauses_events-no_servicelog.log
none
serviceconfig.xml
none
batch file
none
Client test application
none
The patch fixes losing of console data and losing of processExited event for short launched processes
none
regenerated patch
none
additional patch none

Description Michael Spivak-Baranov CLA 2006-11-27 12:56:12 EST
If I launch the process with the following lines of code, I get the message "No such file or directory" on console just before the output of the ls command appears (I set a DataProcessor for the console).
process.setLocation(".");
process.setExecutable("/bin/ls");
process.setParameter(".");

My platform for the AC: Red Hat Enterprise Linux ES release 3 (Taroon Update 6)
My platform for the client in Java: Windows XP, Java Sun 1.4.2_13
Comment 1 Karla Callaghan CLA 2006-12-06 14:18:24 EST
Michael - Please turn on debug logging, then repeat this error and attach the resulting servicelog.log (located in the config directory) to this bugzilla.

You turn on debug logging by editting the file config/serviceconfig.xml, change the "Logging" tag entry: format="Simple" level="DEBUG".

The log file will show the actual pathname for the executable that the process controller is trying to launch.
Comment 2 Michael Spivak-Baranov CLA 2006-12-07 11:23:45 EST
Created attachment 55240 [details]
first-pause_exit-yes_output-yes_servicelog.log
Comment 3 Michael Spivak-Baranov CLA 2006-12-07 11:24:41 EST
Created attachment 55241 [details]
no-pause_exit-no_output-no_servicelog.log
Comment 4 Michael Spivak-Baranov CLA 2006-12-07 11:25:24 EST
Created attachment 55242 [details]
second-pause_exit-yes_output-no_servicelog.log
Comment 5 Michael Spivak-Baranov CLA 2006-12-07 11:26:10 EST
Created attachment 55243 [details]
two-pauses_exit-yes_output-yes_servicelog.log
Comment 6 Michael Spivak-Baranov CLA 2006-12-07 11:26:59 EST
Created attachment 55244 [details]
test3_two-pauses_events-no_servicelog.log
Comment 7 Michael Spivak-Baranov CLA 2006-12-07 11:27:59 EST
Created attachment 55245 [details]
serviceconfig.xml
Comment 8 Michael Spivak-Baranov CLA 2006-12-07 11:28:37 EST
Created attachment 55246 [details]
batch file
Comment 9 Michael Spivak-Baranov CLA 2006-12-07 11:29:31 EST
Created attachment 55247 [details]
Client test application
Comment 10 Michael Spivak-Baranov CLA 2006-12-07 11:30:42 EST
Additional information.

I launched the batch file 1.bat inserting “pause” command before “dir”, after it, and both before and after it. I did it to delay execution of the “dir” command and delay exiting the process. The client sends strings to the console after the process is launched. It makes the batch file continue working.
Please look at the client test application. The appropriate code is in the method “Test2()”
So, I carried out four experiments:
1. No “pause” commands are in the batch file. So, it looks as

dir d:\temp

I did not get “process exited” event, and no output reached the client DataProcessor.
The log file is “no-pause_exit-no_output-no_servicelog.log”

2. The batch file is
pause
dir d:\temp

Everything was ok. I got “process exited” event and all the output of the process.
The log file is “first-pause_exit-yes_output-yes_servicelog.log”

3. The batch file is
dir d:\temp
pause

I got “process exited” event, but no output reached the client DataProcessor.
The log file is “second-pause_exit-yes_output-no_servicelog.log”

4. The batch file is
pause
dir d:\temp
pause

Everything was ok. I got “process exited” event and all the output of the process.
The log file is “two-pauses_exit-yes_output-yes_servicelog.log”

Then I tried to get an event using addEventListener method of IProcess interface. The appropriate code is in the method “Test3()”
I did not get any event.
The log file is “test3_two-pauses_events-no_servicelog.log”

I attached all these log files, serviceconfig.xml, 1.bat, and the sources of the client test application.
Comment 11 Karla Callaghan CLA 2006-12-13 16:59:03 EST
Assigning to Igor, and targetting 4.4
Comment 12 Igor Alelekov CLA 2007-01-29 12:56:35 EST
Bug 166831 is a duplicate of this bug.
Comment 13 Igor Alelekov CLA 2007-01-29 13:01:06 EST
Created attachment 57719 [details]
The patch fixes losing of console data and losing of processExited event for short launched processes

1. Race condition arises with short processes launching. As a result, console data could arrive and be lost before launched process is registered.

2. When a short process is launched and terminated, corresponding commands (processStarted and processExited) could arrive in one message, but in this case command processor loses one command.

The patch fixes these issues and also implements enhancement request #167208
Comment 14 Igor Alelekov CLA 2007-02-01 09:15:16 EST
Guru, the patch fixes issues in the execution framework.
Please review the patch.
Comment 15 Guru Nagarajan CLA 2007-02-02 14:19:11 EST
Igor - can you regenerate the patch and upload it.
Comment 16 Igor Alelekov CLA 2007-02-05 03:42:15 EST
Created attachment 58241 [details]
regenerated patch
Comment 17 Igor Alelekov CLA 2007-02-05 03:47:07 EST
Guru, I uploaded the regenerated patch.
Comment 18 Guru Nagarajan CLA 2007-02-09 19:02:58 EST
Patch applied and verified
Comment 19 Igor Alelekov CLA 2007-02-14 07:20:09 EST
*** Bug 166831 has been marked as a duplicate of this bug. ***
Comment 20 Igor Alelekov CLA 2007-02-14 07:53:04 EST
Created attachment 58962 [details]
additional patch

To prevent possible deadlock it is better to move notification of process listeners in another thread.
Comment 21 Karla Callaghan CLA 2007-02-14 12:53:54 EST
Igor - if you think the original fix is incomplete, then please re-open this bug.  If this is a side issue, open a new bug.
Comment 22 Igor Alelekov CLA 2007-02-15 02:05:41 EST
Guru, please review the additional patch which completes the fix.
Comment 23 Guru Nagarajan CLA 2007-02-15 02:20:07 EST
I will do so after this iteration is complete. Meanwhile the earlier patch applied caused a regression in the TI client. So I had to modify some of the code. Will add details 
Comment 24 Igor Alelekov CLA 2007-02-15 02:23:54 EST
The additional patch fixes the problem with the TI client. I've tested this yesterday.
Comment 25 Guru Nagarajan CLA 2007-02-16 13:28:08 EST
The last patch does resolve the issue. 
Comment 26 Paul Slauenwhite CLA 2009-06-30 12:05:01 EDT
As of TPTP 4.6.0, TPTP is in maintenance mode and focusing on improving quality by resolving relevant enhancements/defects and increasing test coverage through test creation, automation, Build Verification Tests (BVTs), and expanded run-time execution. As part of the TPTP Bugzilla housecleaning process (see http://wiki.eclipse.org/Bugzilla_Housecleaning_Processes), this enhancement/defect is verified/closed by the Project Lead since this enhancement/defect has been resolved and unverified for more than 1 year and considered to be fixed. If this enhancement/defect is still unresolved and reproducible in the latest TPTP release (http://www.eclipse.org/tptp/home/downloads/), please re-open.