Details
-
Bug
-
Resolution: Fixed
-
P4
-
None
-
b11
-
Verified
Description
The HttpBodySubscriberWrapper is a class that ensures that a subscriber will be subscribed to before it is completed. It also provides hooks to its two subclasses (one for HTTP/1, one for HTTP/2) that allows subclasses to register the susbscriber with the HttpClient at subscription time, and to unregister it when it is eventualy completed, or when the subscription is cancelled.
There is however a race condition that can happen when a subscription is cancelled: it can happen that unregister is called before register. The CancelRequestTest has been observed failing once or twice on personal jobs. Though the particular mechanics of this race is hard to understand, the logs of the tests have brought sufficient evidence that this is what was happening.
The symptom is finding one subscriber still registered after completion of the exchange:
test CancelRequestTest.testGetSendAsync("https://localhost:42711/https1/x/same/interrupt", true, true): failure
java.lang.AssertionError: WARNING: tracker for HttpClientImpl(13) has outstanding operations:
Pending HTTP Requests: 0
Pending HTTP/1.1 operations: 0
Pending HTTP/2 streams: 0
Pending WebSocket operations: 0
Pending TCP connections: 0
Pending Subscribers: 1
Total pending operations: 0
Facade referenced: true
Selector alive: true
There is however a race condition that can happen when a subscription is cancelled: it can happen that unregister is called before register. The CancelRequestTest has been observed failing once or twice on personal jobs. Though the particular mechanics of this race is hard to understand, the logs of the tests have brought sufficient evidence that this is what was happening.
The symptom is finding one subscriber still registered after completion of the exchange:
test CancelRequestTest.testGetSendAsync("https://localhost:42711/https1/x/same/interrupt", true, true): failure
java.lang.AssertionError: WARNING: tracker for HttpClientImpl(13) has outstanding operations:
Pending HTTP Requests: 0
Pending HTTP/1.1 operations: 0
Pending HTTP/2 streams: 0
Pending WebSocket operations: 0
Pending TCP connections: 0
Pending Subscribers: 1
Total pending operations: 0
Facade referenced: true
Selector alive: true
Attachments
Issue Links
- relates to
-
JDK-8277969 HttpClient SelectorManager shuts down when custom Executor rejects a task
- Resolved