This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 7382 - Changing port throws java.net.BindException: Address already in use
Summary: Changing port throws java.net.BindException: Address already in use
Status: CLOSED WONTFIX
Alias: None
Product: ide
Classification: Unclassified
Component: Internal Server (show other bugs)
Version: 3.x
Hardware: PC Linux
: P3 major (vote)
Assignee: _ rkubacki
URL:
Keywords:
: 8129 (view as bug list)
Depends on:
Blocks:
 
Reported: 2000-08-15 08:40 UTC by dmladek
Modified: 2003-07-01 09:35 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
A list of running processes on my PC (9.44 KB, text/plain)
2001-07-20 20:39 UTC, dmladek
Details
output of netstat -a a lsof -i (17.30 KB, text/plain)
2001-07-20 20:39 UTC, dmladek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dmladek 2000-08-15 08:40:21 UTC
[1077IE]
JDK1.3.0Beta-b15
linux
====================
I don't know if it's some restriction of LINUX OS, so if that is, excuse me
this.

I want change the HTTP port from default value (8082) to 8077, but I received
the "java.net.BindException: Address already in use" and port was setted on
8078.
There is a short output from console window:
--------------------------------------------
Internal HTTP server running on port 8082
Internal RMI registry running on port 1099
Internal HTTP server stopped
path="" :jsp: init
Internal HTTP server running on port 8077
Internal HTTP server stopped
path="" :jsp: init
java.net.BindException: Address already in use
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:397)
        at java.net.ServerSocket.<init>(ServerSocket.java:170)
        at java.net.ServerSocket.<init>(ServerSocket.java:121)
        at
org.apache.tomcat.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:97)
        at
org.apache.tomcat.service.PoolTcpEndpoint.startEndpoint(PoolTcpEndpoint.java:235)
        at
org.apache.tomcat.service.PoolTcpConnector.start(PoolTcpConnector.java:187)
        at org.apache.tomcat.core.ContextManager.start(ContextManager.java:450)
        at
org.netbeans.modules.httpserver.HttpServerModule$1.run(HttpServerModule.java:106)
path="" :jsp: init
Internal HTTP server running on port 8078
---------------------------------------------------------
I'm not experinced on linux so some other process could use this port, so for
your convenience I attache file with all my running process on my PC
Comment 1 dmladek 2000-08-15 08:41:59 UTC
Created attachment 92 [details]
A list of running processes on my PC
Comment 2 dmladek 2000-08-17 18:14:59 UTC
now, I'm little bit more clever than last time. So I realized that the IDE
doesn't close opened port imedietly and leave them opened for an undefined long
time.
------------------
So, There might be problem about port value 8079 (always I got into a troubles
with this), but occasionaly it works too. I'm sure that this port hadn't beeing
used any other application even IDE. Once I try to change the HTTP port from
default value to 8079 in most cases it fails (this address is used) and it trys
iterate to next value which I don't like 8080. After restart IDE is possible to
adjust port value to 8079.
Bud if I try to change to something like 8080 than to switch back I recieve the
same Exception but twice because its attempt to iterate fails on a value 8080
too
and if you switch tho port to next value(8082) than to (8083) and so on...
And try to back decrease this value eg. to 8080 or 8079 all 5 attemts to find
free port fail.
------------
So, I think IDE holds opened ports unreasenably and leads a user to troubles and
to feel discomfortable.

Pls, do you think it could be solve or is there for it any reason?

And I attach onother useful attachment I hope.
Comment 3 dmladek 2000-08-17 18:15:59 UTC
Created attachment 99 [details]
output of netstat -a a lsof -i
Comment 4 dmladek 2000-10-03 10:02:59 UTC
this is probably problem only on linux (tested on W2K and Solaris without
problem). It's seems that IDE or JDK on linux doesn't close ports and that leads
to troubles.
Comment 5 dmladek 2001-02-13 15:23:59 UTC
[NBdev-125]
jdk1.3.0_01 PFCS Sun (or other vendors jdk1.3x)
rh70, Linux 2.2.16-20smp
=========================
As I wrote the mentioned problem is only on linux:-(

The main problem persists:
--------------------------
if you change port No. to other and than you change it to
previous value, you'll receive:
java.net.BindException: Adresa je u?ívána
and new value is adjusted (wanted val.+ (1 to 5))

Only restart of IDE helps.
Comment 6 _ rkubacki 2001-07-31 09:36:39 UTC
assigned
Comment 7 _ rkubacki 2001-08-31 14:57:19 UTC
*** Issue 8129 has been marked as a duplicate of this issue. ***
Comment 8 _ rkubacki 2001-09-03 10:26:35 UTC
Simple workaround is to set J2SE_PREEMPTCLOSE=1 variable. See
http://developer.java.sun.com/developer/bugParade/bugs/4344135.html
for more details about this.
Comment 9 _ rkubacki 2001-09-05 10:04:22 UTC
The workaround works but has a side effect that all proceses executed
by Runtime.getRuntime().exec() load libpreemptive_close.so library
where patched version of some system calls is implemented. This causes
 for example external browser (Netscape or Mozilla) doesn't work.

Also it is declared that Merlin will fix this issue.
Comment 10 dmladek 2001-09-05 12:40:29 UTC
hmmm....what could I do then verify it:-/
Comment 11 Quality Engineering 2003-07-01 09:35:01 UTC
Resolved for 3.3.x or earlier, no new info since then -> closing.