[jira] Updated: (GERONIMODEVTOOLS-178) Deadlock! while stopping Geronimo server from within Eclipse

2007-07-27 Thread Shiva Kumar H R (JIRA)

 [ 
https://issues.apache.org/jira/browse/GERONIMODEVTOOLS-178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Shiva Kumar H R updated GERONIMODEVTOOLS-178:
-

Attachment: deadlockFix.patch

 Deadlock! while stopping Geronimo server from within Eclipse
 

 Key: GERONIMODEVTOOLS-178
 URL: 
 https://issues.apache.org/jira/browse/GERONIMODEVTOOLS-178
 Project: Geronimo-Devtools
  Issue Type: Bug
  Components: eclipse-plugin
Affects Versions: 1.2.0, 1.2.1, 2.0
Reporter: Shiva Kumar H R
 Attachments: deadlockFix.patch, TestDeadlock.war


 An interesting deadlock scenario! 
 Here are the steps to reproduce:
 1. From within Eclipse start Geronimo server (say 2.0)
 2. Deploy attached WAR
 3. Access deployed servlet with url http://localhost:8080/TestDeadlock/Test;
 4. From within Eclipse invoke Stop server
 You will see that Stop never returns and Eclipse freezes to respond.
 5. Manually kill server process and Eclipse will resume.
 Here is what is happening:
 1. When user invokes Stop on Geronimo server from within Eclipse, Geronimo 
 Eclipse Plug-in invokes stopKernel() in the main Eclipse thread itself. 
 (org.apache.geronimo.st.core.GeronimoServerBehaviourDelegate.java::stop())
 2. Server receives the shutdown call, and invokes the deployed WAR's 
 servlet.destroy method, which in turn opens a big text file and starts 
 printing the contents to standard output.
 3. All the output buffers overflow because the main thread is the one that 
 should push them to the console view at the end but it is blocked.
 4. All the print operations on the server side are blocked waiting for 
 somebody to read the output buffer. The shutdown call will never return.
 5. The main Eclipse thread will never print the messages because it waits for 
 the shutdown call to return.
 Here is one solution thought of:
 The Geronimo Eclipse plug-in should make the shutdown call in a worker thread 
 not in the main Eclipse thread. In this case the main thread will be able to 
 display all the messages triggered by the shutdown call and everything will 
 work just fine. Attached patch implements this.
 Please see this also:
 http://www.eclipse.org/webtools/wst/api/org/eclipse/wst/server/core/model/ServerBehaviourDelegate.html#stop(boolean)
 It recommends that the plug-in should return from the 
 ServerBehaviourDelegate.stop() method quickly and use the server listener 
 to notify shutdown progress.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.



[jira] Updated: (GERONIMODEVTOOLS-178) Deadlock! while stopping Geronimo server from within Eclipse

2007-07-27 Thread Shiva Kumar H R (JIRA)

 [ 
https://issues.apache.org/jira/browse/GERONIMODEVTOOLS-178?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Shiva Kumar H R updated GERONIMODEVTOOLS-178:
-

Attachment: TestDeadlock.war

 Deadlock! while stopping Geronimo server from within Eclipse
 

 Key: GERONIMODEVTOOLS-178
 URL: 
 https://issues.apache.org/jira/browse/GERONIMODEVTOOLS-178
 Project: Geronimo-Devtools
  Issue Type: Bug
  Components: eclipse-plugin
Affects Versions: 1.2.0, 1.2.1, 2.0
Reporter: Shiva Kumar H R
 Attachments: TestDeadlock.war


 An interesting deadlock scenario! 
 Here are the steps to reproduce:
 1. From within Eclipse start Geronimo server (say 2.0)
 2. Deploy attached WAR
 3. Access deployed servlet with url http://localhost:8080/TestDeadlock/Test;
 4. From within Eclipse invoke Stop server
 You will see that Stop never returns and Eclipse freezes to respond.
 5. Manually kill server process and Eclipse will resume.
 Here is what is happening:
 1. When user invokes Stop on Geronimo server from within Eclipse, Geronimo 
 Eclipse Plug-in invokes stopKernel() in the main Eclipse thread itself. 
 (org.apache.geronimo.st.core.GeronimoServerBehaviourDelegate.java::stop())
 2. Server receives the shutdown call, and invokes the deployed WAR's 
 servlet.destroy method, which in turn opens a big text file and starts 
 printing the contents to standard output.
 3. All the output buffers overflow because the main thread is the one that 
 should push them to the console view at the end but it is blocked.
 4. All the print operations on the server side are blocked waiting for 
 somebody to read the output buffer. The shutdown call will never return.
 5. The main Eclipse thread will never print the messages because it waits for 
 the shutdown call to return.
 Here is one solution thought of:
 The Geronimo Eclipse plug-in should make the shutdown call in a worker thread 
 not in the main Eclipse thread. In this case the main thread will be able to 
 display all the messages triggered by the shutdown call and everything will 
 work just fine. Attached patch implements this.
 Please see this also:
 http://www.eclipse.org/webtools/wst/api/org/eclipse/wst/server/core/model/ServerBehaviourDelegate.html#stop(boolean)
 It recommends that the plug-in should return from the 
 ServerBehaviourDelegate.stop() method quickly and use the server listener 
 to notify shutdown progress.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.