The socket backlog of HttpServer is still low.

Andrew Hughes gnu.andrew at redhat.com
Wed Dec 24 18:45:11 UTC 2014



----- Original Message -----
> ----- Original Message -----
> > Hi Ivan,
> > 
> > Thank you for your reply. My apologies for the late reply.
> > 
> > Unfortunately, I try to search the commit of this fix, but I could not find
> > it.
> > 
> > So I wrote the patch to solve this problem. If set less than 1 to the
> > second
> > parameter
> > of HttpServer#create, HttpServer is created with the default socket
> > backlog,
> > i.e. 50([1]).
> > 
> > I think that JAX-WS should use the default socket backlog than specific low
> > value like 5.
> > If there is a better method for openjdk community, please advise me.
> > 
> > -----
> > 
> > diff -r 48972b9b6536
> > drop_included/jaxws_src/src/com/sun/xml/internal/ws/transport/http/server/ServerMgr.java
> > ---
> > a/drop_included/jaxws_src/src/com/sun/xml/internal/ws/transport/http/server/ServerMgr.java
> > Wed Oct 08 19:12:52 2014 +0100
> > +++
> > b/drop_included/jaxws_src/src/com/sun/xml/internal/ws/transport/http/server/ServerMgr.java
> > Fri Dec 05 15:02:18 2014 +0900
> > @@ -79,7 +79,8 @@
> >                   state = servers.get(inetAddress);
> >                   if (state == null) {
> >                       logger.fine("Creating new HTTP Server at
> >                       "+inetAddress);
> > -                    server = HttpServer.create(inetAddress, 5);
> > +                    // Creates a new HTTP server with default socket
> > backlog.
> > +                    server = HttpServer.create(inetAddress, 0);
> >                       server.setExecutor(Executors.newCachedThreadPool());
> >                       String path = url.toURI().getPath();
> >                       logger.fine("Creating HTTP Context at = "+path);
> > -----
> > 
> > [1]
> > http://hg.openjdk.java.net/jdk6/jdk6/jdk/file/tip/src/share/classes/java/net/ServerSocket.java#l199
> > 
> > Thanks,
> > Yuji
> > 
> > On 2014/11/24 21:15, Ivan Krylov wrote:
> > > Not sure what link [1] should be demonstrating. Could you send a link to
> > > the diff associated with the fix?
> > >
> > > Thanks,
> > >
> > > Ivan
> > >
> > > On 21/11/2014 07:03, KUBOTA Yuji wrote:
> > >> Hi all,
> > >>
> > >> JDK7 and JAX-WS RI 2.2.6 solved the low socket backlog of HttpServer
> > >> [1].
> > >> However, JDK6 still provides the HttpServer which is created with socket
> > >> backlog 5 [2].
> > >>
> > >> I could not find the reason why this change do not backport to JDK6.
> > >> Please backport it or update JAX-WS of JDK6, if there is not a blocker
> > >> of
> > >> this issue.
> > >>
> > >> Thanks,
> > >> Yuji.
> > >>
> > >> [1]:https://java.net/jira/browse/JAX_WS-945
> > >> [2]:http://hg.openjdk.java.net/jdk6/jdk6/jaxws/file/48972b9b6536/drop_included/jaxws_src/src/com/sun/xml/internal/ws/transport/http/server/ServerMgr.java#l82
> > 
> > 
> > 
> 
> Yes, this is a problem with the way Sun/Oracle maintain JAXP and JAXWS; the
> sources
> are bulk updated outside of security updates, so there's no log of changes.
> At least
> now they do keep the sources in the OpenJDK tree rather than as external zip
> files...
> 
> To this end, the only log I get for this file in OpenJDK 7 is:
> 
> $ hg log -R ../../jdk7/jaxws
> ../../jdk7/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/transport/http/server/ServerMgr.java
> changeset:   321:913b9e4d8c51
> user:        ohair
> date:        Sun May 13 11:14:50 2012 -0700
> summary:     7150322: Stop using drop source bundles in jaxws
> 
> which is pretty unhelpful. However, the diff between the 6 and 7 versions of
> the
> file is pretty close to your patch:
> 
> $ diff -u
> ../jaxws/drop_included/jaxws_src/src/com/sun/xml/internal/ws/transport/http/server/ServerMgr.java
> ../../jdk7/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/transport/http/server/ServerMgr.java
> ---
> ../jaxws/drop_included/jaxws_src/src/com/sun/xml/internal/ws/transport/http/server/ServerMgr.java
> 	2013-09-10 18:09:25.743193221 +0100
> +++
> ../../jdk7/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/transport/http/server/ServerMgr.java
> 	2012-05-14 05:03:15.000000000 +0100
> @@ -1,5 +1,5 @@
>  /*
> - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights
> reserved.
> + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights
> reserved.
>   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
>   *
>   * This code is free software; you can redistribute it and/or modify it
> @@ -22,6 +22,7 @@
>   * or visit www.oracle.com if you need additional information or have any
>   * questions.
>   */
> +
>  package com.sun.xml.internal.ws.transport.http.server;
>  
>  import com.sun.net.httpserver.HttpContext;
> @@ -79,7 +80,8 @@
>                  state = servers.get(inetAddress);
>                  if (state == null) {
>                      logger.fine("Creating new HTTP Server at "+inetAddress);
> -                    server = HttpServer.create(inetAddress, 5);
> +                    // Creates server with default socket backlog
> +                    server = HttpServer.create(inetAddress, 0);
>                      server.setExecutor(Executors.newCachedThreadPool());
>                      String path = url.toURI().getPath();
>                      logger.fine("Creating HTTP Context at = "+path);
> 
> I'm happy to file an OpenJDK 6 bug for this and apply that patch, unless
> someone else has any objections.
> 
> Thanks,
> --
> Andrew :)
> 
> Free Java Software Engineer
> Red Hat, Inc. (http://www.redhat.com)
> 
> PGP Key: 248BDC07 (https://keys.indymedia.org/)
> Fingerprint = EC5A 1F5E C0AD 1D15 8F1F  8F91 3B96 A578 248B DC07
> 
> 

I didn't see any objections, so done as:

http://hg.openjdk.java.net/jdk6/jdk6/jaxws/rev/ff5dc052d805
-- 
Andrew :)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

PGP Key: 248BDC07 (https://keys.indymedia.org/)
Fingerprint = EC5A 1F5E C0AD 1D15 8F1F  8F91 3B96 A578 248B DC07



More information about the jdk6-dev mailing list