Commit Graph

1614 Commits

Author SHA1 Message Date
Simone Bordet 115ee1cf39
Fixes #12289 - Improve ConcurrentPool concurrency. (#12290)
A call to `sweep()`, although protected by the lock for concurrent calls to `reserve()`, may be concurrent with `remove(Entry)`.

`remove(Entry)` in turn calls `entries.remove(Object)`, so that the concurrent iteration in `sweep()` over `entries` fails with an `ArrayIndexOutOfBoundsException`.

Now using the bulk `entries.removeIf(Predicate)` method in `sweep()`, so that sweeping is atomic with respect to `entries.remove(Object)`.

Fixed other occurrences of manual iteration over CopyOnWriteArrayList that may be concurrent with removals.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-09-20 15:50:39 +02:00
Simone Bordet 9c342637cc Fixed #12284 - Excessive heap consumption by SSLSessionImpl by Jetty Server with TLS 1.3 and long-lived client.
Now `SslSessionData` is stored as a field, rather than in the `SSLSession` as an attribute.
This implies a little more cost to create the `SslSessionData` per connection rather than per `SSLSession`, but it should be negligible.

Now `SslSessionData` cannot be retrieved as a `SSLSession` attribute, but we have explicit APIs to retrieve it, so it should not be a problem.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-09-20 16:41:15 +03:00
Jan Bartel 6f83639d32
Issue #12279 ensure handlers added correctly for maven plugin (#12282)
* Issue #12279 ensure handlers added correctly for maven plugin
2024-09-19 09:38:08 +10:00
Greg Wilkins dc43f3d498
Optimize request buffer release #12239 (#12240)
Release request buffer before handling when there is no content

---------

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
2024-09-18 07:11:32 +10:00
Simone Bordet 8c943c4bfb Issue #12256 - Configuring Virtual Thread executor in Jetty Http client makes my Spring Boot app freeze
* Defaulted the number of selectors to 1 in HttpClientTransportOverHTTP, to align with ClientConnector.
* Improved virtual thread documentation.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-09-16 11:01:06 +03:00
Ludovic Orban ceee65a7e5 #12268 do not rely on time
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2024-09-16 09:11:54 +02:00
Ludovic Orban 2018c439b6 #12268 reset _iterate flag when another processing is scheduled
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2024-09-16 09:11:54 +02:00
Joakim Erdfelt 044a3be744
Merge pull request #12245 from jetty/release/12.0.13
Merge back release 12.0.13
2024-09-11 09:45:12 -05:00
Simone Bordet fa0502db54
Fixes #12249 - HTTP/2 responses with Content-Length may have no content. (#12250)
Fixed HttpReceiverOverHTTP2.read() to return a failed chunk if the stream has been reset.
This closes the window where a RST_STREAM frame may be received, drain the DATA frames in HTTP2Stream, and the application reading exactly at that point.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-09-09 17:20:17 +02:00
Simone Bordet 5bff971fb0
Fixed flaky test EventsHandlerTest.testEventsOfNoopHandler().
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-09-06 11:58:45 +02:00
Simone Bordet 6887435773
Fixes #12227 - Improve HttpConnection buffer recycling. (#12237)
In this PR, the responsibility to release the buffers is in 2 methods: onFillable() (called when network data is available, and to process the next request) and parseAndFillForContent() (called from Request.read()).

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: gregw <gregw@webtide.com>
2024-09-06 14:11:29 +10:00
Olivier Lamy f0a1db100f
Jetty 12.0.x Add jdk23 build (fix javadoc breaking with 23) (#12238)
* add jdk23 build
* make jdk23 happy with javadoc
---------

Signed-off-by: Olivier Lamy <olamy@apache.org>
2024-09-06 10:57:42 +10:00
Olivier Lamy 65e9bba44c
next snapshot
Signed-off-by: Olivier Lamy <olamy@apache.org>
2024-09-03 21:44:43 +10:00
Olivier Lamy 816018a420
Updating to version 12.0.13 2024-09-03 13:03:43 +10:00
Lachlan 899c005e34
Merge pull request #12208 from jetty/jetty-12.0.x-11434-AliasCheckerSymlinkTests
Issue #11434 - resolve differences in AliasCheckerSymlinkTests
2024-09-03 10:02:56 +10:00
Greg Wilkins 551710e9bb
Improve shutdown of non-persistent HTTP/1 connections #12212 (#12216)
* Improve shutdown of non-persistent HTTP/1 connections

 + shutdown in SendCallback

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>

---------

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
2024-09-03 07:58:16 +10:00
Ludovic Orban 5439f17ff6
Rework leak tracking assertions to use a common awaitility pattern (#12226)
Rework leak tracking assertions to use a common awaitility pattern

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2024-09-02 19:34:05 +02:00
Jan Bartel caa09ad2cc
Issue #12207 reinstate DefaultHandler for jetty maven plugin (#12211) 2024-09-02 16:29:39 +10:00
gregw eecf4cf555 Tagged tests as Isolated that modify the static RESOURCE_FACTORIES 2024-09-02 11:50:17 +10:00
gregw 3d5a58a1f4 minor cleanups a potential flaky fix 2024-09-02 08:23:28 +10:00
Greg Wilkins ebc5e559f8
Removed reliance on exception to shutdown non persistent connections (#12213)
Moved the shutdownOutput in HttpStreamOverHttp1 to before the continuation of handling
2024-08-31 07:51:01 +10:00
Simone Bordet 1726c8778c
Fixes HttpClient Content.Source reads from arbitrary threads (#12203)
* Reworked HttpReceiverOverHTTP state machine, in particular:
** Introduced a boolean parameter to parseAndFill() and parse(), that specifies whether to notify the application demand callback.
   This is necessary because reads may happen from any threads, and must not notify the application demand callback.
   Only when there is no data, and fill interest is set, then the application demand callback must be notified.
** Removed action field to avoid lambda allocation.
** Now the application is called directly from the parse() method.
** Reading -1 from the network drives the parser by calling again parse(), rather than the parser directly.
  This allows to have a central place to notify the response success event.

* Fixed FastCGI similarly to HTTP/1.1.
* Removed leftover of the multiplex implementation.

* Fixed test flakyness in `NetworkTrafficListenerTest`: consume the request content before sending the response.

* Follow up after #10880: only abort the request if there is request content in `AuthenticationProtocolHandler` and `RedirectProtocolHandler`.
  This avoids the rare case where the response arrives before the request thread has modified the request state, even if the request has been fully sent over the network, causing the request to be failed even if it should not.

* added `SerializedInvoker` assertions about current thread invoking.
* Name all SerializedInvoker instances for better troubleshooting.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
Co-authored-by: Ludovic Orban <lorban@bitronix.be>
2024-08-30 12:01:43 +02:00
Olivier Lamy e1cd1f57c8
Move h2spec exec to a profile (#12209)
* move h2spec plugin exec to a profile

---------

Signed-off-by: Olivier Lamy <olamy@apache.org>
2024-08-30 12:06:40 +10:00
Dmitry Kaukov 4755fa3f68
Customizable error page buffer size (#11654)
Customizable error page buffer size

---------

Co-authored-by: Greg Wilkins <gregw@webtide.com>
2024-08-30 08:33:10 +10:00
Lachlan Roberts 178a795f93
Issue #11434 - resolve differences in AliasCheckerSymlinkTests
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
2024-08-29 08:28:15 +10:00
Ludovic Orban ed1cadc449
fix npe when onCompleteFailure happens after reset (#12199)
Fix npe when onCompleteFailure happens after reset

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
2024-08-28 19:43:54 +02:00
Greg Wilkins aa07995f37
sendError(-1) is an abort (#12206)
restore behaviour from jetty <= 11 where a sendError(-1) is a true abort, without an attempt to send an error response.
2024-08-28 20:24:10 +10:00
gregw 1bf074894a Merge branch 'fork/Tony-the-Tech/fix/12.0.x/SslContextFactory_use_credential' into jetty-12.0.x
Updated with call to check if old behaviour has been extended.
2024-08-28 09:13:22 +10:00
Simone Bordet 0420e926a1
Fixes #12171 - QoSHandler does not resume on a virtual thread. (#12174)
Now QoSHandler resumes requests using Request.getComponents().getExecutor().
This Executor is configured to be the virtual thread executor, if present, otherwise the Server Executor.

Removed warn() from VirtualThreads.isVirtualThread(), as it was too verbose.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-08-27 10:03:48 +02:00
Joakim Erdfelt 4fd306fcc2
Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-VirtualThreadPoolSemaphore 2024-08-26 09:01:06 -05:00
Simone Bordet 0f28d47597
Fixed assertion mismatch between int and long.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-08-26 11:52:55 +02:00
Simone Bordet 0a56509130
Fixes #11822 - HTTP/2 responses exceeding SETTINGS_MAX_HEADER_LIST_SIZE do not result in RST_STREAM or GOAWAY. (#12165)
Now HpackException.SessionException is treated specially in HTTP2Flusher.
It is caught, it fails all the entries, and then tries to send a GOAWAY, which will be the only frame allowed into the HTTP2FLusher at that point.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-08-26 11:33:17 +02:00
Simone Bordet 930d91568a
Fixes #9121 - Flaky BlockedWritesWithSmallThreadPoolTest.testServerThreadsBlockedInWrites(). (#12178)
The test uncovered a larger problem detailed in the issue: the Handler Callback should be non-blocking.

Since all implementations of HttpStream are non-blocking, overridden HttpStream.getInvocationType() to return NON_BLOCKING.

This guarantees that even in case of all server threads blocked, blocked/pending writes can be completed.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-08-26 11:12:38 +02:00
Simone Bordet 21f2f2acea
Fixes #3553 - Support sslSession() in Jetty Client. (#12179)
Implemented Connection.getSslSessionData(), where the Connection can be obtained from the Request:
request.getConnection().getSslSessionData().

Updated documentation.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-08-26 11:10:04 +02:00
Lachlan Roberts 8464340f07
Fix potential NPE from VirtualThreadPool
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
2024-08-26 12:36:53 +10:00
Tony Copping 66e4bd862f Issue #12175 Updates based on feedback
Signed-off-by: Tony Copping <tony@sigsoft.ca>
2024-08-24 10:05:01 -06:00
Simone Bordet bb52d95a62
Fixes #12063 - Introduce Jetty module for HTTP/2 client dependencies. (#12170)
Introduced http2-client.mod and http2-client-transport.mod.
These modules download dependencies via a [files] section.
They can be used to have the server provide the dependencies in case of a web application proxies request using HTTP/2.

Fixed ContentProvider to set the context ClassLoader before reading the Jetty XML context file, which may reference classes from the web application.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-08-23 16:33:51 +02:00
Simone Bordet cc469a136d
Code/Import cleanups.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-08-23 12:01:16 +02:00
Simone Bordet 01ce4dbe64
Limited max suspended requests to 1024 by default.
Javadocs, comment and logging improvements.
Simplified test case.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-08-23 11:59:31 +02:00
Lars Krog-Jensen 034493ad7f
Issue #12185 code formatting 2024-08-23 11:59:31 +02:00
Lars Krog-Jensen 994012e7eb
Issue #12185 Custom FJP in unit test and more white space formatting 2024-08-23 11:59:30 +02:00
Lars Krog-Jensen f37a4a167b
Issue #12185 white space formatting and increase delay to avoid flaky tests 2024-08-23 11:59:30 +02:00
Lars Krog-Jensen 32652e88bc
Issue #12185 code formatting 2024-08-23 11:59:30 +02:00
Lars Krog-Jensen b7591d546f
Issue #12185 implementation/test of max suspended requests in QoSHandler 2024-08-23 11:59:30 +02:00
Jan Bartel dbb982108b
Fix order of jetty.http.port property for jetty maven plugin (#12183) 2024-08-23 11:59:30 +02:00
Simone Bordet 9f08dc3050
Fixes #12154 - Limit concurrent virtual threads. (#12155)
Updated VirtualThreadPool to limit the number of concurrent virtual threads using a Semaphore.

Updated modules and documentation.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-08-23 11:59:30 +02:00
Olivier Lamy ba4cc396eb
change urls https://eclipse.dev to https://jetty.org (#12172)
* change urls https://eclipse.dev to  https://jetty.org

---------

Signed-off-by: Olivier Lamy <olamy@apache.org>
2024-08-23 11:59:29 +02:00
Paul B. Henson d4dbece1af Add new rewrite rule to return response status code based on matching header values 2024-08-22 17:22:50 -07:00
Simone Bordet 942e77c3c5
Fixes #6514 - How to warm up SslConnection. (#12151)
Implemented "priming" of HTTP/1.1 connections using ConnectionPool.preCreateConnections(int) and HttpClientTransportOverHTTP.setInitializeConnections(true).

This sends `OPTIONS * HTTP/1.1` to the server.

I tried to implement this feature by forcing a write of 0 bytes from the layer above `SslConnection`, but it did not work when using TLS because in both WriteFlusher and SslConnection the fact that there are 0 bytes left to write is treated specially.

Other HTTP versions have no problems because they must initialize the connection by e.g. sending a SETTINGS frame, so they would also initialize TLS.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
2024-08-20 10:19:32 +02:00
Tony Copping 2f22767dc1 Issue #12175 Update SslContextFactory to use Credential instead of Password
Signed-off-by: Tony Copping <tony@sigsoft.ca>
2024-08-19 18:41:35 -06:00