Ephemeral port range 1024..5000 exhausted, all ports occupied.

112 views
Skip to first unread message

Mohsen Sichani

unread,
Jan 10, 2015, 11:14:03 PM1/10/15
to
Hello All

I am using traci-launchd example in INETMANET with some modification which I will explain later, but unfortunately when I use TCP, I get the following error in OMNET,everything works fine with UDP, Any help is highly apprectiated.

Regards
Mohsen

<!> Error in module (TCP) scenario.host[6].tcp (id=156) at event #44635275, t=134.396103753775: Model error: Ephemeral port range 1024..5000 exhausted, all ports occupied.

TRAPPING on the exception above, due to a debug-on-errors=true configuration option. Is your debugger ready?

the error in sumo-launchd:
Seed is 0
Finding free port number...
Claiming lock on port
...found port 49116
Starting SUMO (sumo -c map4.sumo.cfg) on port 49116, seed 0
Connecting to SUMO (sumo -c map4.sumo.cfg) on port 49116 (try 1)
Error ([Errno 111] Connection refused)
Connecting to SUMO (sumo -c map4.sumo.cfg) on port 49116 (try 2)
Error ([Errno 111] Connection refused)
Connecting to SUMO (sumo -c map4.sumo.cfg) on port 49116 (try 3)
Error ([Errno 111] Connection refused)
Connecting to SUMO (sumo -c map4.sumo.cfg) on port 49116 (try 4)
Error ([Errno 111] Connection refused)
Connecting to SUMO (sumo -c map4.sumo.cfg) on port 49116 (try 5)
Releasing lock on port
Starting proxy mode
Done with proxy mode
Done with proxy mode, killing SUMO
Done running SUMO
Cleaning up
Result: "<?xml version="1.0"?>
<status>
<exit-code>1</exit-code>
<start>1420946880</start>
<end>1420947330</end>
<status>Exited with error code 1</status>
<stdout><![CDATA[Loading configuration... done.
Step #134.00]]></stdout>0.00*RT, ~149000.00UPS, vehicles TOT 149 ACT 149)     
<stderr><![CDATA[Error: tcpip::Socket::recvAndCheck @ recv: peer shutdown
Quitting (on error).
]]></stderr>
</status>
"
Closing connection from 127.0.0.1 on port 60275


my ini settings are :
**.startTime  = 90s
**.stopTime =2800s
**.host[0..7].hasTcp = true
**.host[6].numTcpApps =3
**.host[6].tcpApp[*].typename = "TCPBasicClientApp"
**.host[6].tcpApp[*].numRequestsPerSession =1
**.host[6].tcpApp[*].thinkTime = 0s
**.host[6].tcpApp[*].idleInterval =0s
**.host[6].tcpApp[*].requestLength = 35B
**.host[6].tcpApp[*].replyLength = 1050B
**.tcpApp[*].dataTransferMode = "object"
##Client-server 0
**.host[6].tcpApp[0].localPort = 80
**.host[6].tcpApp[0].connectAddress = "host[0]"
**.host[6].tcpApp[0].connectPort = 80
##Client-server 1
**.host[6].tcpApp[1].localPort = 81
**.host[6].tcpApp[1].connectAddress = "host[1]"
**.host[6].tcpApp[1].connectPort = 81
#Client-server 2
**.host[6].tcpApp[2].localPort = 82
**.host[6].tcpApp[2].connectAddress = "host[2]"
**.host[6].tcpApp[2].connectPort = 82

#server 0
**.host[0].numTcpApps  = 3
**.host[0].tcpApp[*].typename = "TCPGenericSrvApp"
**.host[0].tcpApp[0].localPort = 80
**.host[0].tcpApp[1].localPort = 81
**.host[0].tcpApp[2].localPort = 82

#Server1
**.host[1].numTcpApps  = 3
**.host[1].tcpApp[*].typename = "TCPGenericSrvApp"
**.host[1].tcpApp[0].localPort = 80
**.host[1].tcpApp[1].localPort = 81
**.host[1].tcpApp[2].localPort = 82

#Server2
**.host[2].numTcpApps  = 3
**.host[2].tcpApp[*].typename = "TCPGenericSrvApp"
**.host[2].tcpApp[0].localPort = 80
**.host[2].tcpApp[1].localPort = 81
**.host[2].tcpApp[2].localPort = 82



Mohsen Sichani

unread,
Jan 12, 2015, 1:50:15 AM1/12/15
to omn...@googlegroups.com
Hi all

I checked TCP.cc class and I did not find out a lot.This errors is related to the following codes which mean all ports are occupied, but I can not understand why?


ushort TCP::getEphemeralPort()
{
// start at the last allocated port number + 1, and search for an unused one
ushort searchUntil = lastEphemeralPort++;
if (lastEphemeralPort == EPHEMERAL_PORTRANGE_END) // wrap
lastEphemeralPort = EPHEMERAL_PORTRANGE_START;
while (usedEphemeralPorts.find(lastEphemeralPort) != usedEphemeralPorts.end())
{
if (lastEphemeralPort == searchUntil) // got back to starting point?
error("Ephemeral port range %d..%d exhausted, all ports occupied", EPHEMERAL_PORTRANGE_START, EPHEMERAL_PORTRANGE_END);
lastEphemeralPort++;
if (lastEphemeralPort == EPHEMERAL_PORTRANGE_END) // wrap
lastEphemeralPort = EPHEMERAL_PORTRANGE_START;
}
// found a free one, return it
return lastEphemeralPort;
}


The modification Which I made
module Car extends WirelessHost
{
//In this module I eliminated the traci-udp submodule, and also eliminated mobility submodule from WirelessHost .
   parameters:
        @node();
        networkLayer.configurator.networkConfiguratorModule = "";
        @display("i=device/cellphone");
        string LinkLayerType = default("Ieee80211NicMesh");
        wlan[*].typename = LinkLayerType;
        IPForward = default(true);
        networkLayer.configurator.networkConfiguratorModule = default("");
        string routingProtocol @enum("AODVUU","DYMOUM","DYMO","DSRUU","OLSR","OLSR_ETX","DSDV_2","Batman") = default("");  // used mobile routing protocol. see: inet.networklayer.manetrouting
    submodules:
        autoconfigurator: HostAutoConfigurator2 {
            @display("p=101,225");
        }
        manetrouting: <routingProtocol> like IManetRouting if routingProtocol != "" &&  LinkLayerType != "Ieee80211NicMesh" {
            @display("p=522,307");
        }
      
        mobility: TraCIMobility {
            parameters:
                @display("p=60,459");
        }
    connections:
        networkLayer.transportOut++ --> manetrouting.from_ip if routingProtocol != "";
        networkLayer.transportIn++ <-- manetrouting.to_ip if routingProtocol != "";
}

Alfonso Ariza Quintana

unread,
Jan 12, 2015, 5:21:24 AM1/12/15
to omn...@googlegroups.com

I suspect that your application is opining a TCP port every time that it sends a packet but it never closes the opened ports.

--
You received this message because you are subscribed to the Google Groups "omnetpp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to omnetpp+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mohsen Sichani

unread,
Jan 12, 2015, 5:48:26 PM1/12/15
to omn...@googlegroups.com, aari...@hotmail.com, som...@ccs-labs.org
Dear Alfonso

I would like to appreciate all of your support and many thanks for your consideration. Unfortunately, I could not find the problem. Since, I did not do any modification in any of the TCP source codes, I guess it might be related to Sumo-launchd.py. I changed all ports in my ini file to be greater than 50000 but still I get the same error Ephemeral port range 1024..5000 exhausted, all ports occupied",
 I think sumo-launchd scan all port to find an open port so the problem might be related to that one, I cc this message to Chrisotph (Dr. Sommer) and I hope that he and you kindly could help me to come up with a solution.

mohsen@mohsen-OptiPlex-990:~/Omnetworkspace5jan/inetmanet-2.0-inetmanet-2.2/etc$ ./sumo-launchd.py -vv -c sumo
Logging to /tmp/sumo-launchd.log
Listening on port 9999
Connection from 127.0.0.1 on port 55353
Handling connection from 127.0.0.1 on port 55353
Got TraCI message of length 2
Got TraCI command of length 1
Got TraCI command 0x0
Got CMD_GETVERSION
Got TraCI message of length 316
Got TraCI command of length 311
Got TraCI command 0x75
Got CMD_FILE_SEND for "sumo-launchd.launch.xml"
Got CMD_FILE_SEND with data "<launch>
  <copy file="map4.net.xml"/>
  <copy file="map4.rou.xml"/>
  <copy file="map4.poly.xml"/>
  <copy file="map4.sumo.cfg" type="config"/>
  <basedir path="/home/mohsen/Omnetworkspace5jan/inetmanet-2.0-inetmanet-2.2/examples/traci_launchd/"/>
  <seed value="0"/>
</launch>
"
Creating temporary directory...
Temporary dir is /tmp/sumo-launchd-tmp-D6uI4B
Base dir is /home/mohsen/Omnetworkspace5jan/inetmanet-2.0-inetmanet-2.2/examples/traci_launchd/
Seed is 0
Finding free port number...
Claiming lock on port
...found port 54587
Starting SUMO (sumo -c map4.sumo.cfg) on port 54587, seed 0
Connecting to SUMO (sumo -c map4.sumo.cfg) on port 54587 (try 1)
Error ([Errno 111] Connection refused)
Connecting to SUMO (sumo -c map4.sumo.cfg) on port 54587 (try 2)
Error ([Errno 111] Connection refused)
Connecting to SUMO (sumo -c map4.sumo.cfg) on port 54587 (try 3)
Error ([Errno 111] Connection refused)
Connecting to SUMO (sumo -c map4.sumo.cfg) on port 54587 (try 4)
Error ([Errno 111] Connection refused)
Connecting to SUMO (sumo -c map4.sumo.cfg) on port 54587 (try 5)
Releasing lock on port
Starting proxy mode
Done with proxy mode
Done with proxy mode, killing SUMO
Done running SUMO
Cleaning up
Result: "<?xml version="1.0"?>
<status>
<exit-code>1</exit-code>
<start>1421101524</start>
<end>1421102239</end>
<status>Exited with error code 1</status>
<stdout><![CDATA[Loading configuration... done.
Step #598.00]]></stdout>0.00*RT, ~94000.00UPS, vehicles TOT 149 ACT 94)       
<stderr><![CDATA[Error: tcpip::Socket::recvAndCheck @ recv: peer shutdown
Quitting (on error).
]]></stderr>
</status>
"
Closing connection from 127.0.0.1 on port 55353

Mohsen Sichani

unread,
Jan 13, 2015, 3:00:36 PM1/13/15
to omn...@googlegroups.com, aari...@hotmail.com, som...@ccs-labs.org
Dear Christoph and Alfonso

I think I found the problem, it was related to the values for these two parameters:
thinkTime 
idleInterval

As soon as I increased them, the problem solved.

Thanks once again for your thoughtfulness.


Cheers
Mohsen

Danh Le Dinh

unread,
May 22, 2017, 12:39:17 PM5/22/17
to OMNeT++ Users, aari...@hotmail.com, som...@ccs-labs.org
Hi Mohsen,
I got the same error when doing simulation with TCPBasicApp module. So what values did you set to the two parameters? Even though I set the two parameters at 5s, but the error still remains. So I just think that it is not for setting of these two parameters, but still not think of any reason. What other reason/ solution you may think of if that is not for setting of two parameters?
Thank you very much!
Best,
Danh
Reply all
Reply to author
Forward
0 new messages