GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||
GeezerVison is showing github.com — Don't assume CertificateFactory is thread-safe by chrisvest · Pull Request #16350 · netty/netty Conversation
|
|
Should me maybe just create a new Factory every time and just remove the queue ? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Yeah, sure, we can just make a new one each time. It shouldn't get called all that often. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
I think this is basically called once per SSL / TLS handshake, so not sure if I would call it frequently or not. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Which is typically thousands of time per second in Gatling :( |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Is this only an issue with custom/exotic CertificateFactory implementations? Could the behavior be controlled with a System property? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Right, these are used to wrap the peer certs, not just the local cert. Let's use the Recycler, then. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@normanmaurer @slandelle Please take a look. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Build failures are flaky tests. Merging. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Motivation: We cannot assume that `CertificateFactory` implementations are thread-safe, since they contain complicated parsing logic which may be implemented as stateful operations depending on the particular provider used at runtime. Modification: Remove the singleton instance and just create a new `CertificateFactory` every time. Creating these factories should not be the most expensive thing, regardless of provider used. Made the `wrapped` field volatile to ensure visibility across threads, effectively obtaining safe publication for the `X509Certificate` object. This is important because `X509Certificate`, just like the `CertificateFactory`, may have any number of implementations at runtime and there are no guarantees about their thread-safety or immutability. Made the test dig into the SANs and compare the data directly, instead of relying on the `Collection.equals` implementation, which could be anything, just like with the other objects above. Result: `LazyX509Certificate` is now thread-safe. Should fix weird flaky test failures, such as: ``` [ERROR] Failures: [ERROR] LazyX509CertificateTest.testLazyX509Certificate:83 expected: java.util.Collections$UnmodifiableCollection@757bd65c<[[2, www.foo.com]]> but was: java.util.Collections$UnmodifiableCollection@2c32b649<[[2, www.foo.com]]> ``` (cherry picked from commit 8e147e5)
|
Auto-port PR for 4.1: #16364 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Motivation: We cannot assume that `CertificateFactory` implementations are thread-safe, since they contain complicated parsing logic which may be implemented as stateful operations depending on the particular provider used at runtime. Modification: Remove the singleton instance and just create a new `CertificateFactory` every time. Creating these factories should not be the most expensive thing, regardless of provider used. Made the `wrapped` field volatile to ensure visibility across threads, effectively obtaining safe publication for the `X509Certificate` object. This is important because `X509Certificate`, just like the `CertificateFactory`, may have any number of implementations at runtime and there are no guarantees about their thread-safety or immutability. Made the test dig into the SANs and compare the data directly, instead of relying on the `Collection.equals` implementation, which could be anything, just like with the other objects above. Result: `LazyX509Certificate` is now thread-safe. Should fix weird flaky test failures, such as: ``` [ERROR] Failures: [ERROR] LazyX509CertificateTest.testLazyX509Certificate:83 expected: java.util.Collections$UnmodifiableCollection@757bd65c<[[2, www.foo.com]]> but was: java.util.Collections$UnmodifiableCollection@2c32b649<[[2, www.foo.com]]> ``` (cherry picked from commit 8e147e5)
|
Auto-port PR for 5.0: #16366 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Auto-port of #16350 to 4.1 Cherry-picked commit: 8e147e5 --- Motivation: We cannot assume that `CertificateFactory` implementations are thread-safe, since they contain complicated parsing logic which may be implemented as stateful operations depending on the particular provider used at runtime. Modification: Remove the singleton instance and just create a new `CertificateFactory` every time. Creating these factories should not be the most expensive thing, regardless of provider used. Made the `wrapped` field volatile to ensure visibility across threads, effectively obtaining safe publication for the `X509Certificate` object. This is important because `X509Certificate`, just like the `CertificateFactory`, may have any number of implementations at runtime and there are no guarantees about their thread-safety or immutability. Made the test dig into the SANs and compare the data directly, instead of relying on the `Collection.equals` implementation, which could be anything, just like with the other objects above. Result: `LazyX509Certificate` is now thread-safe. Should fix weird flaky test failures, such as: ``` [ERROR] Failures: [ERROR] LazyX509CertificateTest.testLazyX509Certificate:83 expected: java.util.Collections$UnmodifiableCollection@757bd65c<[[2, www.foo.com]]> but was: java.util.Collections$UnmodifiableCollection@2c32b649<[[2, www.foo.com]]> ``` --------- Co-authored-by: Chris Vest <[email protected]>
Auto-port of #16350 to 5.0 Cherry-picked commit: 8e147e5 --- Motivation: We cannot assume that `CertificateFactory` implementations are thread-safe, since they contain complicated parsing logic which may be implemented as stateful operations depending on the particular provider used at runtime. Modification: Remove the singleton instance and just create a new `CertificateFactory` every time. Creating these factories should not be the most expensive thing, regardless of provider used. Made the `wrapped` field volatile to ensure visibility across threads, effectively obtaining safe publication for the `X509Certificate` object. This is important because `X509Certificate`, just like the `CertificateFactory`, may have any number of implementations at runtime and there are no guarantees about their thread-safety or immutability. Made the test dig into the SANs and compare the data directly, instead of relying on the `Collection.equals` implementation, which could be anything, just like with the other objects above. Result: `LazyX509Certificate` is now thread-safe. Should fix weird flaky test failures, such as: ``` [ERROR] Failures: [ERROR] LazyX509CertificateTest.testLazyX509Certificate:83 expected: java.util.Collections$UnmodifiableCollection@757bd65c<[[2, www.foo.com]]> but was: java.util.Collections$UnmodifiableCollection@2c32b649<[[2, www.foo.com]]> ``` Co-authored-by: Chris Vest <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.