Repository navigation
Network breakdown cause a file descriptor leak #3
Copy link
Copy link
Closed
Description
Activity
I used this code to prevent the problem:
public void initialize() throws IOException, NotInitializedException { logger.debug("Initialising TCPTransportClient. Origin address is [{}] and destination address is [{}]", origAddress, destAddress); if (destAddress == null) { throw new NotInitializedException("Destination address is not set"); } socketChannel = SelectorProvider.provider().openSocketChannel(); if (origAddress != null) { socketChannel.socket().bind(origAddress); } try { socketChannel.connect(destAddress); //PCB added logging socketChannel.configureBlocking(BLOCKING_IO); getParent().onConnected(); } catch (ConnectException e) { if (origAddress != null) { socketChannel.socket().close(); } socketChannel.close(); throw e; } }
I impoved my code because I got this exception sometimes whitch cause FDL again:
org.jdiameter.client.api.io.TransportException: Cannot init transport: at org.jdiameter.client.impl.transport.tcp.TCPClientConnection.connect(TCPClientConnection.java:111) at org.jdiameter.client.impl.controller.PeerImpl$ActionContext.connect(PeerImpl.java:685) at org.jdiameter.server.impl.fsm.PeerFSMImpl$4.processEvent(PeerFSMImpl.java:378) at org.jdiameter.client.impl.fsm.PeerFSMImpl$3.run(PeerFSMImpl.java:207) at java.lang.Thread.run(Thread.java:745) Caused by: java.net.BindException: Address already in use at sun.nio.ch.Net.bind0(Native Method) at sun.nio.ch.Net.bind(Net.java:433) at sun.nio.ch.Net.bind(Net.java:425) at sun.nio.ch.SocketChannelImpl.bind(SocketChannelImpl.java:585) at sun.nio.ch.SocketAdaptor.bind(SocketAdaptor.java:135) at org.jdiameter.client.impl.transport.tcp.TCPTransportClient.initialize(TCPTransportClient.java:131) at org.jdiameter.client.impl.transport.tcp.TCPClientConnection.connect(TCPClientConnection.java:107)public void initialize() throws IOException, NotInitializedException { logger.debug("Initialising TCPTransportClient. Origin address is [{}] and destination address is [{}]", origAddress, destAddress); if (destAddress == null) { throw new NotInitializedException("Destination address is not set"); } socketChannel = SelectorProvider.provider().openSocketChannel(); try { if (origAddress != null) { socketChannel.socket().bind(origAddress); } socketChannel.connect(destAddress); //PCB added logging socketChannel.configureBlocking(BLOCKING_IO); getParent().onConnected(); } catch (IOException e) { if (origAddress != null) { socketChannel.socket().close(); } socketChannel.close(); throw e; } }
Hi,
I found a file descriptor leak after a network breakdown. The root cause is socketChannel.connect(destAddress) in TCPTransportClient.java. I got this exception on Red Hat Enterprise Linux Server release 7.1 (Maipo) during breakdown: