Hello,
   I may have added this to fix some other issue.
   it would seem reasonable that stop() would reap (join) the dispatcher thread 
that was launched in start()
What is not expected, based on the design of the Dispatcher,  that a stop() 
will be invoked from within its executing thread
(run method).
The dispatcher effectively dispatches events to a handler, and that appears to 
be done through an executor.
In the case of the test it would appear that a handler method is being called 
within the context of the dispatcher's run method ?

It is possible that there is a deeper issue with the dispatcher  and the run 
method needs
to be looked at, also?

In any case, it is shown to be possible to call the stop within the 
Dispatcher's thread, and the fix solves that issue 👍

regards
Mark

________________________________
From: net-dev <net-dev-boun...@openjdk.java.net> on behalf of Vyom Tewari26 
<vtewa...@in.ibm.com>
Sent: Wednesday 27 November 2019 07:52
To: julia.b...@oracle.com <julia.b...@oracle.com>
Cc: net-dev@openjdk.java.net <net-dev@openjdk.java.net>
Subject: Re: RFR: 8233185: HttpServer.stop() blocks indefinitely when called on 
dispatch thread

Hi Julia,

thanks for looking into  this issue, it looks like regression, in JDK8  we  
don't do join() on "dispatcherThread" in stop().  We need to find out why we 
introduce the below code.

####################################################
if (dispatcherThread != null) {
            try {
                dispatcherThread.join();
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
                logger.log (Level.TRACE, "ServerImpl.stop: ", e);
            }
        }
#########################################################

Thanks,
Vyom

----- Original message -----
From: Julia Boes <julia.b...@oracle.com>
Sent by: "net-dev" <net-dev-boun...@openjdk.java.net>
To: OpenJDK Network Dev list <net-dev@openjdk.java.net>
Cc:
Subject: [EXTERNAL] RFR: 8233185: HttpServer.stop() blocks indefinitely when 
called on dispatch thread
Date: Tue, Nov 26, 2019 9:58 PM

Hi,

When HttpServer.stop(int delay) is called on the dispatcher thread of
the server, the call blocks indefinitely as the thread is waiting for
itself to die. The proposed fix in this case is to skip the join() and
let the thread return immediately.

Bug: https://bugs.openjdk.java.net/browse/JDK-8233185

Webrev: http://cr.openjdk.java.net/~jboes/webrevs/8233185/webrev.00/


Regards,

Julia




Reply via email to