* Issue #2798 thread budget warning default to available cores
* Issue #2798 - Testcase example for ExecutorThreadPool
* Issue #2798 - Better TestCases for ThreadPoolBudget
* Simplified
* Issue #2798 - ThreadPoolBudget improvements.
* Removed unused imports.
* Made fields private.
* Removed field info.
* Changed the logic to print the info on leases only when warning or throwing.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Cleanup of Graceful shutdown, plus ensure Connection:close if connector is shutdown for #2749
* WIP close connection when shutting down
* WIP use HttpChannel.Listener
* cleanups
* support graceful stop of a context
* only close connections if the connector is shutdown
* minor cleanups
* fixed toString and test
* fixed imports
* Move close logic to HttpConnection
* fixed generator to not override persistent
* Issue #2749 - Close connections on graceful shutdown.
* Small fix after review.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
+ ensuring SLOTH fix still works with updated testcase
+ Dump detection of JreDisabled:java.security only checked
default SSLEngine.enabledCipherSuites
New implementation changes meaning to be more general
JVM:disabled (as in not selected by default), and
only reports it as disabled in the dump if not specifically
included from the SSLEngine.supportedCipherSuites via
the SslContextFactory.includedCipherSuites configuration
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Improved defaulting values for the truststore, avoiding to default
the password, which is often missing for a truststore.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Issue #2597 - Improving UnixSocketTest behavior.
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
jnr doesn't like filename/path with strange character so use a new property for jenkins build with docker
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
* Adding test case to verify existing PathResource behavior
* Skipping Resource class usage in OSGi entirely
* Only using the URL class, and removing of conversions to
other more correct forms (File and URI)
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Introduced ProcessorUtils.setAvailableProcessor(int) to allow
usage in embedded code without resorting to system properties.
Refactored the static initializer to be testable.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Now newly created threads set _lastShrink to avoid they are immediately
removed from the pool if they happen to meet the shrink conditions.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
1. The virtual method to stop fillInStackTrace() from being called by the
constructor has been removed.
2. The public no argument constructor for MultiException puts the class
into a builder mode where it just lets you add exceptions.
MultiException created from the constructor should not be thrown because
fillInStackTrace() is not called.
3. In the `ifExceptionThrow*()` methods a new `MultiException` is
created, with the stack trace filled, before it is thrown.
Signed-off-by: Luke Butters <lbutters@funnelback.com>
This doesn't actually stop creating the unnecessary exception instead it
stop running the expensive `fillInStackTrace()` unless we actually need
it.
This does result in the stack trace being set to where we throw the
exception rather than when we create it.
Signed-off-by: Luke Butters <lbutters@funnelback.com>
* Issue #2439 - Remove HTTP/2 data copy.
Implemented reference counting for the network buffer, with the
semantic that calling succeeded() on callbacks decrements the
reference count.
Introduced interface Retainable, used by the client when notifying
multiple application content listeners.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
+ Adding removeThread(Thread) to allow instrumentation
libraries to track removal of threads from Pool.
Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
Fixes#2468 - EWYK concurrent production.
Fixed the case when a task throws an exception, which causes
the thread that ran the task to continue production, even
when it should not.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Now explicitly using a _mappedBuffer field in
CachedContentFactory.CachedHttpContent.
Deprecated BufferUtil.isMappedBuffer().
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
## SearchPattern
New class which does a fast search for patterns within strings and arrays of bytes using an implementation of the Boyer–Moore–Horspool algorithm. This was written to be used in the new MultiPartParser class to search for delimeter boundaries.
## MultiPartParser
New class which uses the SearchPattern to parse a MultiPart Mime given a ByteBuffer. Written in a non-blocking style so can be used asynchronously (although not currently be being used this way).
## MultiPartFormInputStream
New class which uses the MultiPartParser to parse a MultiPart Mime input stream into a Collection of Parts. This class is in org/eclipse/jetty/http and is designed to replace org/eclipse/jetty/util/MultiPartInputStreamParser.
## MultiPartInputStreamParser and Non Compliances
This class has been deprecated and replaced by org.eclipse.jetty.http.MultiPartFormInputStream. It accepts formats non compliant with the RFC that the new MultiPartFormInputStream does not accept. When this occurs violations are recorded by the method getNonComplianceWarnings().
## MultiParts
New interface to allow switching between the different implementations. This allows MultiParts to function in two different modes. The LEGACY implementation using the UTIL parser which may parse forms containing non compliances with the RFC, and the RFC7578 implementation using the new and faster HTTP parser. This file contains the implementations of MultiParts for HTTP and UTIL parsers as nested classes which are used by Request.
## Request
Changed to use the new MultiParts interface instead of the MultiPartInputStreamParser class. with a method called newMultiParts which will construct a MultiPart using one of the HTTP or UTIL implementations depending on what compliance mode is set.
## Jetty Test Webapp Dump Servlet
Code added to display parts while running the dump test webapp if MuliPart form is submitted.
## MultiPartBenchMark
JMH Benchmark of the HTTP multipart parser vs the UTIL multipart parser.
testLargeGenerated parses a 10MB file of random binary data.
testParser parses a series of small multipart forms captured by a browser.
```
# Run complete. Total time: 00:02:09
Benchmark (parserType) Mode Cnt Score Error Units
MultiPartBenchmark.testLargeGenerated UTIL avgt 10 0.252 ± 0.025 s/op
MultiPartBenchmark.testLargeGenerated HTTP avgt 10 0.035 ± 0.004 s/op
MultiPartBenchmark.testParser UTIL avgt 10 0.028 ± 0.005 s/op
MultiPartBenchmark.testParser HTTP avgt 10 0.015 ± 0.006 s/op
```
Changed Request.MultiPartInputStream to an interface called MultiParts where there is an implementation for both the HTTP and UTIL parsers.
Resolved some issues with default charsets in regards to request.setCharacterEncoding and the _charset_ part for issue #2398.
Changed HTTP parser to operate the same as UTIL parser in situtions with parts not of type form-data or without name field. HTTP parser was ignoring these parts, UTIL parser was throwing exceptions.
Replaced the context attribute with a field in MultiParts.
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This allows Eclipse to continue to make use of jetty-* bundles
without requiring the presence of Apache Aries.
This fixes a problem introduced by the resolution to #2164 and
the same solution is used as in 10cdf16
See also the discussion at Eclipse:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=532294
Signed-off-by: Mat Booth <mat.booth@redhat.com>
Fixed method, added Javadocs and cleaned up code with a few renamings
to better comply with AtomicLong naming.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Modified tests in new MultiPartInputStreamTest which were failing because they didn't comply with RFC.
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
the --task was not protected with a memory barrier, so different producing threads could contend on the field.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
For #2284 no longer parse the optional detail of the java version.
Parse failures will result in a guessed JVM platform 8
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #2131 - Introduce a monitored thread pool.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Issue #2131 - Introduce a monitored thread pool.
Updated to use SampleStatistic and CounterStatistics.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Issue #2131 - Introduce a monitored thread pool.
Adding statistics fields as beans.
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>
Objects which inherit or implement an `equals()` method should not be compared with == or !=
When the comparison of references is intentional `@SuppressWarnings("ReferenceEquality")` can be used
Signed-off-by: Lachlan Roberts <lachlan@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>
* Clean up of actions (now updates) prior to #2046 fix
* prevent exceptions from termincating lifecycle doStop or destroy
* Refactored ManagedSelector stop to always close endpoints
* Fixed NPE if SelectorManager is already stopped
* refactored after review
* further simplifications after review
* Wait only for oshut endpoints
* Cleanup from review
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* ManagedSelector dump improvements from #1970
ManagedSelector dump improvements from #1970:
+ DumpKeys is now prepended to actions list so it is less likely to be delayed by a stuck/busy selector
+ Timestamps are included for actions and keys which may be separated by time
+ Race removed race for updating dumpKey list while it is being added to.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* moved utility timestamp format method to Log
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* updates after review
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* changes after review
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #1970 - ManagedSelector dump improvements.
Code cleanups.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Revert "Issue #1970 - ManagedSelector dump improvements."
This reverts commit 4febaf10dc.
* Fixed imports and other review feedback
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Issue #2010 Support FIPs Key Managers, by only wrapping the default Key Manager if we have wildcard CN's or more than 1 non wild CN. FIPs users will need to install a
keystore than has no multiple certificates than can only be resolved by SNI. They will also need to have no certificate aliases.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
Tag for release: jetty-9.4.8-SNAPSHOT
+ 212 HttpClient should support pluggable AuthenticationStore
+ 215 Add Conscrypt for native ALPN/TLS/SSL
+ 272 WebSocket hangs in blockingWrite
+ 487 JDK 9 build compatibility
+ 901 Overriding SSL context KeyStoreType requires explicit override of
TrustStoreType
+ 922 Implements methods Connection.getBytes[In|Out]()
+ 1209 IllegalStateException when HTTP/2 push is disabled
+ 1213 Upgrade to ASM Version 6.0 for JDK9
+ 1509 Improve GZIPContentDecoder buffer pooling sizing
+ 1550 Resolve inconsistent Shutdown configuration with Jetty Runner
+ 1640 Introduce :run-distro goal for local jetty distribution deployment
+ 1692 Annotation scanning should ignore `module-info.class` files
+ 1696 Missing stacktraces on debug of WriteFlusher onFail
+ 1705 Rejected executions in QueuedThreadPool can lead to memory leaks
+ 1760 Update to apache jasper 8.5.20
+ 1768 Allow jetty properties to be set for the jetty:run-forked goal
+ 1782 Using assembly.tarLongFileMode=posix for jetty-home and
jetty-distribution assembly
+ 1797 JEP 238 - Multi-Release JAR files break bytecode scanning
+ 1806 Improved ReservedThreads idle timeout
+ 1807 Add new HttpChannel listener and events for metrics libraries
+ 1814 Move JavaVersion to jetty-util for future Java 9 support requirements
+ 1818 Improve Infinispan support on JDK 9
+ 1819 Race condition during annotation parsing
+ 1823 ResourceHandler with ranged requests does not return Content-Type
response header
+ 1829 OSGi webbundle classes scanned twice
+ 1833 Request.startAsync requires context path
+ 1835 Locker is not reentrant on ServerConnector#setConnectionFactories
+ 1836 Migrate Locker implementation to JVM ReentrantLock implementation
+ 1841 Reduce contention on ServletHolder
+ 1845 Allow null User-Agent in HttpClient
+ 1849 Refactoring of SelectorManager.defaultSchedulers()
+ 1851 Improve insufficient thread warnings/errors
+ 1854 Consistent IOException and timeout handling when extracting form
parameters
+ 1856 ResourceHandler without ServletContext throws NPE for welcome files if
used directly
+ 1857 GZIPContentTransformer fails to send entire message if used with
BufferedContentTransformer
+ 1865 Improve Exception on invalid redirect usage
+ 1867 Improve Exception thrown during Expect 100 Continue
+ 1868 Need a way to randomly select ports for tests
+ 1871 JMXify SslContextFactory
+ 1878 Handle 100 Continue response without Expect header
+ 1879 'Bad tld url' seen during :jetty-run when running integration tests
+ 1881 Improve support of WebSocket over Unix Domain Socket
+ 1885 SessionHandler get/set maxInactiveInterval is not symmetric with
negative values
+ 1888 Implement cookie matching on Path attribute per RFC 6265
+ 1891 Make HTTP/2 async error notifications configurable
+ 1892 NPE resulting from bad JEP 238 MultiReleaseJarFile structure
+ 1893 Add ability to set HttpClient Connection TTL
+ 1897 Introduce a round-robin connection pool for HttpClient
+ 1900 Update to CDI 2.0 for cdi module
+ 1901 Reimplement PathWatcher as scanner
+ 1909 Update to Apache Jasper 8.5.23
+ 1910 Remove unused jetty-jsp module
+ 1912 AbstractConnector EndPoint leak for failed SSL connections
+ 1914 HttpClient fails to parse Content-Type response header with RFC 2045
charset="utf-8" syntax
+ 1919 Review LowResourceMonitor
+ 1920 Connect Timeouts with NonBlocking CreateEndPoint
+ 1924 ManagedSelector can livelock under high load
+ 1931 Expose RolloverOutputStream for pluggable behaviour
+ 1933 Use CLASSPATH for scanning java9 system classes
+ 1956 Store and report build information of Jetty
+ 1958 Blocking Timeout has different behavior in HttpInput vs HttpOutput
+ 1970 ManagedSelector can lose selector thread under high concurrent load
+ 1980 PushCacheFilter does not push TLS offloaded HTTP/2 requests
+ 1981 Loading resource content failed
+ 1984 Remove jetty-client dependency in jetty-rewrite
* Issue #1970 - ManagedSelector loses selector thread.
Removed broken data structure ConcurrentStack (ABA problem).
Made ReservedThreadExecutor use a ConcurrentLinkedDeque
instead of ConcurrentStack.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
* Issue #1931 Rollover log file
Added a protected method that is called whenever a log file is rolled over.
Support a date format of "" so that a rollover file may have the same name and a backup file is created.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* removed bad javadoc
Signed-off-by: Greg Wilkins <gregw@webtide.com>
* Issue #1931 Rollover
Replaced FilteredOutputStream with a volatile field so that rollover events will be seen immediately
* Issue #1931 Rollover
use mutex to avoid write and close race
* add a build.properties file containing git hash, build timestamp and scm url #1956
Signed-off-by: olivier lamy <olamy@webtide.com>
* move build infos to Jetty class so it's available for server and client
Signed-off-by: olivier lamy <olamy@webtide.com>
* apply changes by Greg review
Signed-off-by: olivier lamy <olamy@webtide.com>
* add a build.properties file containing git hash, build timestamp and scm url #1956
Signed-off-by: olivier lamy <olamy@webtide.com>
* move build infos to Jetty class so it's available for server and client
Signed-off-by: olivier lamy <olamy@webtide.com>
* apply changes by Greg review
Signed-off-by: olivier lamy <olamy@webtide.com>
Made MultiReleaseJarFile closeable and using try-with-resources in
AnnotationParser to avoid leaking file descriptors.
Made few code simplifications.
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>