[
https://issues.apache.org/jira/browse/HTTPCORE-108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12517269
]
Alexander Veit commented on HTTPCORE-108:
-----------------------------------------
Hi Oleg,
If you place
Thread.sleep(LONG_TIME);
System.gc();
System.runFinalization();
System.gc();
Thread.sleep(LONG_TIME);
between the the two blocks, the problem is still there. In
public SocketAddress listen(final SocketAddress address) throws IOException {
ServerSocketChannel serverChannel = ServerSocketChannel.open();
serverChannel.configureBlocking(false);
serverChannel.socket().bind(address);
SelectionKey key = serverChannel.register(this.selector,
SelectionKey.OP_ACCEPT);
key.attach(null);
return serverChannel.socket().getLocalSocketAddress();
}
serverChannel and socket have local scope. It's quite clear that nobody will
free the system resources that were allocated by the socket bind operation.
Even if a garbage collector run would free the resources this would be due to
implementation details in the Java system classes. However there seem to be
various references to the created server socket hold by the system
ShutdownHook, ThreadGroups and others.
> DefaultListeningIOReactor does not provide access to the ServerSocketChannel
> nor to the bound socket
> ----------------------------------------------------------------------------------------------------
>
> Key: HTTPCORE-108
> URL: https://issues.apache.org/jira/browse/HTTPCORE-108
> Project: HttpComponents Core
> Issue Type: Bug
> Components: HttpCore NIO
> Affects Versions: 4.0-alpha5
> Environment: any
> Reporter: Alexander Veit
> Priority: Blocker
>
> DefaultListeningIOReactor does not provide access to the ServerSocketChannel
> nor to the bound socket.
> org.apache.http.impl.nio.reactor.DefaultListeningIOReactor#listen(SocketAddress)
> opens a ServerSocketChannel and bind to the given address. However there is
> no way to free the allocated system resources. They are being used unti the
> Java VM terminates.
> This leads to problems in all circumstances where the listener should be
> restarted within the same VM.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]