RFR: 8223716: sun/net/www/http/HttpClient/MultiThreadTest.java should be more resilient to unexpected traffic
mark sheppard
macanaoire at hotmail.com
Wed May 15 23:35:31 UTC 2019
Hi Daniel,
a little feedback on the test and some observations.
was curious about this test, mainly that debug wasn't synchronized
and expected to see interleaved output from clients and servers.
So ran the test … had look at the output, which wasn't interleaved
and totals all seemed to matched
as I understand it the test outline is that
create Server
accept client connection
create Worker for connection
start worker
create 5 clients
create HttpUrlConnection to test server
send 20 requests
should see total 100 requests
20 from each client and 20 received by each worker
On looking at the output a little closer things seemed a little off
or my observations maybe wrong. Each of the workers i.e. the client
handlers in the server didn't receive 20 request but a random number
of requests. This seems to exhibit some of the pathology of the original bug ?
Ran the test multiple times and a total of 100 requests received but randomly distributed across
the workers
To observe the client side output I amended test constructor to take an int clientId and used that
in that clients debug output.
FWIW attached in a file with analysis of a few test runs output.
regards
Mark
msheppard at MARKS-LAPTOP /cygdrive/c/Users/msheppard/eclipse-workspace/JDK-Tests
$ /cygdrive/c/Development/jdk-installs/jdk-12/bin/java MultiThreadedHttpUrlConnectionTest > MTHUCT-4.out
msheppard at MARKS-LAPTOP /cygdrive/c/Users/msheppard/eclipse-workspace/JDK-Tests
$ more MTHUCT-4.out
server: calling accept.
server: return accept.
server: Started worker 0
server: calling accept.
server: return accept.
worker 0: Read request from client (162 bytes).
server: Started worker 1
server: calling accept.
server: return accept.
worker 1: Read request from client (162 bytes).
server: Started worker 2
server: calling accept.
server: return accept.
server: Started worker 3
server: calling accept.
server: return accept.
worker 2: Read request from client (162 bytes).
server: Started worker 4
server: calling accept.
client 0: read 11 bytes
client 3: read 11 bytes
client 1: read 11 bytes
worker 3: Read request from client (162 bytes).
worker 0: Read request from client (162 bytes).
worker 2: Read request from client (162 bytes).
worker 1: Read request from client (162 bytes).
worker 4: Read request from client (162 bytes).
client 3: read 11 bytes
client 4: read 11 bytes
client 1: read 11 bytes
client 0: read 11 bytes
worker 2: Read request from client (162 bytes).
worker 0: Read request from client (163 bytes).
worker 1: Read request from client (162 bytes).
worker 3: Read request from client (163 bytes).
client 4: read 11 bytes
client 1: read 11 bytes
client 3: read 11 bytes
worker 1: Read request from client (163 bytes).
worker 0: Read request from client (163 bytes).
client 0: read 11 bytes
client 4: read 11 bytes
client 1: read 11 bytes
worker 3: Read request from client (163 bytes).
worker 1: Read request from client (163 bytes).
worker 2: Read request from client (163 bytes).
worker 0: Read request from client (163 bytes).
client 4: read 11 bytes
client 3: read 11 bytes
client 0: read 11 bytes
client 1: read 11 bytes
worker 1: Read request from client (163 bytes).
worker 2: Read request from client (163 bytes).
worker 3: Read request from client (163 bytes).
worker 0: Read request from client (163 bytes).
client 4: read 11 bytes
client 3: read 11 bytes
client 0: read 11 bytes
worker 1: Read request from client (163 bytes).
client 1: read 11 bytes
worker 2: Read request from client (163 bytes).
worker 3: Read request from client (163 bytes).
client 4: read 11 bytes
client 3: read 11 bytes
worker 0: Read request from client (163 bytes).
worker 1: Read request from client (163 bytes).
client 0: read 11 bytes
worker 2: Read request from client (163 bytes).
client 1: read 11 bytes
client 4: read 11 bytes
client 3: read 11 bytes
worker 3: Read request from client (163 bytes).
worker 0: Read request from client (163 bytes).
worker 1: Read request from client (163 bytes).
worker 2: Read request from client (163 bytes).
client 0: read 11 bytes
client 1: read 11 bytes
client 3: read 11 bytes
client 4: read 11 bytes
worker 3: Read request from client (163 bytes).
worker 0: Read request from client (163 bytes).
worker 2: Read request from client (163 bytes).
worker 1: Read request from client (163 bytes).
client 0: read 11 bytes
client 3: read 11 bytes
client 1: read 11 bytes
client 4: read 11 bytes
worker 0: Read request from client (163 bytes).
worker 3: Read request from client (163 bytes).
worker 2: Read request from client (163 bytes).
worker 1: Read request from client (163 bytes).
client 3: read 11 bytes
client 4: read 11 bytes
client 0: read 11 bytes
client 1: read 11 bytes
worker 0: Read request from client (163 bytes).
worker 3: Read request from client (163 bytes).
worker 2: Read request from client (163 bytes).
worker 1: Read request from client (163 bytes).
client 3: read 11 bytes
client 4: read 11 bytes
client 0: read 11 bytes
client 1: read 11 bytes
worker 0: Read request from client (163 bytes).
worker 3: Read request from client (163 bytes).
worker 2: Read request from client (163 bytes).
worker 1: Read request from client (163 bytes).
client 3: read 11 bytes
client 4: read 11 bytes
client 0: read 11 bytes
client 1: read 11 bytes
worker 0: Read request from client (163 bytes).
worker 3: Read request from client (163 bytes).
worker 2: Read request from client (163 bytes).
client 3: read 11 bytes
client 4: read 11 bytes
worker 0: Read request from client (163 bytes).
client 0: read 11 bytes
worker 1: Read request from client (163 bytes).
client 3: read 11 bytes
worker 3: Read request from client (163 bytes).
worker 2: Read request from client (163 bytes).
client 1: read 11 bytes
worker 0: Read request from client (163 bytes).
client 4: read 11 bytes
client 0: read 11 bytes
worker 1: Read request from client (163 bytes).
worker 3: Read request from client (163 bytes).
client 1: read 11 bytes
worker 2: Read request from client (163 bytes).
client 3: read 11 bytes
client 4: read 11 bytes
client 0: read 11 bytes
worker 1: Read request from client (163 bytes).
worker 3: Read request from client (163 bytes).
worker 2: Read request from client (163 bytes).
client 1: read 11 bytes
worker 0: Read request from client (163 bytes).
client 3: read 11 bytes
client 0: read 11 bytes
worker 1: Read request from client (163 bytes).
client 4: read 11 bytes
worker 3: Read request from client (163 bytes).
worker 2: Read request from client (163 bytes).
client 1: read 11 bytes
worker 0: Read request from client (163 bytes).
client 3: read 11 bytes
client 0: read 11 bytes
worker 1: Read request from client (163 bytes).
client 4: read 11 bytes
worker 2: Read request from client (163 bytes).
worker 3: Read request from client (163 bytes).
client 1: read 11 bytes
worker 0: Read request from client (163 bytes).
client 0: read 11 bytes
client 3: read 11 bytes
worker 1: Read request from client (163 bytes).
client 4: read 11 bytes
worker 2: Read request from client (163 bytes).
worker 3: Read request from client (163 bytes).
client 1: read 11 bytes
client 0: read 11 bytes
client 3: read 11 bytes
worker 0: Read request from client (163 bytes).
worker 2: Read request from client (163 bytes).
worker 3: Read request from client (163 bytes).
worker 1: Read request from client (163 bytes).
client 0: read 11 bytes
worker 2: Read request from client (163 bytes).
client 3: read 11 bytes
client: end - PT0.110116S
client 1: read 11 bytes
client 0: read 11 bytes
client: end - PT0.1141757S
worker 1: Read request from client (163 bytes).
client 1: read 11 bytes
client: end - PT0.1141736S
client 2: read 11 bytes
client 4: read 11 bytes
worker 0: Read request from client (163 bytes).
client 2: read 11 bytes
worker 4: Read request from client (163 bytes).
worker 0: Read request from client (163 bytes).
client 2: read 11 bytes
client 4: read 11 bytes
client: end - PT0.1164921S
worker 4: Read request from client (163 bytes).
client 2: read 11 bytes
worker 4: Read request from client (163 bytes).
client 2: read 11 bytes
worker 4: Read request from client (163 bytes).
client 2: read 11 bytes
worker 4: Read request from client (163 bytes).
client 2: read 11 bytes
worker 4: Read request from client (163 bytes).
client 2: read 11 bytes
worker 4: Read request from client (163 bytes).
client 2: read 11 bytes
worker 4: Read request from client (163 bytes).
client 2: read 11 bytes
worker 4: Read request from client (163 bytes).
client 2: read 11 bytes
worker 4: Read request from client (163 bytes).
client 2: read 11 bytes
worker 4: Read request from client (163 bytes).
client 2: read 11 bytes
worker 4: Read request from client (163 bytes).
client 2: read 11 bytes
worker 4: Read request from client (163 bytes).
client 2: read 11 bytes
worker 4: Read request from client (163 bytes).
client 2: read 11 bytes
worker 4: Read request from client (163 bytes).
client 2: read 11 bytes
worker 4: Read request from client (163 bytes).
client 2: read 11 bytes
worker 4: Read request from client (163 bytes).
client 2: read 11 bytes
worker 4: Read request from client (163 bytes).
client 2: read 11 bytes
client: end - PT0.1238189S
Connections = 5
Requests = 100
Connection count = 5 Request count = 100
server: STE
server: Shuting down.
worker: 4: Shutdown
worker: 0: Shutdown
worker: 1: Shutdown
worker: 4 end - PT20.0052845S
worker: 2: Shutdown
worker: 3: Shutdown
worker: 0 end - PT20.0111739S
worker: 3 end - PT20.0097619S
worker: 1 end - PT20.0113868S
worker: 2 end - PT20.0108762S
main thread end - PT20.0743989S
msheppard at MARKS-LAPTOP /cygdrive/c/Users/msheppard/eclipse-workspace/JDK-Tests
$ grep "worker 0: Read" MTHUCT-4.out | wc
21 168 1029
msheppard at MARKS-LAPTOP /cygdrive/c/Users/msheppard/eclipse-workspace/JDK-Tests
$ grep "worker 1: Read" MTHUCT-4.out | wc
21 168 1029
msheppard at MARKS-LAPTOP /cygdrive/c/Users/msheppard/eclipse-workspace/JDK-Tests
$ grep "worker 2: Read" MTHUCT-4.out | wc
21 168 1029
msheppard at MARKS-LAPTOP /cygdrive/c/Users/msheppard/eclipse-workspace/JDK-Tests
$ grep "worker 3: Read" MTHUCT-4.out | wc
18 144 882
msheppard at MARKS-LAPTOP /cygdrive/c/Users/msheppard/eclipse-workspace/JDK-Tests
$ grep "worker 4: Read" MTHUCT-4.out | wc
19 152 931
msheppard at MARKS-LAPTOP /cygdrive/c/Users/msheppard/eclipse-workspace/JDK-Tests
$ grep "client 4: Read" MTHUCT-4.out | wc
0 0 0
msheppard at MARKS-LAPTOP /cygdrive/c/Users/msheppard/eclipse-workspace/JDK-Tests
$ grep "client 4: read" MTHUCT-4.out | wc
20 100 500
msheppard at MARKS-LAPTOP /cygdrive/c/Users/msheppard/eclipse-workspace/JDK-Tests
$ grep "client 0: read" MTHUCT-4.out | wc
20 100 500
msheppard at MARKS-LAPTOP /cygdrive/c/Users/msheppard/eclipse-workspace/JDK-Tests
$ grep "client 1: read" MTHUCT-4.out | wc
20 100 500
msheppard at MARKS-LAPTOP /cygdrive/c/Users/msheppard/eclipse-workspace/JDK-Tests
$ grep "client 2: read" MTHUCT-4.out | wc
20 100 500
msheppard at MARKS-LAPTOP /cygdrive/c/Users/msheppard/eclipse-workspace/JDK-Tests
$ grep "client 3: read" MTHUCT-4.out | wc
20 100 500
msheppard at MARKS-LAPTOP /cygdrive/c/Users/msheppard/eclipse-workspace/JDK-Tests
$ grep "client 4: read" MTHUCT-4.out | wc
20 100 500
________________________________
From: net-dev <net-dev-bounces at openjdk.java.net> on behalf of Daniel Fuchs <daniel.fuchs at oracle.com>
Sent: Wednesday 15 May 2019 17:49
To: Chris Hegarty; OpenJDK Network Dev list
Subject: Re: RFR: 8223716: sun/net/www/http/HttpClient/MultiThreadTest.java should be more resilient to unexpected traffic
On 15/05/2019 16:17, Chris Hegarty wrote:
> I believe workers should be volatile/synchronized, as it is
> written and read from different threads, no?
Thanks Chris.
workers is a concurrent queue, but the variable should
be final. I'll do it before pushing.
best regards,
-- daniel
>
> -Chris.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/net-dev/attachments/20190515/0255613c/attachment-0001.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: MultiThreadedHttpUrlConnectionTest.txt
URL: <https://mail.openjdk.java.net/pipermail/net-dev/attachments/20190515/0255613c/MultiThreadedHttpUrlConnectionTest-0001.txt>
More information about the net-dev
mailing list