Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-core-dev] Problem cancelling a launch

Windows NT does not appear to be a supported platform for Eclipse, at 
least not officially. I don't see why the CDT would need to support it, or 
worse, why we would shouldn't fix the rest of the Windows platforms just 
to maintain compatibility with NT.

BTW, I was able to properly kill builds in NT in a previous life. I'll 
have to see if how I did it.

Doug Schaefer, IBM's Eclipse CDT Architect
Ottawa (Palladium), Ontario, Canada



Alex Chapiro <achapiro@xxxxxxx> 
Sent by: cdt-core-dev-admin@xxxxxxxxxxx
07/23/2004 02:26 PM
Please respond to
cdt-core-dev


To
cdt-core-dev@xxxxxxxxxxx
cc

Subject
Re: [cdt-core-dev] Problem cancelling a launch






Yes, I know about that. It is much better because TerminatePocess 
doesn't terminate child processes. I just cannot use it because we still 
support Windows NT.

Treggiari, Leo wrote:

>There are issues with killing child processes on Windows.  I have used
>a Job Object on Windows 2000 & XP - they are not implemented on NT 4.0.
>The Job Object allows you to kill the process that you spawn,
>along with all of its children.  For a discussion of the problem in
>killing a process and its children, see Microsoft System Journal June
>1998, "Q & A, Win32".
>
>Leo
>
>-----Original Message-----
>From: cdt-core-dev-admin@xxxxxxxxxxx
>[mailto:cdt-core-dev-admin@xxxxxxxxxxx] On Behalf Of Alex Chapiro
>Sent: Friday, July 23, 2004 1:52 PM
>To: cdt-core-dev@xxxxxxxxxxx
>Subject: Re: [cdt-core-dev] Problem cancelling a launch
>
>Actually it definetly sends CTRL-C as you can see it in gdb case. I just
>
>guess, that second level child process does not get it. I'll test it.
>
>James Langley wrote:
>
> 
>
>>I can cancel a make, but not during linking.  I suspect that this is a
>>related problem.  It's less noticeable with make because the other
>>processes that are launched generally don't live very long and so the
>>cancel seems very responsive.  If I cancel when the linker is running
>>(probably the longest single task) then the cancel only takes effect
>>once the linker has terminated.  In the download case, the download can
>>be quite a significant length of time (up to several minutes) so not
>>being able to cancel is pretty unpleasant.
>>
>>As a side note, I've just tried an experiment with the script where I
>>write a text file in the trap handler.  When I run that from the
>> 
>>
>command
> 
>
>>line and use CTRL-C I get a file for trap 0 and trap 2, which is what I
>>would expect.  When I do the same thing from eclipse and hit cancel, I
>>don't get any files at all, which suggests that the CTRL-C code isn't
>>working in the spawner.  I'll do some more investigation...
>>
>>James
>>
>> 
>>
>> 
>>
>>>-----Original Message-----
>>>From: cdt-core-dev-admin@xxxxxxxxxxx [mailto:cdt-core-dev-
>>>admin@xxxxxxxxxxx] On Behalf Of Alex Chapiro
>>>Sent: 23 July 2004 17:46
>>>To: cdt-core-dev@xxxxxxxxxxx
>>>Subject: Re: [cdt-core-dev] Problem cancelling a launch
>>>
>>>BTW, are you able to cancel make? Builder should use the same
>>> 
>>>
>>> 
>>>
>>mechanism.
>> 
>>
>> 
>>
>>>It is strange for me that nobody complains about build cancellation.
>>>
>>>James Langley wrote:
>>>
>>> 
>>>
>>> 
>>>
>>>>I've tried using Runtime.exec() to do the same thing and that means
>>>> 
>>>>
>>>> 
>>>>
>>that
>> 
>>
>> 
>>
>>>>I can cancel successfully, but I don't think that a CTRL-C gets sent
>>>> 
>>>>
>>>> 
>>>>
>>to
>> 
>>
>> 
>>
>>>>the shell and so there's no opportunity to handle any cleanup.  I'd
>>>> 
>>>>
>>>> 
>>>>
>>like
>> 
>>
>> 
>>
>>>>to use the ProcessFactory approach if possible as I believe that
>>>> 
>>>>
>>>> 
>>>>
>>CTRL-C
>> 
>>
>> 
>>
>>>>is the whole reason that the ProcessFactory approach exists.
>>>>
>>>>Do you use the trap command in your scripts, because if I use the
>>>> 
>>>>
>>>> 
>>>>
>>trap
>> 
>>
>> 
>>
>>>>command to exit and make sure to run any processes in the background
>>>> 
>>>>
>>>> 
>>>>
>>in
>> 
>>
>> 
>>
>>>>the script and then wait for them to finish I can kill the script
>>>>successfully at the command prompt.  If I don't do that, then even a
>>>>CTRL-C at the command prompt doesn't kill the child process.
>>>>
>>>>James
>>>>
>>>>-----Original Message-----
>>>>From: cdt-core-dev-admin@xxxxxxxxxxx
>>>>[mailto:cdt-core-dev-admin@xxxxxxxxxxx] On Behalf Of Lott, Jeremiah
>>>>Sent: 23 July 2004 16:21
>>>>To: cdt-core-dev@xxxxxxxxxxx
>>>>Subject: RE: [cdt-core-dev] Problem cancelling a launch
>>>>
>>>>We had similar problem using ProcessFactory in CDT 1.2.0.  We started
>>>>using Runtime.exec(...) in all cases where we didn't explicitly need
>>>> 
>>>>
>>>> 
>>>>
>>the
>> 
>>
>> 
>>
>>>>extra features provided by ProcessFactory and started getting better
>>>>results.  However, we will still sometimes get the behavior that the
>>>>parent process dies and the UI control returns to the user, but the
>>>>child process continues to run in the background.  These problems
>>>> 
>>>>
>>>> 
>>>>
>>seem
>> 
>>
>> 
>>
>>>>to happen much more on windows (with Cygwin) than on Linux.
>>>>
>>>>Jeremiah Lott
>>>>TimeSys Corporation
>>>>-----Original Message-----
>>>>From: James Langley [mailto:jlangley@xxxxxxxxxx]
>>>>Sent: Friday, July 23, 2004 10:57 AM
>>>>To: cdt-core-dev@xxxxxxxxxxx
>>>>Subject: [cdt-core-dev] Problem cancelling a launch
>>>>Hi,
>>>>
>>>>I'm having some problems with process termination under CDT that I
>>>> 
>>>>
>>>> 
>>>>
>>hope
>> 
>>
>> 
>>
>>>>someone can help with.  This might be a candidate for a bugzilla, but
>>>> 
>>>>
>>>> 
>>>>
>>I
>> 
>>
>> 
>>
>>>>thought I'd ask here first.
>>>>
>>>>As part of our launch process for a remote hardware target, we need
>>>> 
>>>>
>>>> 
>>>>
>>to
>> 
>>
>> 
>>
>>>>download the elf file to the board.  This is accomplished by a shell
>>>>script which does some processing and then launches an executable to
>>>>download to the board.  So we have a step in our launch which runs
>>>> 
>>>>
>>>> 
>>>>
>>the
>> 
>>
>> 
>>
>>>>download script.  If the elf file is large, the download can take
>>>> 
>>>>
>>>> 
>>>>
>>some
>> 
>>
>> 
>>
>>>>time, so it would be nice to be able to cancel the process.  Here's a
>>>>snippet of code from the launch configuration delegate which should
>>>>allow for cancelling:
>>>>
>>>>Process process = exec(runCommandArray,
>>>> 
>>>>
>>>> 
>>>>
>>getEnvironmentProperty(config),
>> 
>>
>> 
>>
>>>>currentWorkingDir);
>>>>IProcess downloadProcess = DebugPlugin.newProcess(launch, process,
>>>>renderProcessLabel(getRunLabel()));
>>>>
>>>>int total_work = 0;
>>>>
>>>>while (!downloadProcess.isTerminated())
>>>>{
>>>>   if (monitor.isCanceled())
>>>>   {
>>>>         if (downloadProcess.canTerminate())
>>>>               downloadProcess.terminate();
>>>>         return false;
>>>>   }
>>>>   if (total_work <= 90)
>>>>         monitor.worked(10);
>>>>   try
>>>>   {
>>>>         Thread.sleep(1000);
>>>>   }
>>>>   catch (InterruptedException e)
>>>>   {}
>>>>}
>>>>
>>>>The runCommandArray consists of the path for sh, then the name of the
>>>>script and then the arguments for the script.  The exec command ends
>>>> 
>>>>
>>>> 
>>>>
>>up
>> 
>>
>> 
>>
>>>>running the following line of code:
>>>>
>>>>ProcessFactory.getFactory().exec(cmdLine, envp, workingDirectory);
>>>>
>>>>When the script is run from the command line, it can be cancelled
>>>>successfully and it cleans up its child processes.  However, when run
>>>> 
>>>>
>>>> 
>>>>
>>>>from eclipse, the call to terminate() hangs until the download
>>> 
>>>
>>> 
>>>
>>program
>> 
>>
>> 
>>
>>>>(which was launched by the script) has finished.  From debugging, it
>>>>looks as though the culprit is the call to:
>>>>
>>>>((SpawnerInputStream)getErrorStream()).close();
>>>>
>>>>in the destroy method of the Spawner.
>>>>
>>>>Sorry for the lengthy description of the problem, but is there some
>>>> 
>>>>
>>>> 
>>>>
>>part
>> 
>>
>> 
>>
>>>>of the cancel process that I'm missing, or is there some kind of
>>>> 
>>>>
>>>> 
>>>>
>>problem
>> 
>>
>> 
>>
>>>>with the Spawner that means that it doesn't terminate processes
>>>>properly?  I'm running on Windows XP and the problem seems to exist
>>>> 
>>>>
>>>> 
>>>>
>>in
>> 
>>
>> 
>>
>>>>CDT 1.2.1 and 2.0.  If a bugzilla would be more appropriate than a
>>>>discussion in this mailing list, feel free to let me know and I'll
>>>>submit the problem there.
>>>>
>>>>Thanks in advance,
>>>>
>>>>
>>>>James Langley
>>>>Senior Software Engineer
>>>>Altera European Technology Centre
>>>>Holmers Farm Way
>>>>High Wycombe
>>>>Bucks HP12 4XF
>>>>United Kingdon
>>>>http://www.altera.com <http://www.altera.com>
>>>> 
>>>>
>>>> 
>>>>
>><http://www.altera.com>
>> 
>>
>> 
>>
>>>>.
>>>>
>>>>
>>>>
>>>> 
>>>>
>>>> 
>>>>
>>>_______________________________________________
>>>cdt-core-dev mailing list
>>>cdt-core-dev@xxxxxxxxxxx
>>>http://dev.eclipse.org/mailman/listinfo/cdt-core-dev
>>> 
>>>
>>> 
>>>
>>_______________________________________________
>>cdt-core-dev mailing list
>>cdt-core-dev@xxxxxxxxxxx
>>http://dev.eclipse.org/mailman/listinfo/cdt-core-dev
>>
>> 
>>
>> 
>>
>_______________________________________________
>cdt-core-dev mailing list
>cdt-core-dev@xxxxxxxxxxx
>http://dev.eclipse.org/mailman/listinfo/cdt-core-dev
>
>_______________________________________________
>cdt-core-dev mailing list
>cdt-core-dev@xxxxxxxxxxx
>http://dev.eclipse.org/mailman/listinfo/cdt-core-dev
>
> 
>
_______________________________________________
cdt-core-dev mailing list
cdt-core-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/cdt-core-dev




Back to the top