* Issue #2349 - Review HTTP/2 max streams enforcement.
Changed the max concurrent remote streams enforcement algorithm.
It is now based on the stream count and the closing stream count,
updated atomically in a state machine in HTTP2Stream.
Fixed Javadoc.
Fixed close() method.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Now exiting the parse loop when the response is complete; if there
are bytes remaining in the buffer, then it's cleared out.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Changed the signature of HttpParser.Listener.onBadMessage()
to take a BadMessageException and updated dependent code.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Dumping also HttpChannelOverHTTP2 when dumping the HTTP2Stream.
The channel is now stored as a field in HTTP2Stream rather than
as an attribute to save the attributes map allocation.
Consequently, IStream has now getter/setter for the property
"attachment" that is used to store the channel without having
a type dependency on HttpChannel.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Introduced property connectBlocking in HTTP2Client so that it can
be forwarded by HttpClient and then used for HTTP/2 connects.
Also introduced HTTP2Client.bindAddress, again forwarded from HttpClient.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Issue #2293 Pending Multiplexed Connections
Added a AtomicBiInteger to allow both total connections and pending connections to be encoded in the
same atomic int.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Merging this PR for #2199 as we currently think it is not worse than previous and the code base is definitely simpler. While JMH has shown significant benefits for this approach, we have yet been able to demonstrate them in full scale integration tests - however that is likely due to GC and thread pool issues dominating.
A `org.eclipse.jetty.http2.PEC_MODE` System property has been added to allow the EWYK scheduling to be disabled for HTTP/2 if need be.
* Implementation of #1803 proposal 2 - EITHER dispatch type for EWYK
* made code more readable
* increase small threadpools in tests for extra reserved thread
* clean up
* minor code simplifications
* Work in progress to simplify reserved thread pool
* use a single ReservedThreadPool built into the QueuedThreadPool
* fixed javadoc
* removed more old reserved thread references
* disable EWYK for h2
* fixes from review
* use EWYK for HTTP2
* Fixed javadocs, imports and QueuedThreadPool constructors.
* fix javadoc
* EWYK avoid unnecessary pendings
* after review
* fixed merge with jetty-threadpool.xml
* alternate EWYK implementations
* added jetty copyright headers
* Simplified EWYK code after review
* fixed bad merge
* Code cleanups.
* Improved Javadocs for deprecated property "reservedThreads".
* Improved Javadocs for deprecated property "reservedThreads".
* added a system property to enable only PEC for HTTP/2
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Issue #1803 - Review usage of scheduling strategies
Use a single ReservedThreadExecutor built into the QueuedThreadPool
via new interface TryExecutor.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Scalable scheduler changes for #1918
* Added HttpChannel.destroy to destroy CyclicTimer
* fixed rebase with HttpConnectionOverFCGI
* renamed to acquire
* Destroying the HttpChannel consistently in all transports.
* updated headers
* cleanup after final review
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Removed the distinction between pushed and non-pushed channels; only
non-pushed channels are released and recycled if they're not failed.
Properly resetting HttpReceiverOverHTTP2.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Issue #2081 No idle timeout exception when dispatch is delayed
* Delegate the readtimeout handling to HttpChannel so that a delayed dispatch can be ended.
* Added unit test for delayed dispatch idle
* Now using HttpInput.onIdleTimeout() to fail the HttpInput, and then dispatching the request in case it has not been dispatched yet. This ensure consistent behavior independently of the value of HttpConfiguration.delayDispatchUntilContent.
* Fixed for both HTTP/1.1 and HTTP/2.
* Added tests for non-blocking reads.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Code cleanups.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Improved test case handler.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Improved exception message.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Issue #1973 - Implement minimum response data rate.
Implemented response content data rate control in HttpOutput.
Introduced a WriteFlusher.Listener interface that produces events
for every flush(). These events are forwarded to the Connection
and from there to the HttpOutput so that the data rate control can
be enforced.
Both HTTP/1.1 and HTTP/2 are implemented.
Data rate control for HTTP/1.1 is approximate because it will count
also headers bytes and the chunk bytes, while for HTTP/2 is precise.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Issue #1973 - Implement minimum response data rate.
Addressed review comments.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Added missing @ManagedObject annotation to AbstractConnectorHttpClientTransport.
Also exported to JMX the "multiplexed" attribute for the FCGI transport
and the "useALPN" attribute for the HTTP/2 transport.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Now waking up the flusher via iterate() after a reset has been received.
This ensures that frames that may have stalled are removed from the
flusher queue.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Because now the failures are asynchronous, code that was executed after
invoking the failure listener must be now executed after the
asynchronous processing done by the listener and therefore Callbacks
are introduced.
Idle timeout have a special meaning in that they become a no-operation
if the application is dispatched but idle (neither reading nor writing).
HttpChannelOverHTTP2 now forwards the idle timeout to HttpInput, which
will only change its state if it is interested in reading.
HttpInput.consumeAll() has been modified to consume all input even if
it's already failed.
Failures caused by the other peer (e.g. I/O failures or stream resets)
are now retained and will eagerly consumed any queued data to free up
the flow control windows.
Introduced ConnectionPool.Factory and HttpClientTransport.connectionPoolFactory.
This allows applications to create a ConnectionPool given the HttpDestination.
Since requests cannot be connection delimited, don't call
sslEngine.closeInbound() on the server.
On the client, added a configuration parameter to allow missing
TLS Close Message, since many servers do that.
Introduced SslConnection.allowMissingCloseMessage so that it
throws in case of truncation attacks.
Implemented support in the generic HttpChannel and Request classes.
Linked HTTP/1.1 and HTTP/2 trailers to call HttpChannel, so that trailers
are now available in Servlet APIs by casting to Jetty's Request class.
The semantic is that trailers will only be available _after_ reading
the request content.
It's common for a client to either close the connection or reset a
stream, so EofException is a better exception to report since it will
be logged at DEBUG level by the server, reducing the noise in the logs.
* Updated Maven plugins to versions that support JDK 9.
* Added jdk9 profiles to the build files.
* Introduced modules jetty-alpn-java-client and jetty-alpn-java-server
containing a pure JDK 9 implementation of ALPN.
* Wired ALPN connection factories (client and server) to use the proper
ALPN implementation based on the JDK platform version (8 or 9).
The fix notifies the transport when a reset frame is received,
allowing the transport to fail the write callback which then notifies
the application, either by throwing (in case of blocking writes) or
by calling error listeners.
Also added a guard, in HttpChannel.handle() for the ERROR_DISPATCH case,
that checks if the response is already committed, and if so, abort
the transport - similar to what's already there for 9.4.