hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Kalnichevski (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HTTPCORE-420) Connections left open after HTTP synchronous server shutdown
Date Mon, 04 Apr 2016 10:55:25 GMT

    [ https://issues.apache.org/jira/browse/HTTPCORE-420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15223942#comment-15223942
] 

Oleg Kalnichevski commented on HTTPCORE-420:
--------------------------------------------

You are correct. My understanding of the contract was wrong.

Oleg

> Connections left open after HTTP synchronous server shutdown
> ------------------------------------------------------------
>
>                 Key: HTTPCORE-420
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-420
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore
>    Affects Versions: 4.4.3
>         Environment: java version "1.8.0_65"
> Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
> Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
> Linux 3.0.101-0.47.71-default #1 SMP Thu Nov 12 12:22:22 UTC 2015 (b5b212e) x86_64 x86_64
x86_64 GNU/Linux
>            Reporter: Anton Krosnev
>            Assignee: Oleg Kalnichevski
>             Fix For: 4.4.5
>
>
> I have observed the following problem on Linux  with Apache HttpComponents 4.4.1 synchronous
server: After calling server.shutdown(42, TimeUnit.MICROSECONDS),  if there are Keep-alive
connections opened (there is no request processing), these sockets are not closed. Only ServerSocket
is closed:
> {quote}
> netstat -aon | grep 58276
> TCP    127.0.0.1:50658        127.0.0.1:58276        ESTABLISHED     18012
> TCP    127.0.0.1:58276        127.0.0.1:50658        ESTABLISHED     18012
> {quote}
> In attempt to start again HTTP server on the same port a BindingException is thrown:
> {quote}
> Caused by: java.net.BindException: Address already in use
> at java.net.PlainSocketImpl.socketBind(Native Method)
> at java.net.PlainSocketImpl.socketBind(PlainSocketImpl.java:521)
> at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:414)
> at java.net.ServerSocket.bind(ServerSocket.java:326)
> at java.net.ServerSocket.<init>(ServerSocket.java:192)
> at javax.net.DefaultServerSocketFactory.createServerSocket(ServerSocketFactory.java:170)
> at org.apache.http.impl.bootstrap.HttpServer.start(HttpServer.java:116)
> {quote}
> On Windows the behavior is the same , however there is no BindingException and the server
starts process requests without any problems.
> One can reproduce the problem using example code from https://github.com/anton-k11/apache-tests/tree/master
> # Start the server and the client. 
> # Client will send several requests to the server. 
> #* Client will open 2 connections to the server. 
> # After 1 min. the server will be shutdown. 
> #* Check the open connections on port 9090, the 2 connections between client and server
are still open. 
> # After 1 min. a new Server is started on the same port 9090.
> #* On Linux this brakes with:
> {quote}
>  java.net.BindException: Address already in use
>         at java.net.PlainSocketImpl.socketBind(Native Method)
>         at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
>         at java.net.ServerSocket.bind(ServerSocket.java:375)
>         at java.net.ServerSocket.<init>(ServerSocket.java:237)
>         at javax.net.DefaultServerSocketFactory.createServerSocket(ServerSocketFactory.java:231)
>         at org.apache.http.impl.bootstrap.HttpServer.start(HttpServer.java:116)
>         at org.apache.http.examples.server.TestHttpServer.main(TestHttpServer.java:49)
> {quote}
> #* On Windows this work just fine and the server is started successfully.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message