RFR: 8233185: HttpServer.stop() blocks indefinitely when called on dispatch thread

mark sheppard macanaoire at hotmail.com
Wed Nov 27 09:44:05 UTC 2019


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-bounces at openjdk.java.net> on behalf of Vyom Tewari26 <vtewar26 at in.ibm.com>
Sent: Wednesday 27 November 2019 07:52
To: julia.boes at oracle.com <julia.boes at oracle.com>
Cc: net-dev at openjdk.java.net <net-dev at 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.boes at oracle.com>
Sent by: "net-dev" <net-dev-bounces at openjdk.java.net>
To: OpenJDK Network Dev list <net-dev at 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




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/net-dev/attachments/20191127/bb9ed270/attachment-0001.html>


More information about the net-dev mailing list