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

Bug 345407

Summary: Unhelpful error when a port is already in use.
Product: [Eclipse Project] Equinox Reporter: Michael Glavassevich <mrglavas>
Component: FrameworkAssignee: Lazar Kirchev <l.kirchev>
Status: RESOLVED WONTFIX QA Contact:
Severity: enhancement    
Priority: P3 CC: l.kirchev, tjwatson
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Michael Glavassevich CLA 2011-05-11 08:16:20 EDT
Build Identifier: org.eclipse.osgi_3.7.0.v20110304.jar

When the port the OSGi console wants is already in use, the framework catches the java.net.BindException and prints the stack trace (see below) to the console. This message doesn't tell the user which port isn't available, so they have to guess which one through a process of elimination. It would be more helpful if a message was produced which says exactly which port Equinox couldn't get, instead of printing out this stack trace.

java.net.BindException: Address already in use: JVM_Bind
	at java.net.PlainSocketImpl.socketBind(Native Method)
	at java.net.PlainSocketImpl.bind(Unknown Source)
	at java.net.ServerSocket.bind(Unknown Source)
	at java.net.ServerSocket.<init>(Unknown Source)
	at java.net.ServerSocket.<init>(Unknown Source)
	at org.eclipse.osgi.framework.internal.core.ConsoleManager.startConsole(ConsoleManager.java:156)
	at org.eclipse.osgi.framework.internal.core.ConsoleManager.startConsole(ConsoleManager.java:107)
	at org.eclipse.osgi.framework.internal.core.EquinoxLauncher.internalInit(EquinoxLauncher.java:69)
	at org.eclipse.osgi.framework.internal.core.EquinoxLauncher.internalStart(EquinoxLauncher.java:274)
	at org.eclipse.osgi.framework.internal.core.EquinoxLauncher.start(EquinoxLauncher.java:251)
	at org.eclipse.osgi.launch.Equinox.start(Equinox.java:258)
	...


Reproducible: Always

Steps to Reproduce:
1. Create a socket which takes the OSGi console port
2. Start the Equinox framework.
Comment 1 Thomas Watson CLA 2011-05-16 08:51:47 EDT
Lazar, does the external console provide a better error message here?
Comment 2 Lazar Kirchev CLA 2011-05-16 09:13:01 EDT
(In reply to comment #1)
> Lazar, does the external console provide a better error message here?

No, it does not. But this is a good point to improve supportability in the external console. I will add better error messages for the telnet and ssh. I can add this to the Equinox buildt-in console too?
Comment 3 Thomas Watson CLA 2011-05-16 09:59:56 EDT
(In reply to comment #2)
> (In reply to comment #1)
> > Lazar, does the external console provide a better error message here?
> 
> No, it does not. But this is a good point to improve supportability in the
> external console. I will add better error messages for the telnet and ssh. I
> can add this to the Equinox buildt-in console too?

Sure, but this is not something we will do for the end of 3.7 for the built-in console.  Pushing to 3.8 (we could decide to backport to 3.7.1).

Right now the code simply does a printStackTrace() call which puts the error message to standard.err.  Perhaps logging would be good, but I suggest doing both in order to continue to give immediate notification on the standard.err.
Comment 4 Lazar Kirchev CLA 2011-05-16 10:03:54 EDT
(In reply to comment #3)
> (In reply to comment #2)
> > (In reply to comment #1)
> > > Lazar, does the external console provide a better error message here?
> > 
> > No, it does not. But this is a good point to improve supportability in the
> > external console. I will add better error messages for the telnet and ssh. I
> > can add this to the Equinox buildt-in console too?
> 
> Sure, but this is not something we will do for the end of 3.7 for the built-in
> console.  Pushing to 3.8 (we could decide to backport to 3.7.1).
> 
> Right now the code simply does a printStackTrace() call which puts the error
> message to standard.err.  Perhaps logging would be good, but I suggest doing
> both in order to continue to give immediate notification on the standard.err.

OK, I will take care for this.
Comment 5 Thomas Watson CLA 2011-06-08 11:31:01 EDT
Move all 3.8 bugs to Juno.
Comment 6 Thomas Watson CLA 2012-04-25 11:45:34 EDT
Not planning to fix this for the built-in console