IBM Streams 4.2.1

Conflicts requesting ports from the local port range

An error is generated when the TCPSink, TCPSource, UDPSource, or UDPSink operator of an application specifies the port that IBM® Streams is already using, and the application is launched.

Symptoms

The symptoms can best be described in an example. A port can be assigned to IBM Streams at any time. In this example, assume that port number 8303 was unused and assigned to IBM Streams. Then, when an application that explicitly uses port 8303 is launched, the following error message is issued:
22 Aug 2012 12:24:51.050 [41774] ERROR spl_operator M[OperatorThread.cpp:run:76]  
- Received exception during execution of operator 'calc_profile_tcp_sink': 
'Unable to bind to port '8303': Address already in use.'.

The application can also exhibit any of the following symptoms:

  • Fails to launch
  • Launches sometimes and fails to launch at other times
  • Launches and then fails when a PE is restarted manually
  • Launches and then fails after a PE is restarted or relocated by the system

Diagnosing the problem

Use the following diagnostic commands, but replace port number 8303 in the first command with the port number that is causing the error in your system:
To show which process is using the port:
> netstat -lnp | grep '8303'
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address    Foreign Address        State       PID/Program name   
tcp        0      0 0.0.0.0:8303     0.0.0.0:*              LISTEN      30523/streams-pec  
To show the range of IP ports from which the operating system provides port numbers to IBM Streams:
> cat /proc/sys/net/ipv4/ip_local_port_range
8000 61000

Resolving the problem

Use one of the following solutions:
  • Change the Linux ip_local_port_range parameters to keep the operating system from allocating certain ports to any process that requests an unspecified port. The following example for the local port range ensures that only the unused ports in the 32768 to 61000 range are assigned.
    ip_local_port_range 32768   61000
  • In the application source code, edit the invocations of the TCPSink, TCPSource, UDPSource, and UDPSink operators to keep them from using port numbers that are within the local port range.