开发者

Kill Eclipse background operation without killing Eclipse

开发者 https://www.devze.com 2023-02-22 09:52 出处:网络
Is there any way to kill开发者_JAVA百科 an Eclipse background operation without killing Eclipse itself?

Is there any way to kill开发者_JAVA百科 an Eclipse background operation without killing Eclipse itself?

Specifically, I want to kill stalled Subclipse SVN operations. Clicking 'cancel' pops up a little Cancel Requested message, but the operation still sits there forever blocking everything else.

This is Eclipse Helios on Windows 7 if that makes any difference.


I was able to unstuck Eclipse (it was stuck on a large file diff) using the following steps.

  • Preparations: I always start Eclipse with the eclipse-console: Add start parameter -console in eclipse.ini (first line)
  • The console always remains responsive even when the eclipse UI freezes
  • I found the following commands in the console: help threads
  • List all threads: threads
  • Stop a thread: threads stop THREAD-NAME

UPDATE: I found out, that usually the "main" thread causes the freezing. Thus the solution is:

Type this in the eclipse console:

threads stop main

This will trigger/throw an Exception in that thread, effectively interrupting what it was doing (being stuck).

This might cause other side-effects (depending on what action was interrupted and where), but i had no problems with it so far.


Killing the task from the Progress window (Window->Show View->Other|General->Progress or Alt+Shift+Q, Q | General->Progress).

Then choose the offending thread and click the red square.

Note it sometimes takes a delay before the kill occur, you may also have to kill other thread in there to get what you want. Lastly it does not always work, if this fails I usually just restart eclipse.

Hope this helps


I was able to stop/terminate the hanging SVN commit process by briefly disconnecting the network adapter. This saved me from killing the Eclipse process, which if not terminated gracefully is known to cause other headaches.


If you go to window Progress in Eclipse and click red square to Stop:

Kill Eclipse background operation without killing Eclipse

and next, red square becomes gray square and process i frozen (Cancel Requested):

Kill Eclipse background operation without killing Eclipse

You must use Task Manager (Alt+Ctrl+Del on Windows) for kill process. Go to tab Processes, find process javaw.exe* and click End Process.

The result: frozen process in Eclipse was closed but your Eclipse wasn't closed.

* Process with name javaw.exe is for WildFly server. For Subclipse SVN can be another name of proces.


I'm not sure, but from the Debug perspective, you may be able to view the thread that's performing the background operation and kill it from there for quicker exit.


In console window, open "Open OSGi Console" from drop button. In this console you can type command threads. This will show all running threads. You can kill process with command threads stop '<Process name>'. Remember to use single apostrophe ' surrounding <Process name>, otherwise it won't work.

For example, I had to type:

threads stop 'Worker-12: Refresh DSLD scripts'


I had a problem where the external compiler I was using froze up when I tried to cancel the build operation. It was stuck in the "Cancel Requested" state. I went to the Windows Task Manager and found my compiler process and terminated it. That allowed Eclipse to continue and successfully cancel the operation.


Keep clicking on clean console, it will show the back ground processes, keep killing one by one.


I made this by opening console in eclipse and typing 'threads'. And then 'threads stop thread-name'.


In Lunux you can list all the Eclipse processes

ps -edf | grep eclipse

Then you choose the child process (the backgound doing Java process) of the main process (the Eclipse GUI Java process) of the starting shell process.

Example:

myself   21821  1222  0 09:28 ?    00:00:00 /local/eclipse/jee-2021-06/eclipse
myself   21839 21821  8 09:28 ?    00:24:53 /usr/lib/jvm/java-1.11.0-openjdk-amd64/bin/java -Dosgi.requiredJavaVersion=11 -Dosgi.instance.area.default=@user.home/eclipse-workspace ... much more ...
myself   21965 21839  0 09:29 ?    00:01:48 /usr/lib/jvm/java-11-openjdk-amd64/bin/java -cp /local/eclipse/jee-2021-06/eclipse/../../../../home/myself/.p2/pool/p ... much more ...

The child in the chain of processes is the one with the proc-id 21965. This one you have to kill. Try kill -2 <proc-id> and, if it did not work, kill -9 <procid>

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号