Bug 18321 - HP readme: VM option -XdoCloseWithReadPending; Eclipse does not exit after launching Help
Summary: HP readme: VM option -XdoCloseWithReadPending; Eclipse does not exit after la...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Releng (show other bugs)
Version: 2.0   Edit
Hardware: Other HP-UX
: P3 normal (vote)
Target Milestone: 2.0 F3   Edit
Assignee: Dean Roberts CLA
QA Contact:
URL:
Whiteboard:
Keywords: readme
Depends on:
Blocks:
 
Reported: 2002-05-30 10:54 EDT by Konrad Kolosowski CLA
Modified: 2004-06-22 17:38 EDT (History)
3 users (show)

See Also:


Attachments
debugger view (30.24 KB, image/gif)
2002-06-05 17:37 EDT, Konrad Kolosowski CLA
no flags Details
patch.txt (2.79 KB, text/plain)
2003-03-21 15:16 EST, Konrad Kolosowski CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Konrad Kolosowski CLA 2002-05-30 10:54:31 EDT
On HP exiting Eclipse session during which help was launched, never returns to 
the command prompt, UI shuts down, but the VM does not exit.

When browser adapter is removed, such that launching help does not open a 
browser the problem still exist.
Comment 1 Konrad Kolosowski CLA 2002-05-30 19:49:05 EDT
The problem is probably Tomcat no closing completely.
I tried to debug but the Eclipse debugger does not work on HP.  I get the 
following error while launching second Eclipse with debugger:

An exception occured while launching
Reason
  jdwp gethostbyname() for [localhost] set error to [1]
  Socket transport failed to init.
  Transport dt_socket failed to initialize, rc = -1.

It points into some wider problem on HP OS or on the machine.  Both debugger 
and tomcat server need network and socket for thier operation.
Comment 2 Konrad Kolosowski CLA 2002-06-05 17:36:40 EDT
I got our HP machine fixed to resolve the local host, so I could debug the 
problem.
What is happening is that the main thread is blocked then doing 
java.net.PlainSockeImpl.socketClose() native method call.
See the screen shot of the stack.
Comment 3 Konrad Kolosowski CLA 2002-06-05 17:37:33 EDT
Created attachment 1280 [details]
debugger view
Comment 4 Konrad Kolosowski CLA 2002-06-05 17:48:25 EDT
Some VMs using native threads used to have a bug that thread doing 
ServerSocket.close() if another thread is doing ServerSocket.accept().
The HP VM has this problem.  I used version 1.3.1.02.

This is the case here.  To confirm I hit refresh in Netscape after closing the 
Workbench.  This allowed the accept() method to proceed, and in turn unblocked 
the close(), and Eclipse exited.

Reading relase notes of vm on HP at 
http://www.hp.com/products1/unix/java/java2/sdkrte1_3/infolibrary/sdk_rnotes_1-
3-1-02.html#Closing%20a%20Socket%20When%20Accept%20or%20Read%20is%20Pending
reveals that there is a VM option that will cause the close not to block.  The 
option is -XdoCloseWithReadPending
I tested, and it allows Eclipse to exit after launching help.

So the fix is to pass this option to VM when launching eclipse.  For example, I 
used the following to start Eclipse:
./eclipse -vm /opt/java1.3/jre/bin/java -vmargs XdoCloseWithReadPending
Comment 5 Konrad Kolosowski CLA 2002-06-05 17:49:42 EDT
Sorry, the launching line is (inlcludes "-" before the switch):
./eclipse -vm /opt/java1.3/jre/bin/java -vmargs -XdoCloseWithReadPending
Comment 6 Mike Wilson CLA 2002-06-06 09:46:23 EDT
We've been burned lately by adding VM arguments for particular VMs to 
eclipse.exe (the "J9 vmargs changing" bug). Every time we do this, it 
potentially forces a dependency between us and a particular VM version, since 
the next version of the VM may have different arguments.

If we really do decide to make eclipse specify the argument, then I need to 
know about it immediately. ugh!
Comment 7 Konrad Kolosowski CLA 2002-06-10 12:28:17 EDT
A decision was made to write readme about the need for the extra command line 
argument on HP-UX. Anyone building a product on HP-UX can add the extra arg 
into their own launcher, and that way we do not build dependencies on any one 
particular VM into the generic launcher.

Can you add paragraph about need to pass -XdoCloseWithReadPending VM option on 
HP-UX.
Thanks.
Comment 8 Dean Roberts CLA 2002-06-11 08:41:28 EDT
I will physically add the paragraph but I need somebody to write the words 
please.
Comment 9 Konrad Kolosowski CLA 2002-06-11 14:58:27 EDT
Dean, here is the paragraph with the title:

Eclipse process does not exit when running on HP-UX.

On HP-UX, the JVM process that runs the Eclipse Workbench does not terminate 
upon closing the workbench. This can be fixed by passing the -
XdoCloseWithReadPending VM option to the Eclipse launcher. For example, you 
could launch eclipse as follows: "eclipse -vmargs -XdoCloseWithReadPending".
Comment 10 Dean Roberts CLA 2002-06-11 15:48:27 EDT
This has been added to the clickthrough for HPUX.  It should appear in the next 
build.
Comment 11 Jim des Rivieres CLA 2002-06-27 20:54:35 EDT
Verified as included in 20020627 (GM6) build.
Comment 12 Konrad Kolosowski CLA 2003-03-21 15:16:51 EST
Created attachment 4301 [details]
patch.txt

It is possible to unblock closing Tomcat server when Eclipse is run without
-XdoCloseWithReadPending option by creating a connection to the server after a
ServerSocket.close() has been called.  It unblocks ServerSocket.accept(),
eliminates deadlock between ServerSocket.accept() and ServerSocket.close(),
thus the main thread is allowed to continue and exit Eclipse.

The attached patch creates a thread before trying to shutdown Tomcat, the
thread connects to Tomcat periodicaly until it closes and the main thread can
continue.  The patch also fixes Eclipse not exiting on windows when users have
SINE version 3 installed (that modifies TCP/IP behavior on Windows).

I think it is worth incorporating the patch into Tomcat code after 2.1 release.
 If other teams have not started depending on the -XdoCloseWithReadPending
option then it would be possible to not require this option when Eclipse is
launched on HPUX.  If other teams do require the option, may be they could
incorporate a fix similar to fix to org.eclipse.tomcat plug-in in this patch.
Comment 13 Konrad Kolosowski CLA 2004-06-22 17:38:38 EDT
Opened bug 68248 to keep track that the problem needs a fix in the code, (not 
jut the readme).