From dfuchs at openjdk.org Thu Jun 1 11:09:37 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Thu, 1 Jun 2023 11:09:37 GMT Subject: RFR: 8309200: java/net/httpclient/ExecutorShutdown fais intermittently, if connection closed during upgrade [v2] In-Reply-To: References: Message-ID: > The ExecutorShutdown test has been observed failing intermittently, notably if by misfortune the shutdown sequence causes a connection to get aborted while upgrading. The issue is that the `ConnectionAborter` class that allows to mark the connection as being scheduled for closing before a handle to the connection is actually available isn't forwarding the original exception for which closing the connection was requested. When the connection is eventually closed, a generic `IOException: connection closed locally` is raised at the `SocketTube` level, which unfortunately can race with the original cause. > > The fix makes it possible to relay the original cause to the place where the IOException is raised, in order to set it as the cause of the new exception. Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: Review feedback ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14251/files - new: https://git.openjdk.org/jdk/pull/14251/files/5f275916..5fb0731e Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14251&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14251&range=00-01 Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/14251.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14251/head:pull/14251 PR: https://git.openjdk.org/jdk/pull/14251 From duke at openjdk.org Thu Jun 1 17:07:06 2023 From: duke at openjdk.org (Terry Chow) Date: Thu, 1 Jun 2023 17:07:06 GMT Subject: RFR: 8308593: Add Keepalive Extended Socket Options Support for Windows In-Reply-To: <7yOv2rc-pawQNLJSkjIU_fP2Z0hofqh1SMvN0dihFUk=.75f29eed-dbc0-48b6-8e59-86750691e6c1@github.com> References: <7yOv2rc-pawQNLJSkjIU_fP2Z0hofqh1SMvN0dihFUk=.75f29eed-dbc0-48b6-8e59-86750691e6c1@github.com> Message-ID: On Tue, 30 May 2023 22:46:05 GMT, Terry Chow wrote: > The PR adds support for setting the keepalive extended socket options on Windows. The implemented native code uses the SIO_KEEPALIVE_VALS control code, which is how keepalive values are set on Windows and so there are a few caveats. > > 1. The keepalive time and keepalive interval must both be set at the same time. In the implementation, a new SioKeepAlive class and ExtendedSocketOptions is created to capture this behaviour for Windows only. Keepalive enablement must also be configured when using SIO_KEEPALIVE_VALS, and so by default when setting keepalive time and keepalive interval, > keepalive will automatically be enabled. > > [SIO_KEEPALIVE_VALS doc](https://learn.microsoft.com/en-us/windows/win32/winsock/sio-keepalive-vals) > > 2. It doesn't seem possible to acquire the Keepalive time and keepalive interval values on Windows. So, the implementation doesn't support acquiring the values. > > https://stackoverflow.com/questions/14197347/how-to-query-socket-keep-alive-values-using-winsock/14198462#14198462 > https://stackoverflow.com/questions/18391341/reading-sio-keepalive-vals-fields-on-a-windows-socket-for-keepalive-idle-and-in > > 3. Keepalive probes are not supported. On Windows Vista and later, the number of keep-alive probes is set to 10 and cannot be changed. > > [SIO_KEEPALIVE_VALS Remarks](https://learn.microsoft.com/en-us/windows/win32/winsock/sio-keepalive-vals#remarks) > > For testing, I've updated the existing keepalive tests. But, since it's not possible to acquire the keepalive values on Windows to verify, I've indirectly tested setting the keepalive values by confirming keepalive is enabled where possible (since keepalive is enabled also when keepalive values are set). Apologies, I was talking to my liaison on what's the appropriate way to communicate (as I don't have a JBS account). Let me know if it's alright to discuss things here. Thanks for the quick reply on your thoughts. >The proposal that you have here is a new Windows specific and JDK-specific socket option that requires a lot of thinking about before going that route. I had similar thoughts as well, that this implementation was more of a "last resort". I've had other ideas of ways to go about this that I'll mention below, but there were some contentions and so this implementation was the most straightforward to do to get something working in order to have open dialog. But yeah, absolutely agree on more discussion. >It would be useful to know if the semantics of the SIO_KEEPALIVE_VALS control code is the equivalent of the TCP_KEEPIDLE + TCP_KEEPINTERVAL on other platforms. Yes, that's correct. SIO_KEEPALIVE_VALS is the Windows equivalent of setting the keep alive values on a per socket basis (only difference is that both are set at the same time). > It would also be useful to know if Windows has a system-wide default value for both the keep alive idle and interval. If it does then it might be possible to use the existing extended options, which if under the covers that both need to be set at the same time. So, the system-wide default keep alive idle and interval for Windows is 2hrs and 1s respectively. I also thought of using default values, but the issue is this: defaultKeepAliveTime = 2hrs defaultKeepAliveInterval = 1s 1. setKeepAliveTime(1hr) // user sets the keepAliveTime 2. setKeepAlive(1hr, defaultKeepAliveInterval) // under the covers we set both values 3. setKeepAliveInterval(20s) // user later sets the interval time 4. setKeepAlive(defaultKeepAliveTime, 20s) // prior keepAliveTime of 1hr is now back to default But we can get around this by keeping track of the current set keepAlive values. defaultKeepAliveTime = 2hrs defaultKeepAliveInterval = 1s currentKeepAliveTime = defaultKeepAliveTime currentKeepAliveInterval = defaultKeepAliveInterval 1. setKeepAliveTime(1hr) // user sets the keepAliveTime 2. setKeepAlive(1hr, currentKeepAliveInterval) // under the covers we set both values, keep track of new keepAliveTime value currentKeepAliveTime = 1hr 3. setKeepAliveInterval(20s) // user later sets the interval time 4. setKeepAlive(currentKeepAliveTime, 20s) // use prior set keepAliveTime currentKeepAliveInterval = 20s However, we can't keep track of the current keep alive values in `WindowsSocketOptions` as the same instance is shared by all socket instances. The place that makes the most sense to keep track of the current keep alive values seems like at the socket class level. What are your thoughts on keeping track of the values at the socket level? I was hesistant on this route because it doesn't seem right to track Windows only keep alive values at the socket class level. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14232#issuecomment-1572442618 From dfuchs at openjdk.org Thu Jun 1 18:16:11 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Thu, 1 Jun 2023 18:16:11 GMT Subject: RFR: 8304885: Reuse stale data to improve DNS resolver resiliency [v12] In-Reply-To: References: Message-ID: On Tue, 30 May 2023 16:00:28 GMT, Sergey Bylokhov wrote: >> Sergey Bylokhov has updated the pull request incrementally with two additional commits since the last revision: >> >> - Apply suggestions from code review >> >> Co-authored-by: Daniel Fuchs <67001856+dfuch at users.noreply.github.com> >> - Apply suggestions from code review >> >> Co-authored-by: Daniel Fuchs <67001856+dfuch at users.noreply.github.com> > > patch and the CSR are updated as requested. @mrserb I'm seeing the new test failing intermittently on at least 3 different platforms when run in our CI. Here is a failure log example (this one is on macOS): ----------System.out:(1/84)---------- The following provider will be used by current test:impl.SimpleResolverProviderImpl ----------System.err:(22/1638)---------- Jun 01, 2023 2:37:32 PM testlib.ResolutionRegistry INFO: Creating ResolutionRegistry instance from file:/System/Volumes/Data/mesos/work_dir/jib-master/install/2023-06-01-1120469.daniel.fuchs.jdk-dev-git/src.full/open/test/jdk/java/net/spi/InetAddressResolverProvider/addresses.txt Jun 01, 2023 2:37:32 PM testlib.ResolutionRegistry parseDataFile INFO: Constructed addresses registry: javaTest.org: /1.2.3.4 /ca:fe:ba:be:0:0:0:1 Jun 01, 2023 2:37:32 PM impl.SimpleResolverProviderImpl$1 lookupByName INFO: Looking-up addresses for 'javaTest.org'. Lookup characteristics:111 Jun 01, 2023 2:37:32 PM testlib.ResolutionRegistry lookupHost INFO: Looking-up 'javaTest.org' address Jun 01, 2023 2:37:37 PM impl.SimpleResolverProviderImpl$1 lookupByName INFO: Looking-up addresses for 'javaTest.org'. Lookup characteristics:111 java.lang.AssertionError: Only one positive lookup is expected with caching enabled expected [1051960105228] but found [1046805905970] at org.testng.Assert.fail(Assert.java:99) at org.testng.Assert.failNotEquals(Assert.java:1037) at org.testng.Assert.assertEqualsImpl(Assert.java:140) at org.testng.Assert.assertEquals(Assert.java:122) at org.testng.Assert.assertEquals(Assert.java:797) at AddressesStaleCachingTest.doLookup(AddressesStaleCachingTest.java:137) at AddressesStaleCachingTest.lambda$testOnlyOneThreadIsBlockedDuringRefresh$0(AddressesStaleCachingTest.java:108) at java.base/java.lang.Thread.run(Thread.java:1583) STATUS:Failed.`main' threw exception: java.lang.AssertionError: Only one positive lookup is expected with caching enabled expected [1051960105228] but found [1046805905970] ------------- PR Comment: https://git.openjdk.org/jdk/pull/13285#issuecomment-1572559591 From serb at openjdk.org Thu Jun 1 18:41:09 2023 From: serb at openjdk.org (Sergey Bylokhov) Date: Thu, 1 Jun 2023 18:41:09 GMT Subject: RFR: 8304885: Reuse stale data to improve DNS resolver resiliency [v12] In-Reply-To: References: Message-ID: On Mon, 29 May 2023 16:05:08 GMT, Sergey Bylokhov wrote: >> I would like to get preliminary feedback about the provided patch. >> >> Discussion on net-dev@ https://mail.openjdk.org/pipermail/net-dev/2023-March/020682.html >> >> One of the main issue I try to solve is how the cache handle the intermittent DNS server outages due to overloading or network connection. >> >> At the moment this cache can be configured by the application using the following two properties: >> (1) "networkaddress.cache.ttl"(30 sec) - cache policy for successful lookups >> (2) "networkaddress.cache.negative.ttl"(10 sec) - cache policy for negative lookups >> >> The default timeout for positive responses is good enough to "have recent dns-records" and to "minimize the number of requests to the DNS server". >> >> But the cache for the negative responses is problematic. This is a problem I would like to solve. Caching the negative response means that for **10** seconds the application will not be able to connect to the server. >> >> Possible solutions: >> 1. Decreasing timeout "for the negative responses": unfortunately more requests to the server at the moment of "DNS-outage" cause even more issues, since this is not the right moment to load the network/server more. >> 2. Increasing timeout "for the positive responses": this will decrease the chance to get an error, but the cache will start to use stale data longer. >> 3. This proposal: it would be good to ignore the negative response and continue to use the result of the last "successful lookup" until some additional timeout. >> >> The idea is to split the notion of the TTL and the timeout used for the cache. When TTL for the record will expire we should request the new data from the server. If this request goes fine we will update the record, if it fails we will continue to use the cached date until the next sync. >> >> For example, if the new property "networkaddress.cache.extended.ttl" is set to 10 minutes, then we will cache a positive response for 10 minutes but will try to sync it every 30 seconds. If the new property is not set then as before we will cache positive for 30 seconds and then cache the negative response for 10 seconds. >> >> >> RFC 8767 Serving Stale Data to Improve DNS Resiliency: >> https://www.rfc-editor.org/rfc/rfc8767 >> >> Comments about current and other possible implementations: >> * The code intentionally moved to the separate ValidAddresses class, just to make clear that the default configuration, when the new property is not set is not changed much. >> * The refr... > > Sergey Bylokhov has updated the pull request incrementally with two additional commits since the last revision: > > - Apply suggestions from code review > > Co-authored-by: Daniel Fuchs <67001856+dfuch at users.noreply.github.com> > - Apply suggestions from code review > > Co-authored-by: Daniel Fuchs <67001856+dfuch at users.noreply.github.com> Thank you for your feedback, I am looking into this possible issue. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13285#issuecomment-1572589384 From serb at openjdk.org Thu Jun 1 18:57:12 2023 From: serb at openjdk.org (Sergey Bylokhov) Date: Thu, 1 Jun 2023 18:57:12 GMT Subject: RFR: 8304885: Reuse stale data to improve DNS resolver resiliency [v12] In-Reply-To: References: Message-ID: On Mon, 29 May 2023 16:05:08 GMT, Sergey Bylokhov wrote: >> I would like to get preliminary feedback about the provided patch. >> >> Discussion on net-dev@ https://mail.openjdk.org/pipermail/net-dev/2023-March/020682.html >> >> One of the main issue I try to solve is how the cache handle the intermittent DNS server outages due to overloading or network connection. >> >> At the moment this cache can be configured by the application using the following two properties: >> (1) "networkaddress.cache.ttl"(30 sec) - cache policy for successful lookups >> (2) "networkaddress.cache.negative.ttl"(10 sec) - cache policy for negative lookups >> >> The default timeout for positive responses is good enough to "have recent dns-records" and to "minimize the number of requests to the DNS server". >> >> But the cache for the negative responses is problematic. This is a problem I would like to solve. Caching the negative response means that for **10** seconds the application will not be able to connect to the server. >> >> Possible solutions: >> 1. Decreasing timeout "for the negative responses": unfortunately more requests to the server at the moment of "DNS-outage" cause even more issues, since this is not the right moment to load the network/server more. >> 2. Increasing timeout "for the positive responses": this will decrease the chance to get an error, but the cache will start to use stale data longer. >> 3. This proposal: it would be good to ignore the negative response and continue to use the result of the last "successful lookup" until some additional timeout. >> >> The idea is to split the notion of the TTL and the timeout used for the cache. When TTL for the record will expire we should request the new data from the server. If this request goes fine we will update the record, if it fails we will continue to use the cached date until the next sync. >> >> For example, if the new property "networkaddress.cache.extended.ttl" is set to 10 minutes, then we will cache a positive response for 10 minutes but will try to sync it every 30 seconds. If the new property is not set then as before we will cache positive for 30 seconds and then cache the negative response for 10 seconds. >> >> >> RFC 8767 Serving Stale Data to Improve DNS Resiliency: >> https://www.rfc-editor.org/rfc/rfc8767 >> >> Comments about current and other possible implementations: >> * The code intentionally moved to the separate ValidAddresses class, just to make clear that the default configuration, when the new property is not set is not changed much. >> * The refr... > > Sergey Bylokhov has updated the pull request incrementally with two additional commits since the last revision: > > - Apply suggestions from code review > > Co-authored-by: Daniel Fuchs <67001856+dfuch at users.noreply.github.com> > - Apply suggestions from code review > > Co-authored-by: Daniel Fuchs <67001856+dfuch at users.noreply.github.com> The test expected to be completed in 2 seconds(10 lookups on a different threads). probably it is too short for mach5, will increase the time window. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13285#issuecomment-1572608619 From serb at openjdk.org Thu Jun 1 20:06:45 2023 From: serb at openjdk.org (Sergey Bylokhov) Date: Thu, 1 Jun 2023 20:06:45 GMT Subject: RFR: 8304885: Reuse stale data to improve DNS resolver resiliency [v13] In-Reply-To: References: Message-ID: <9SolZtNWEZUroBkwdGrRRitbOhpWNdHs-xywZiZXZ50=.0898395b-5ba0-407d-a9fb-48ca94eb72d9@github.com> > I would like to get preliminary feedback about the provided patch. > > Discussion on net-dev@ https://mail.openjdk.org/pipermail/net-dev/2023-March/020682.html > > One of the main issue I try to solve is how the cache handle the intermittent DNS server outages due to overloading or network connection. > > At the moment this cache can be configured by the application using the following two properties: > (1) "networkaddress.cache.ttl"(30 sec) - cache policy for successful lookups > (2) "networkaddress.cache.negative.ttl"(10 sec) - cache policy for negative lookups > > The default timeout for positive responses is good enough to "have recent dns-records" and to "minimize the number of requests to the DNS server". > > But the cache for the negative responses is problematic. This is a problem I would like to solve. Caching the negative response means that for **10** seconds the application will not be able to connect to the server. > > Possible solutions: > 1. Decreasing timeout "for the negative responses": unfortunately more requests to the server at the moment of "DNS-outage" cause even more issues, since this is not the right moment to load the network/server more. > 2. Increasing timeout "for the positive responses": this will decrease the chance to get an error, but the cache will start to use stale data longer. > 3. This proposal: it would be good to ignore the negative response and continue to use the result of the last "successful lookup" until some additional timeout. > > The idea is to split the notion of the TTL and the timeout used for the cache. When TTL for the record will expire we should request the new data from the server. If this request goes fine we will update the record, if it fails we will continue to use the cached date until the next sync. > > For example, if the new property "networkaddress.cache.extended.ttl" is set to 10 minutes, then we will cache a positive response for 10 minutes but will try to sync it every 30 seconds. If the new property is not set then as before we will cache positive for 30 seconds and then cache the negative response for 10 seconds. > > > RFC 8767 Serving Stale Data to Improve DNS Resiliency: > https://www.rfc-editor.org/rfc/rfc8767 > > Comments about current and other possible implementations: > * The code intentionally moved to the separate ValidAddresses class, just to make clear that the default configuration, when the new property is not set is not changed much. > * The refresh timeout includes the time s... Sergey Bylokhov has updated the pull request incrementally with one additional commit since the last revision: Update the AddressesStaleCachingTest, make it ready for slow systems ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13285/files - new: https://git.openjdk.org/jdk/pull/13285/files/e0de2e0d..94c9f319 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13285&range=12 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13285&range=11-12 Stats: 13 lines in 2 files changed: 3 ins; 0 del; 10 mod Patch: https://git.openjdk.org/jdk/pull/13285.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13285/head:pull/13285 PR: https://git.openjdk.org/jdk/pull/13285 From serb at openjdk.org Thu Jun 1 20:10:17 2023 From: serb at openjdk.org (Sergey Bylokhov) Date: Thu, 1 Jun 2023 20:10:17 GMT Subject: RFR: 8304885: Reuse stale data to improve DNS resolver resiliency [v13] In-Reply-To: <9SolZtNWEZUroBkwdGrRRitbOhpWNdHs-xywZiZXZ50=.0898395b-5ba0-407d-a9fb-48ca94eb72d9@github.com> References: <9SolZtNWEZUroBkwdGrRRitbOhpWNdHs-xywZiZXZ50=.0898395b-5ba0-407d-a9fb-48ca94eb72d9@github.com> Message-ID: On Thu, 1 Jun 2023 20:06:45 GMT, Sergey Bylokhov wrote: >> I would like to get preliminary feedback about the provided patch. >> >> Discussion on net-dev@ https://mail.openjdk.org/pipermail/net-dev/2023-March/020682.html >> >> One of the main issue I try to solve is how the cache handle the intermittent DNS server outages due to overloading or network connection. >> >> At the moment this cache can be configured by the application using the following two properties: >> (1) "networkaddress.cache.ttl"(30 sec) - cache policy for successful lookups >> (2) "networkaddress.cache.negative.ttl"(10 sec) - cache policy for negative lookups >> >> The default timeout for positive responses is good enough to "have recent dns-records" and to "minimize the number of requests to the DNS server". >> >> But the cache for the negative responses is problematic. This is a problem I would like to solve. Caching the negative response means that for **10** seconds the application will not be able to connect to the server. >> >> Possible solutions: >> 1. Decreasing timeout "for the negative responses": unfortunately more requests to the server at the moment of "DNS-outage" cause even more issues, since this is not the right moment to load the network/server more. >> 2. Increasing timeout "for the positive responses": this will decrease the chance to get an error, but the cache will start to use stale data longer. >> 3. This proposal: it would be good to ignore the negative response and continue to use the result of the last "successful lookup" until some additional timeout. >> >> The idea is to split the notion of the TTL and the timeout used for the cache. When TTL for the record will expire we should request the new data from the server. If this request goes fine we will update the record, if it fails we will continue to use the cached date until the next sync. >> >> For example, if the new property "networkaddress.cache.extended.ttl" is set to 10 minutes, then we will cache a positive response for 10 minutes but will try to sync it every 30 seconds. If the new property is not set then as before we will cache positive for 30 seconds and then cache the negative response for 10 seconds. >> >> >> RFC 8767 Serving Stale Data to Improve DNS Resiliency: >> https://www.rfc-editor.org/rfc/rfc8767 >> >> Comments about current and other possible implementations: >> * The code intentionally moved to the separate ValidAddresses class, just to make clear that the default configuration, when the new property is not set is not changed much. >> * The refr... > > Sergey Bylokhov has updated the pull request incrementally with one additional commit since the last revision: > > Update the AddressesStaleCachingTest, make it ready for slow systems The test was expected to use two "refresh" time frames, in the first frame the dns record is cached, in the second frame the dns record should be updated by one thread only, all others should use the stale data. Initially the time-frame was equal to 2 seconds, now it is increased to 7 seconds. But even if the system is too slow the test now will ignore timestamp checks outside of 12 seconds which is less than 14 second(two frames). ------------- PR Comment: https://git.openjdk.org/jdk/pull/13285#issuecomment-1572704211 From serb at openjdk.org Thu Jun 1 20:16:39 2023 From: serb at openjdk.org (Sergey Bylokhov) Date: Thu, 1 Jun 2023 20:16:39 GMT Subject: RFR: 8304885: Reuse stale data to improve DNS resolver resiliency [v14] In-Reply-To: References: Message-ID: > I would like to get preliminary feedback about the provided patch. > > Discussion on net-dev@ https://mail.openjdk.org/pipermail/net-dev/2023-March/020682.html > > One of the main issue I try to solve is how the cache handle the intermittent DNS server outages due to overloading or network connection. > > At the moment this cache can be configured by the application using the following two properties: > (1) "networkaddress.cache.ttl"(30 sec) - cache policy for successful lookups > (2) "networkaddress.cache.negative.ttl"(10 sec) - cache policy for negative lookups > > The default timeout for positive responses is good enough to "have recent dns-records" and to "minimize the number of requests to the DNS server". > > But the cache for the negative responses is problematic. This is a problem I would like to solve. Caching the negative response means that for **10** seconds the application will not be able to connect to the server. > > Possible solutions: > 1. Decreasing timeout "for the negative responses": unfortunately more requests to the server at the moment of "DNS-outage" cause even more issues, since this is not the right moment to load the network/server more. > 2. Increasing timeout "for the positive responses": this will decrease the chance to get an error, but the cache will start to use stale data longer. > 3. This proposal: it would be good to ignore the negative response and continue to use the result of the last "successful lookup" until some additional timeout. > > The idea is to split the notion of the TTL and the timeout used for the cache. When TTL for the record will expire we should request the new data from the server. If this request goes fine we will update the record, if it fails we will continue to use the cached date until the next sync. > > For example, if the new property "networkaddress.cache.extended.ttl" is set to 10 minutes, then we will cache a positive response for 10 minutes but will try to sync it every 30 seconds. If the new property is not set then as before we will cache positive for 30 seconds and then cache the negative response for 10 seconds. > > > RFC 8767 Serving Stale Data to Improve DNS Resiliency: > https://www.rfc-editor.org/rfc/rfc8767 > > Comments about current and other possible implementations: > * The code intentionally moved to the separate ValidAddresses class, just to make clear that the default configuration, when the new property is not set is not changed much. > * The refresh timeout includes the time s... Sergey Bylokhov has updated the pull request incrementally with one additional commit since the last revision: Update AddressesStaleCachingTest.java ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13285/files - new: https://git.openjdk.org/jdk/pull/13285/files/94c9f319..3ab77529 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13285&range=13 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13285&range=12-13 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/13285.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13285/head:pull/13285 PR: https://git.openjdk.org/jdk/pull/13285 From serb at openjdk.org Thu Jun 1 20:45:10 2023 From: serb at openjdk.org (Sergey Bylokhov) Date: Thu, 1 Jun 2023 20:45:10 GMT Subject: RFR: 8304885: Reuse stale data to improve DNS resolver resiliency [v14] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 20:16:39 GMT, Sergey Bylokhov wrote: >> I would like to get preliminary feedback about the provided patch. >> >> Discussion on net-dev@ https://mail.openjdk.org/pipermail/net-dev/2023-March/020682.html >> >> One of the main issue I try to solve is how the cache handle the intermittent DNS server outages due to overloading or network connection. >> >> At the moment this cache can be configured by the application using the following two properties: >> (1) "networkaddress.cache.ttl"(30 sec) - cache policy for successful lookups >> (2) "networkaddress.cache.negative.ttl"(10 sec) - cache policy for negative lookups >> >> The default timeout for positive responses is good enough to "have recent dns-records" and to "minimize the number of requests to the DNS server". >> >> But the cache for the negative responses is problematic. This is a problem I would like to solve. Caching the negative response means that for **10** seconds the application will not be able to connect to the server. >> >> Possible solutions: >> 1. Decreasing timeout "for the negative responses": unfortunately more requests to the server at the moment of "DNS-outage" cause even more issues, since this is not the right moment to load the network/server more. >> 2. Increasing timeout "for the positive responses": this will decrease the chance to get an error, but the cache will start to use stale data longer. >> 3. This proposal: it would be good to ignore the negative response and continue to use the result of the last "successful lookup" until some additional timeout. >> >> The idea is to split the notion of the TTL and the timeout used for the cache. When TTL for the record will expire we should request the new data from the server. If this request goes fine we will update the record, if it fails we will continue to use the cached date until the next sync. >> >> For example, if the new property "networkaddress.cache.extended.ttl" is set to 10 minutes, then we will cache a positive response for 10 minutes but will try to sync it every 30 seconds. If the new property is not set then as before we will cache positive for 30 seconds and then cache the negative response for 10 seconds. >> >> >> RFC 8767 Serving Stale Data to Improve DNS Resiliency: >> https://www.rfc-editor.org/rfc/rfc8767 >> >> Comments about current and other possible implementations: >> * The code intentionally moved to the separate ValidAddresses class, just to make clear that the default configuration, when the new property is not set is not changed much. >> * The refr... > > Sergey Bylokhov has updated the pull request incrementally with one additional commit since the last revision: > > Update AddressesStaleCachingTest.java Another possible problem is that the Thread.sleep used by the test may not be accurate enough, I will change that as well. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13285#issuecomment-1572750723 From serb at openjdk.org Thu Jun 1 21:28:23 2023 From: serb at openjdk.org (Sergey Bylokhov) Date: Thu, 1 Jun 2023 21:28:23 GMT Subject: RFR: 8304885: Reuse stale data to improve DNS resolver resiliency [v15] In-Reply-To: References: Message-ID: > I would like to get preliminary feedback about the provided patch. > > Discussion on net-dev@ https://mail.openjdk.org/pipermail/net-dev/2023-March/020682.html > > One of the main issue I try to solve is how the cache handle the intermittent DNS server outages due to overloading or network connection. > > At the moment this cache can be configured by the application using the following two properties: > (1) "networkaddress.cache.ttl"(30 sec) - cache policy for successful lookups > (2) "networkaddress.cache.negative.ttl"(10 sec) - cache policy for negative lookups > > The default timeout for positive responses is good enough to "have recent dns-records" and to "minimize the number of requests to the DNS server". > > But the cache for the negative responses is problematic. This is a problem I would like to solve. Caching the negative response means that for **10** seconds the application will not be able to connect to the server. > > Possible solutions: > 1. Decreasing timeout "for the negative responses": unfortunately more requests to the server at the moment of "DNS-outage" cause even more issues, since this is not the right moment to load the network/server more. > 2. Increasing timeout "for the positive responses": this will decrease the chance to get an error, but the cache will start to use stale data longer. > 3. This proposal: it would be good to ignore the negative response and continue to use the result of the last "successful lookup" until some additional timeout. > > The idea is to split the notion of the TTL and the timeout used for the cache. When TTL for the record will expire we should request the new data from the server. If this request goes fine we will update the record, if it fails we will continue to use the cached date until the next sync. > > For example, if the new property "networkaddress.cache.extended.ttl" is set to 10 minutes, then we will cache a positive response for 10 minutes but will try to sync it every 30 seconds. If the new property is not set then as before we will cache positive for 30 seconds and then cache the negative response for 10 seconds. > > > RFC 8767 Serving Stale Data to Improve DNS Resiliency: > https://www.rfc-editor.org/rfc/rfc8767 > > Comments about current and other possible implementations: > * The code intentionally moved to the separate ValidAddresses class, just to make clear that the default configuration, when the new property is not set is not changed much. > * The refresh timeout includes the time s... Sergey Bylokhov has updated the pull request incrementally with one additional commit since the last revision: Fix possible race in the SimpleResolverProviderImpl ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13285/files - new: https://git.openjdk.org/jdk/pull/13285/files/3ab77529..7bb0de6f Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13285&range=14 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13285&range=13-14 Stats: 10 lines in 1 file changed: 5 ins; 5 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/13285.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13285/head:pull/13285 PR: https://git.openjdk.org/jdk/pull/13285 From serb at openjdk.org Thu Jun 1 21:46:14 2023 From: serb at openjdk.org (Sergey Bylokhov) Date: Thu, 1 Jun 2023 21:46:14 GMT Subject: RFR: 8304885: Reuse stale data to improve DNS resolver resiliency [v12] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 18:13:37 GMT, Daniel Fuchs wrote: >> patch and the CSR are updated as requested. > > @mrserb I'm seeing the new test failing intermittently on at least 3 different platforms when run in our CI. > > Here is a failure log example (this one is on macOS): > > > ----------System.out:(1/84)---------- > The following provider will be used by current test:impl.SimpleResolverProviderImpl > ----------System.err:(22/1638)---------- > Jun 01, 2023 2:37:32 PM testlib.ResolutionRegistry > INFO: Creating ResolutionRegistry instance from file:/.../open/test/jdk/java/net/spi/InetAddressResolverProvider/addresses.txt > Jun 01, 2023 2:37:32 PM testlib.ResolutionRegistry parseDataFile > INFO: Constructed addresses registry: > javaTest.org: /1.2.3.4 /ca:fe:ba:be:0:0:0:1 > > Jun 01, 2023 2:37:32 PM impl.SimpleResolverProviderImpl$1 lookupByName > INFO: Looking-up addresses for 'javaTest.org'. Lookup characteristics:111 > Jun 01, 2023 2:37:32 PM testlib.ResolutionRegistry lookupHost > INFO: Looking-up 'javaTest.org' address > Jun 01, 2023 2:37:37 PM impl.SimpleResolverProviderImpl$1 lookupByName > INFO: Looking-up addresses for 'javaTest.org'. Lookup characteristics:111 > java.lang.AssertionError: Only one positive lookup is expected with caching enabled expected [1051960105228] but found [1046805905970] > at org.testng.Assert.fail(Assert.java:99) > at org.testng.Assert.failNotEquals(Assert.java:1037) > at org.testng.Assert.assertEqualsImpl(Assert.java:140) > at org.testng.Assert.assertEquals(Assert.java:122) > at org.testng.Assert.assertEquals(Assert.java:797) > at AddressesStaleCachingTest.doLookup(AddressesStaleCachingTest.java:137) > at AddressesStaleCachingTest.lambda$testOnlyOneThreadIsBlockedDuringRefresh$0(AddressesStaleCachingTest.java:108) > at java.base/java.lang.Thread.run(Thread.java:1583) > STATUS:Failed.`main' threw exception: java.lang.AssertionError: Only one positive lookup is expected with caching enabled expected [1051960105228] but found [1046805905970] @dfuch the test is updated, please take a look, it includes: - The fix for the slow systems when it was not enough time to complete the test. - The fix for the possible race in the SimpleResolverProviderImpl: 1 Thread_1 decided to refresh the record, it takes the lock in the InetAddress.java, but do not call the ResolverProvider yet. 2 Thread_2 decided to get a lock, fail to do that, take a stale data, and save the timestamp 3 Thread_1 call the ResolverProvider and update the timestamp, then intentionally hangs(becouse of the blocker) 4 Thread_2 decided to get a lock, fail to do that again, take a stale data, and save the timestamp 5 Thread_2 fails to compare timestamps from steps 2 and 4 It was fixed in the SimpleResolverProviderImpl, the blocked thread should update the timestamps at the end. Note that I was not able to reproduce the problems above out of the box, but was able to do that by adding some custom delays here and there in the JDK code. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13285#issuecomment-1572828425 From mbaesken at openjdk.org Fri Jun 2 08:09:32 2023 From: mbaesken at openjdk.org (Matthias Baesken) Date: Fri, 2 Jun 2023 08:09:32 GMT Subject: RFR: JDK-8309340: Provide sctpHandleSocketErrorWithMessage Message-ID: There are cases in the sctp coding where a function sctpHandleSocketErrorWithMessage would be beneficial (similar to existing handleSocketErrorWithMessage) to provide more detail what failed. Additionally sctpHandleSocketErrorWithMessage was a bit modified (added errno handling for ENOTCONN from handleSocketErrorWithMessage). ------------- Commit messages: - JDK-8309340 Changes: https://git.openjdk.org/jdk/pull/14280/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14280&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8309340 Stats: 20 lines in 2 files changed: 11 ins; 2 del; 7 mod Patch: https://git.openjdk.org/jdk/pull/14280.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14280/head:pull/14280 PR: https://git.openjdk.org/jdk/pull/14280 From jpai at openjdk.org Fri Jun 2 08:31:10 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Fri, 2 Jun 2023 08:31:10 GMT Subject: RFR: 8309200: java/net/httpclient/ExecutorShutdown fais intermittently, if connection closed during upgrade [v2] In-Reply-To: References: Message-ID: <3JQrq6EnHA-Zct0y6ZNx1rC7IreyRsaiA01MgUcEGY8=.2e5c0ffd-c42e-4998-a5ef-01524adf74c4@github.com> On Thu, 1 Jun 2023 11:09:37 GMT, Daniel Fuchs wrote: >> The ExecutorShutdown test has been observed failing intermittently, notably if by misfortune the shutdown sequence causes a connection to get aborted while upgrading. The issue is that the `ConnectionAborter` class that allows to mark the connection as being scheduled for closing before a handle to the connection is actually available isn't forwarding the original exception for which closing the connection was requested. When the connection is eventually closed, a generic `IOException: connection closed locally` is raised at the `SocketTube` level, which unfortunately can race with the original cause. >> >> The fix makes it possible to relay the original cause to the place where the IOException is raised, in order to set it as the cause of the new exception. > > Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: > > Review feedback The changes look fine to me. I have a minor comment about the code in the ConnectionAborter, which I've added inline. It's OK with me if you prefer to maintain it in its current form in the PR. src/java.net.http/share/classes/jdk/internal/net/http/Exchange.java line 176: > 174: } else { > 175: this.connection = null; > 176: this.cause = null; Hello Daniel, I had to read this a few times to understand why we are resetting `this.cause`, which we potentially set a few lines above, to `null` here. From what I understand, we only want to set `this.cause` when the `connection` is `null`. Do you think this code could instead of written as: Throwable cause; synchronized (this) { cause = this.cause; if (cause == null) { cause = error; } connection = this.connection; if (connection == null) { closeRequested = true; this.cause = cause; } else { this.connection = null; this.cause = null; } } ------------- Marked as reviewed by jpai (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14251#pullrequestreview-1456894820 PR Review Comment: https://git.openjdk.org/jdk/pull/14251#discussion_r1214079485 From djelinski at openjdk.org Fri Jun 2 09:30:06 2023 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Fri, 2 Jun 2023 09:30:06 GMT Subject: RFR: 8309200: java/net/httpclient/ExecutorShutdown fais intermittently, if connection closed during upgrade [v2] In-Reply-To: References: Message-ID: <_zul0dvx37mhxpSuDKJSeDm6kEq5lt1ePW4HK57gvQ0=.6a173b29-a4c4-4405-9d86-7ebc70d1d067@github.com> On Thu, 1 Jun 2023 11:09:37 GMT, Daniel Fuchs wrote: >> The ExecutorShutdown test has been observed failing intermittently, notably if by misfortune the shutdown sequence causes a connection to get aborted while upgrading. The issue is that the `ConnectionAborter` class that allows to mark the connection as being scheduled for closing before a handle to the connection is actually available isn't forwarding the original exception for which closing the connection was requested. When the connection is eventually closed, a generic `IOException: connection closed locally` is raised at the `SocketTube` level, which unfortunately can race with the original cause. >> >> The fix makes it possible to relay the original cause to the place where the IOException is raised, in order to set it as the cause of the new exception. > > Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: > > Review feedback Marked as reviewed by djelinski (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14251#pullrequestreview-1456989514 From dfuchs at openjdk.org Fri Jun 2 10:44:06 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Fri, 2 Jun 2023 10:44:06 GMT Subject: RFR: 8309200: java/net/httpclient/ExecutorShutdown fails intermittently, if connection closed during upgrade [v2] In-Reply-To: <3JQrq6EnHA-Zct0y6ZNx1rC7IreyRsaiA01MgUcEGY8=.2e5c0ffd-c42e-4998-a5ef-01524adf74c4@github.com> References: <3JQrq6EnHA-Zct0y6ZNx1rC7IreyRsaiA01MgUcEGY8=.2e5c0ffd-c42e-4998-a5ef-01524adf74c4@github.com> Message-ID: On Fri, 2 Jun 2023 08:25:35 GMT, Jaikiran Pai wrote: >> Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: >> >> Review feedback > > src/java.net.http/share/classes/jdk/internal/net/http/Exchange.java line 176: > >> 174: } else { >> 175: this.connection = null; >> 176: this.cause = null; > > Hello Daniel, I had to read this a few times to understand why we are resetting `this.cause`, which we potentially set a few lines above, to `null` here. From what I understand, we only want to set `this.cause` when the `connection` is `null`. Do you think this code could instead of written as: > > > Throwable cause; > synchronized (this) { > cause = this.cause; > if (cause == null) { > cause = error; > } > connection = this.connection; > if (connection == null) { > closeRequested = true; > this.cause = cause; > } else { > this.connection = null; > this.cause = null; > } > } Much better yes. I'll steal it! ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14251#discussion_r1214212516 From dfuchs at openjdk.org Fri Jun 2 10:51:24 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Fri, 2 Jun 2023 10:51:24 GMT Subject: RFR: 8309200: java/net/httpclient/ExecutorShutdown fails intermittently, if connection closed during upgrade [v3] In-Reply-To: References: Message-ID: > The ExecutorShutdown test has been observed failing intermittently, notably if by misfortune the shutdown sequence causes a connection to get aborted while upgrading. The issue is that the `ConnectionAborter` class that allows to mark the connection as being scheduled for closing before a handle to the connection is actually available isn't forwarding the original exception for which closing the connection was requested. When the connection is eventually closed, a generic `IOException: connection closed locally` is raised at the `SocketTube` level, which unfortunately can race with the original cause. > > The fix makes it possible to relay the original cause to the place where the IOException is raised, in order to set it as the cause of the new exception. Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: More review feedback ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14251/files - new: https://git.openjdk.org/jdk/pull/14251/files/5fb0731e..3d3597ae Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14251&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14251&range=01-02 Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/14251.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14251/head:pull/14251 PR: https://git.openjdk.org/jdk/pull/14251 From jpai at openjdk.org Fri Jun 2 10:59:05 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Fri, 2 Jun 2023 10:59:05 GMT Subject: RFR: 8309200: java/net/httpclient/ExecutorShutdown fails intermittently, if connection closed during upgrade [v3] In-Reply-To: References: Message-ID: <-7mvuio_pkzNl-CVy6rMLPJN8Oj80Q0KTRV1zetGWWM=.7f7724b3-4624-4b80-885f-57ad67ca84b6@github.com> On Fri, 2 Jun 2023 10:51:24 GMT, Daniel Fuchs wrote: >> The ExecutorShutdown test has been observed failing intermittently, notably if by misfortune the shutdown sequence causes a connection to get aborted while upgrading. The issue is that the `ConnectionAborter` class that allows to mark the connection as being scheduled for closing before a handle to the connection is actually available isn't forwarding the original exception for which closing the connection was requested. When the connection is eventually closed, a generic `IOException: connection closed locally` is raised at the `SocketTube` level, which unfortunately can race with the original cause. >> >> The fix makes it possible to relay the original cause to the place where the IOException is raised, in order to set it as the cause of the new exception. > > Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: > > More review feedback Thank you Daniel for the update. Looks good to me. ------------- Marked as reviewed by jpai (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14251#pullrequestreview-1457120562 From dfuchs at openjdk.org Fri Jun 2 14:38:15 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Fri, 2 Jun 2023 14:38:15 GMT Subject: Integrated: 8309200: java/net/httpclient/ExecutorShutdown fails intermittently, if connection closed during upgrade In-Reply-To: References: Message-ID: On Wed, 31 May 2023 16:52:02 GMT, Daniel Fuchs wrote: > The ExecutorShutdown test has been observed failing intermittently, notably if by misfortune the shutdown sequence causes a connection to get aborted while upgrading. The issue is that the `ConnectionAborter` class that allows to mark the connection as being scheduled for closing before a handle to the connection is actually available isn't forwarding the original exception for which closing the connection was requested. When the connection is eventually closed, a generic `IOException: connection closed locally` is raised at the `SocketTube` level, which unfortunately can race with the original cause. > > The fix makes it possible to relay the original cause to the place where the IOException is raised, in order to set it as the cause of the new exception. This pull request has now been integrated. Changeset: 931913fb Author: Daniel Fuchs URL: https://git.openjdk.org/jdk/commit/931913fbb299fbed7485ab8229100e6e56d8bada Stats: 63 lines in 7 files changed: 45 ins; 3 del; 15 mod 8309200: java/net/httpclient/ExecutorShutdown fails intermittently, if connection closed during upgrade Reviewed-by: jpai, djelinski ------------- PR: https://git.openjdk.org/jdk/pull/14251 From dfuchs at openjdk.org Fri Jun 2 17:06:12 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Fri, 2 Jun 2023 17:06:12 GMT Subject: RFR: 8304885: Reuse stale data to improve DNS resolver resiliency [v15] In-Reply-To: References: Message-ID: <7nABYFg2WeolHZuAWt05pTTbnsZqa1UrpaaTxvQUi_s=.ea06c2f0-9d7f-46cd-b6af-f75b537494d3@github.com> On Thu, 1 Jun 2023 21:28:23 GMT, Sergey Bylokhov wrote: >> I would like to get preliminary feedback about the provided patch. >> >> Discussion on net-dev@ https://mail.openjdk.org/pipermail/net-dev/2023-March/020682.html >> >> One of the main issue I try to solve is how the cache handle the intermittent DNS server outages due to overloading or network connection. >> >> At the moment this cache can be configured by the application using the following two properties: >> (1) "networkaddress.cache.ttl"(30 sec) - cache policy for successful lookups >> (2) "networkaddress.cache.negative.ttl"(10 sec) - cache policy for negative lookups >> >> The default timeout for positive responses is good enough to "have recent dns-records" and to "minimize the number of requests to the DNS server". >> >> But the cache for the negative responses is problematic. This is a problem I would like to solve. Caching the negative response means that for **10** seconds the application will not be able to connect to the server. >> >> Possible solutions: >> 1. Decreasing timeout "for the negative responses": unfortunately more requests to the server at the moment of "DNS-outage" cause even more issues, since this is not the right moment to load the network/server more. >> 2. Increasing timeout "for the positive responses": this will decrease the chance to get an error, but the cache will start to use stale data longer. >> 3. This proposal: it would be good to ignore the negative response and continue to use the result of the last "successful lookup" until some additional timeout. >> >> The idea is to split the notion of the TTL and the timeout used for the cache. When TTL for the record will expire we should request the new data from the server. If this request goes fine we will update the record, if it fails we will continue to use the cached date until the next sync. >> >> For example, if the new property "networkaddress.cache.extended.ttl" is set to 10 minutes, then we will cache a positive response for 10 minutes but will try to sync it every 30 seconds. If the new property is not set then as before we will cache positive for 30 seconds and then cache the negative response for 10 seconds. >> >> >> RFC 8767 Serving Stale Data to Improve DNS Resiliency: >> https://www.rfc-editor.org/rfc/rfc8767 >> >> Comments about current and other possible implementations: >> * The code intentionally moved to the separate ValidAddresses class, just to make clear that the default configuration, when the new property is not set is not changed much. >> * The refr... > > Sergey Bylokhov has updated the pull request incrementally with one additional commit since the last revision: > > Fix possible race in the SimpleResolverProviderImpl Thanks - with the latest changes the test appears to be stable. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13285#issuecomment-1574048850 From v-terrychow at microsoft.com Fri Jun 2 20:56:06 2023 From: v-terrychow at microsoft.com (Terry Chow (Simba Technologies Inc)) Date: Fri, 2 Jun 2023 20:56:06 +0000 Subject: Support for Keepalive Extended Socket Options On Windows Message-ID: Hi all, I'm Terry and I'm from the mssql-jdbc driver team. I'd like to propose some changes to JDK that would allow for keepalive extended socket options support for Windows in order maintain feature parity within the mssql-jdbc driver project. Currently, keepalive options are only supported on Linux and Mac. I did some research on this and there are some points to consider when implementing this change. On Windows, to set the keepalive values, we do so natively through the SIO_KEEPALIVE_VALS control code. The problem however is that the API requires that keepalive time and interval be configured at the same time. So, the semantics of SIO_KEEPALIVE_VALS are the same as TCP_KEEPIDLE + TCP_KEEPINTERVAL on other platforms -- setting keepalive values through SIO_KEEPALIVE_VALS is the same as setting it through TCP_KEEPIDLE + TCP_KEEPINTERVAL at once for other platforms. Another issue is that it's not possible to query the current keepalive values. However, there are system-wide default keepalive values. For keepalive time and interval on Windows, they're officially 2hrs and 1s respectively. But, it's possible these default values could be different. A possible idea I had was to introduce a new setOption that would set both keepalive values at the same time and reuse existing options in the JDK. So, something like below would be valid across all platforms. eg. socket.setOption(ExtendedSocketOptions.TCP_KEEPIDLE, 30, ExtendedSocketOptions.TCP_KEEPINTERVAL, 30); Another idea was to introduce a new Windows and JDK specific socket option. Earlier in the week I prematurely submitted a PR for this, apologies for that (I went through my org in order to submit a PR and thought dialog for something like this happens after). Relevant links: https://bugs.openjdk.org/browse/JDK-8308593 https://learn.microsoft.com/en-us/windows/win32/winsock/sio-keepalive-vals https://learn.microsoft.com/en-us/windows/win32/winsock/sio-keepalive-vals#remarks https://stackoverflow.com/questions/14197347/how-to-query-socket-keep-alive-values-using-winsock/14198462#14198462 https://stackoverflow.com/questions/18391341/reading-sio-keepalive-vals-fields-on-a-windows-socket-for-keepalive-idle-and-in Any feedback and guidance on how this should be approached is appreciated. Thanks, Terry -------------- next part -------------- An HTML attachment was scrubbed... URL: From Alan.Bateman at oracle.com Sat Jun 3 07:19:10 2023 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Sat, 3 Jun 2023 08:19:10 +0100 Subject: Support for Keepalive Extended Socket Options On Windows In-Reply-To: References: Message-ID: <185edc7f-437d-5a75-35ef-6e39a38c9210@oracle.com> On 02/06/2023 21:56, Terry Chow (Simba Technologies Inc) wrote: > Hi all, > > I'm Terry and I'm from the mssql-jdbc driver team. I'd like to propose > some changes to JDK that would allow for keepalive extended socket > options support for Windows in order maintain feature parity within > the mssql-jdbc driver project. Currently, keepalive options are only > supported on Linux and Mac. > Just curious if your team has lobbied the Windows folks to provide the equivalent of? the TCP_KEEPIDLE and TCP_KEEPINTERVAL options so they work like other platforms? There is exploration in PR14232 on implementation these socket options with SIO_KEEPALIVE_VALS but it will require disruptive changes in order to make them to existing APIs. -Alan -------------- next part -------------- An HTML attachment was scrubbed... URL: From jpai at openjdk.org Sun Jun 4 09:40:25 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Sun, 4 Jun 2023 09:40:25 GMT Subject: RFR: 8309409: Update HttpInputStreamTest and BodyProcessorInputStreamTest to use hg.openjdk.org Message-ID: Can I please get a review of this test-only change which updates these manual tests to use `https://hg.openjdk.org` instead of `http://hg.openjdk.java.net`? I've run these manual tests locally and they now pass with this change. ------------- Commit messages: - 8309409: Update HttpInputStreamTest and BodyProcessorInputStreamTest to use hg.openjdk.org Changes: https://git.openjdk.org/jdk/pull/14302/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14302&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8309409 Stats: 4 lines in 2 files changed: 0 ins; 0 del; 4 mod Patch: https://git.openjdk.org/jdk/pull/14302.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14302/head:pull/14302 PR: https://git.openjdk.org/jdk/pull/14302 From dfuchs at openjdk.org Sun Jun 4 09:44:04 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Sun, 4 Jun 2023 09:44:04 GMT Subject: RFR: 8309409: Update HttpInputStreamTest and BodyProcessorInputStreamTest to use hg.openjdk.org In-Reply-To: References: Message-ID: On Sun, 4 Jun 2023 09:33:43 GMT, Jaikiran Pai wrote: > Can I please get a review of this test-only change which updates these manual tests to use `https://hg.openjdk.org` instead of `http://hg.openjdk.java.net`? > > I've run these manual tests locally and they now pass with this change. Thanks for noticing that Jaikiran. LGTM! ------------- Marked as reviewed by dfuchs (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14302#pullrequestreview-1461073358 From daniel.fuchs at oracle.com Sun Jun 4 09:49:21 2023 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Sun, 4 Jun 2023 10:49:21 +0100 Subject: Support for Keepalive Extended Socket Options On Windows In-Reply-To: <185edc7f-437d-5a75-35ef-6e39a38c9210@oracle.com> References: <185edc7f-437d-5a75-35ef-6e39a38c9210@oracle.com> Message-ID: <8e0c41f8-f4fa-334f-c5d3-3d42b84a21d0@oracle.com> Hi, Could we maybe cache the values in the SocketImpl/NIOSocketImpl implementation? IIRC we do something like that for SO_TIMEOUT already, since this is handled at NIO level. If we know the default value then setting one (when the other is not set) could set it with the supplied value for the one, and the default (or cached value) for the other? Get would then return the cached value (or possibly default value if not set?) We could also potentially set some sensible defaults when creating the socket. Just some ideas.. best regards, -- daniel On 03/06/2023 08:19, Alan Bateman wrote: > On 02/06/2023 21:56, Terry Chow (Simba Technologies Inc) wrote: >> Hi all, >> >> I'm Terry and I'm from the mssql-jdbc driver team. I'd like to propose >> some changes to JDK that would allow for keepalive extended socket >> options support for Windows in order maintain feature parity within >> the mssql-jdbc driver project. Currently, keepalive options are only >> supported on Linux and Mac. >> > Just curious if your team has lobbied the Windows folks to provide the > equivalent of? the TCP_KEEPIDLE and TCP_KEEPINTERVAL options so they > work like other platforms? > > There is exploration in PR14232 on implementation these socket options > with SIO_KEEPALIVE_VALS but it will require disruptive changes in order > to make them to existing APIs. > > -Alan From jpai at openjdk.org Sun Jun 4 09:52:11 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Sun, 4 Jun 2023 09:52:11 GMT Subject: RFR: 8309409: Update HttpInputStreamTest and BodyProcessorInputStreamTest to use hg.openjdk.org In-Reply-To: References: Message-ID: <7Sq1csWxO_SiBpopmy2_G8W_3dZbCzmKRpNLwUCElMI=.3ccd066b-52d8-4f26-914c-733720515596@github.com> On Sun, 4 Jun 2023 09:33:43 GMT, Jaikiran Pai wrote: > Can I please get a review of this test-only change which updates these manual tests to use `https://hg.openjdk.org` instead of `http://hg.openjdk.java.net`? > > I've run these manual tests locally and they now pass with this change. Thank you Daniel for the quick review. Given that these are manual tests that don't get run in the CI (or github actions) and now that they are passing locally, I'll go ahead and integrate this PR. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14302#issuecomment-1575493076 From jpai at openjdk.org Sun Jun 4 09:52:12 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Sun, 4 Jun 2023 09:52:12 GMT Subject: Integrated: 8309409: Update HttpInputStreamTest and BodyProcessorInputStreamTest to use hg.openjdk.org In-Reply-To: References: Message-ID: On Sun, 4 Jun 2023 09:33:43 GMT, Jaikiran Pai wrote: > Can I please get a review of this test-only change which updates these manual tests to use `https://hg.openjdk.org` instead of `http://hg.openjdk.java.net`? > > I've run these manual tests locally and they now pass with this change. This pull request has now been integrated. Changeset: ac1597bc Author: Jaikiran Pai URL: https://git.openjdk.org/jdk/commit/ac1597bcc7a81db0b81e82a3faf50e73932764c2 Stats: 4 lines in 2 files changed: 0 ins; 0 del; 4 mod 8309409: Update HttpInputStreamTest and BodyProcessorInputStreamTest to use hg.openjdk.org Reviewed-by: dfuchs ------------- PR: https://git.openjdk.org/jdk/pull/14302 From Alan.Bateman at oracle.com Sun Jun 4 14:32:16 2023 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Sun, 4 Jun 2023 15:32:16 +0100 Subject: Support for Keepalive Extended Socket Options On Windows In-Reply-To: <8e0c41f8-f4fa-334f-c5d3-3d42b84a21d0@oracle.com> References: <185edc7f-437d-5a75-35ef-6e39a38c9210@oracle.com> <8e0c41f8-f4fa-334f-c5d3-3d42b84a21d0@oracle.com> Message-ID: On 04/06/2023 10:49, Daniel Fuchs wrote: > Hi, > > Could we maybe cache the values in the SocketImpl/NIOSocketImpl > implementation? > > IIRC we do something like that for SO_TIMEOUT already, since this > is handled at NIO level. > > If we know the default value then setting one (when the other is > not set) could set it with the supplied value for the one, and > the default (or cached value) for the other? > > Get would then return the cached value (or possibly default > value if not set?) > > We could also potentially set some sensible defaults when creating > the socket. > Yes, this is what I was suggesting in PR14232 too but it will likely be a disruptive change. It can be prototyped at least, then we can see how we could turn it into something that is maintainable. The best outcome would of course be for Windows to expose the socket options in the same way as Linux, macOS and others. -Alan From clanger at openjdk.org Mon Jun 5 11:51:05 2023 From: clanger at openjdk.org (Christoph Langer) Date: Mon, 5 Jun 2023 11:51:05 GMT Subject: RFR: JDK-8309340: Provide sctpHandleSocketErrorWithMessage In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 08:03:01 GMT, Matthias Baesken wrote: > There are cases in the sctp coding where a function sctpHandleSocketErrorWithMessage would be beneficial (similar to existing handleSocketErrorWithMessage) to provide more detail what failed. > > Additionally sctpHandleSocketErrorWithMessage was a bit modified (added errno handling for ENOTCONN from handleSocketErrorWithMessage). LGTM ------------- Marked as reviewed by clanger (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14280#pullrequestreview-1462355243 From v-terrychow at microsoft.com Mon Jun 5 19:52:20 2023 From: v-terrychow at microsoft.com (Terry Chow (Simba Technologies Inc)) Date: Mon, 5 Jun 2023 19:52:20 +0000 Subject: [EXTERNAL] Re: Support for Keepalive Extended Socket Options On Windows In-Reply-To: References: <185edc7f-437d-5a75-35ef-6e39a38c9210@oracle.com> <8e0c41f8-f4fa-334f-c5d3-3d42b84a21d0@oracle.com> Message-ID: Hi Alan and Daniel, Agreed, having Windows support the keepalive options as it's done on other platforms would be the best. But, lobbying them for that change would be extremely difficult as it would be very significant change that impacts the whole platform. What defaults values do you guys have in mind? I'm still hesitating on persisting default values because the default values can vary between machines. Thanks, Terry ________________________________ From: Alan Bateman Sent: June 4, 2023 7:32 AM To: Daniel Fuchs ; Terry Chow (Simba Technologies Inc) ; net-dev at openjdk.org Subject: [EXTERNAL] Re: Support for Keepalive Extended Socket Options On Windows [You don't often get email from alan.bateman at oracle.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ] On 04/06/2023 10:49, Daniel Fuchs wrote: > Hi, > > Could we maybe cache the values in the SocketImpl/NIOSocketImpl > implementation? > > IIRC we do something like that for SO_TIMEOUT already, since this > is handled at NIO level. > > If we know the default value then setting one (when the other is > not set) could set it with the supplied value for the one, and > the default (or cached value) for the other? > > Get would then return the cached value (or possibly default > value if not set?) > > We could also potentially set some sensible defaults when creating > the socket. > Yes, this is what I was suggesting in PR14232 too but it will likely be a disruptive change. It can be prototyped at least, then we can see how we could turn it into something that is maintainable. The best outcome would of course be for Windows to expose the socket options in the same way as Linux, macOS and others. -Alan -------------- next part -------------- An HTML attachment was scrubbed... URL: From duke at openjdk.org Tue Jun 6 06:06:51 2023 From: duke at openjdk.org (Deepa Kumari) Date: Tue, 6 Jun 2023 06:06:51 GMT Subject: RFR: 8308807: [AIX] MulticastSocket and jdp test fails due to joinGroup In-Reply-To: References: <4tkYKvpBoxO7IK4HevAqpEY5KoqxXUK6rs0scqyxgJc=.69de9b21-5a2f-45ef-b05f-1bc8ad398dad@github.com> Message-ID: On Thu, 25 May 2023 07:37:27 GMT, Alan Bateman wrote: >> DatagramSocket delegates to an inner DatagramSocket object. Irrespective of whether datagramSocket is IPv4 or IPv6, we create an IPv6 datagramChannel as its's delegate. So, This can cause problems with operations like joinGroup. >> >> On AIX, IPv6 datagramSocket can not join an IPv4 multicast group. >> >> These failures can be fixed by making sure that the delegate created for a datagram socket has the same protocol family. >> >> >> >> >> Reported Issue : [JDK-8308807](https://bugs.openjdk.org/browse/JDK-8308807) > > I've moved the JBS issue to the right place and fix the description. > > The changes proposed here impact all platforms and will require discussion and cleanup. If I understand the intent, if you create a DatagramSocket or MulticastSocket that is bound to a specific local address then you want to use that to determine if the underlying socket is IPv4 or IPv6. That might be okay but multicasting normally means binding to the wildcard address so it doesn't help - I assume it only works for the test because new InetSocketAddress(port).getAddress() returns an Inet4Address so you get an IPv4 socket. It should only create a dual IPv4/IPv6 socket for this case so this is why it will break other platforms. In any case, can you look at the isXXX methods defined by sun.nio.ch.Net to see how it is handled on other platforms. Yes, I agree with @AlanBateman and @msheppar . Even when we try to have an IPv4 multicast socket join an IPv4 multicast group, we still fail because the delegate that is created for an IPv4 multicast socket is IPv4/IPv6 (dual stack) in nature. AIX does not allow dual stack (IPv4/IPv6) sockets to join IPv4 multicast groups. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14142#issuecomment-1577968863 From mbaesken at openjdk.org Tue Jun 6 07:12:02 2023 From: mbaesken at openjdk.org (Matthias Baesken) Date: Tue, 6 Jun 2023 07:12:02 GMT Subject: RFR: JDK-8309340: Provide sctpHandleSocketErrorWithMessage In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 08:03:01 GMT, Matthias Baesken wrote: > There are cases in the sctp coding where a function sctpHandleSocketErrorWithMessage would be beneficial (similar to existing handleSocketErrorWithMessage) to provide more detail what failed. > > Additionally sctpHandleSocketErrorWithMessage was a bit modified (added errno handling for ENOTCONN from handleSocketErrorWithMessage). Hi Christoph, thanks for the review ! ------------- PR Comment: https://git.openjdk.org/jdk/pull/14280#issuecomment-1578046570 From mbaesken at openjdk.org Tue Jun 6 07:12:02 2023 From: mbaesken at openjdk.org (Matthias Baesken) Date: Tue, 6 Jun 2023 07:12:02 GMT Subject: Integrated: JDK-8309340: Provide sctpHandleSocketErrorWithMessage In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 08:03:01 GMT, Matthias Baesken wrote: > There are cases in the sctp coding where a function sctpHandleSocketErrorWithMessage would be beneficial (similar to existing handleSocketErrorWithMessage) to provide more detail what failed. > > Additionally sctpHandleSocketErrorWithMessage was a bit modified (added errno handling for ENOTCONN from handleSocketErrorWithMessage). This pull request has now been integrated. Changeset: 3b85f84f Author: Matthias Baesken URL: https://git.openjdk.org/jdk/commit/3b85f84f026973a2abdbce8d9baf1329c8a4ebf8 Stats: 20 lines in 2 files changed: 11 ins; 2 del; 7 mod 8309340: Provide sctpHandleSocketErrorWithMessage Reviewed-by: clanger ------------- PR: https://git.openjdk.org/jdk/pull/14280 From alanb at openjdk.org Tue Jun 6 07:19:03 2023 From: alanb at openjdk.org (Alan Bateman) Date: Tue, 6 Jun 2023 07:19:03 GMT Subject: RFR: JDK-8309340: Provide sctpHandleSocketErrorWithMessage In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 08:03:01 GMT, Matthias Baesken wrote: > There are cases in the sctp coding where a function sctpHandleSocketErrorWithMessage would be beneficial (similar to existing handleSocketErrorWithMessage) to provide more detail what failed. > > Additionally sctpHandleSocketErrorWithMessage was a bit modified (added errno handling for ENOTCONN from handleSocketErrorWithMessage). I see this was integrated without a reviewer in the area but I think the changes are okay. src/jdk.sctp/unix/native/libsctp/SctpNet.c line 147: > 145: errno = errorValue; > 146: if (message == NULL) { > 147: JNU_ThrowByNameWithLastError(env, xn, "NioSocketError"); "NioSocketError" is confusing as the failing message, maybe we should change that. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14280#issuecomment-1578057691 PR Review Comment: https://git.openjdk.org/jdk/pull/14280#discussion_r1219054386 From mbaesken at openjdk.org Tue Jun 6 07:24:01 2023 From: mbaesken at openjdk.org (Matthias Baesken) Date: Tue, 6 Jun 2023 07:24:01 GMT Subject: RFR: JDK-8309340: Provide sctpHandleSocketErrorWithMessage In-Reply-To: References: Message-ID: On Tue, 6 Jun 2023 07:16:13 GMT, Alan Bateman wrote: > I see this was integrated without a reviewer in the area but I think the changes are okay. Hi Alan, I think Christoph is very competent in the area. But should I look into the census next time for some special reviewer category (and which one would that be) ? ------------- PR Comment: https://git.openjdk.org/jdk/pull/14280#issuecomment-1578063861 From alanb at openjdk.org Tue Jun 6 07:28:55 2023 From: alanb at openjdk.org (Alan Bateman) Date: Tue, 6 Jun 2023 07:28:55 GMT Subject: RFR: 8308807: [AIX] MulticastSocket and jdp test fails due to joinGroup In-Reply-To: References: <4tkYKvpBoxO7IK4HevAqpEY5KoqxXUK6rs0scqyxgJc=.69de9b21-5a2f-45ef-b05f-1bc8ad398dad@github.com> Message-ID: On Thu, 25 May 2023 07:37:27 GMT, Alan Bateman wrote: >> DatagramSocket delegates to an inner DatagramSocket object. Irrespective of whether datagramSocket is IPv4 or IPv6, we create an IPv6 datagramChannel as its's delegate. So, This can cause problems with operations like joinGroup. >> >> On AIX, IPv6 datagramSocket can not join an IPv4 multicast group. >> >> These failures can be fixed by making sure that the delegate created for a datagram socket has the same protocol family. >> >> >> >> >> Reported Issue : [JDK-8308807](https://bugs.openjdk.org/browse/JDK-8308807) > > I've moved the JBS issue to the right place and fix the description. > > The changes proposed here impact all platforms and will require discussion and cleanup. If I understand the intent, if you create a DatagramSocket or MulticastSocket that is bound to a specific local address then you want to use that to determine if the underlying socket is IPv4 or IPv6. That might be okay but multicasting normally means binding to the wildcard address so it doesn't help - I assume it only works for the test because new InetSocketAddress(port).getAddress() returns an Inet4Address so you get an IPv4 socket. It should only create a dual IPv4/IPv6 socket for this case so this is why it will break other platforms. In any case, can you look at the isXXX methods defined by sun.nio.ch.Net to see how it is handled on other platforms. > Yes, I agree with @AlanBateman and @msheppar . Even when we try to have an IPv4 multicast socket join an IPv4 multicast group, we still fail because the delegate that is created for an IPv4 multicast socket is IPv4/IPv6 (dual stack) in nature. AIX does not allow dual stack (IPv4/IPv6) sockets to join IPv4 multicast groups. The "Platform dependencies" in java.nio.channels.MulticastChannel (implemented by DatagramChannel) makes it clear that it is implementation specific as to whether a channel to an IPv6 socket can join an IPv4 multicast group. The recommendation is to specify the protocol family when creating the channel. Legacy DatagramSocket/MulticastSocket do not define a constructor that allows the protocol family be specified at xxxSocket create time. That issue has been there since JDK 1.4 when IPv6 support was added. I'm curious why this might be coming up with AIX now. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14142#issuecomment-1578072460 From alanb at openjdk.org Tue Jun 6 07:35:07 2023 From: alanb at openjdk.org (Alan Bateman) Date: Tue, 6 Jun 2023 07:35:07 GMT Subject: RFR: JDK-8309340: Provide sctpHandleSocketErrorWithMessage In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 08:03:01 GMT, Matthias Baesken wrote: > There are cases in the sctp coding where a function sctpHandleSocketErrorWithMessage would be beneficial (similar to existing handleSocketErrorWithMessage) to provide more detail what failed. > > Additionally sctpHandleSocketErrorWithMessage was a bit modified (added errno handling for ENOTCONN from handleSocketErrorWithMessage). The SCTP API/implementation is the networking area, "net" group in the census. We usually try to get a Reviewer from that area for changes to the networking code. It's not an issue here, just mentioning it. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14280#issuecomment-1578082485 From dfuchs at openjdk.org Tue Jun 6 08:54:01 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Tue, 6 Jun 2023 08:54:01 GMT Subject: RFR: JDK-8309340: Provide sctpHandleSocketErrorWithMessage In-Reply-To: References: Message-ID: On Fri, 2 Jun 2023 08:03:01 GMT, Matthias Baesken wrote: > There are cases in the sctp coding where a function sctpHandleSocketErrorWithMessage would be beneficial (similar to existing handleSocketErrorWithMessage) to provide more detail what failed. > > Additionally sctpHandleSocketErrorWithMessage was a bit modified (added errno handling for ENOTCONN from handleSocketErrorWithMessage). FWIW the changes look good to me. ------------- PR Review: https://git.openjdk.org/jdk/pull/14280#pullrequestreview-1464641236 From mbaesken at openjdk.org Tue Jun 6 10:41:01 2023 From: mbaesken at openjdk.org (Matthias Baesken) Date: Tue, 6 Jun 2023 10:41:01 GMT Subject: RFR: JDK-8309340: Provide sctpHandleSocketErrorWithMessage In-Reply-To: References: Message-ID: On Tue, 6 Jun 2023 08:51:33 GMT, Daniel Fuchs wrote: > FWIW the changes look good to me. Thanks for looking into it. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14280#issuecomment-1578414732 From mbaesken at openjdk.org Tue Jun 6 10:41:04 2023 From: mbaesken at openjdk.org (Matthias Baesken) Date: Tue, 6 Jun 2023 10:41:04 GMT Subject: RFR: JDK-8309340: Provide sctpHandleSocketErrorWithMessage In-Reply-To: References: Message-ID: On Tue, 6 Jun 2023 07:15:08 GMT, Alan Bateman wrote: >> There are cases in the sctp coding where a function sctpHandleSocketErrorWithMessage would be beneficial (similar to existing handleSocketErrorWithMessage) to provide more detail what failed. >> >> Additionally sctpHandleSocketErrorWithMessage was a bit modified (added errno handling for ENOTCONN from handleSocketErrorWithMessage). > > src/jdk.sctp/unix/native/libsctp/SctpNet.c line 147: > >> 145: errno = errorValue; >> 146: if (message == NULL) { >> 147: JNU_ThrowByNameWithLastError(env, xn, "NioSocketError"); > > "NioSocketError" is confusing as the failing message, maybe we should change that. Hi Alan, do you have a good suggestion what to use instead ? Maybe "SCTP socket error" ? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14280#discussion_r1219391449 From djelinski at openjdk.org Tue Jun 6 10:52:50 2023 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Tue, 6 Jun 2023 10:52:50 GMT Subject: RFR: 8309527: Improve test proxy performance Message-ID: Please review this change to introduce buffering in the tunnelling proxy implementations. Copying network data one byte at a time is very inefficient. ProxyAuthDisabledSchemesSSL is 10 seconds faster (from 40 down to 30s) on my Windows machine with these changes. I did not quantify the improvements in other tests affected by this change; I only verified that they continue to pass. ------------- Commit messages: - Update copyright - Buffer transferred data Changes: https://git.openjdk.org/jdk/pull/14329/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14329&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8309527 Stats: 29 lines in 5 files changed: 5 ins; 0 del; 24 mod Patch: https://git.openjdk.org/jdk/pull/14329.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14329/head:pull/14329 PR: https://git.openjdk.org/jdk/pull/14329 From daniel.fuchs at oracle.com Tue Jun 6 11:22:21 2023 From: daniel.fuchs at oracle.com (Daniel Fuchs) Date: Tue, 6 Jun 2023 12:22:21 +0100 Subject: [EXTERNAL] Re: Support for Keepalive Extended Socket Options On Windows In-Reply-To: References: <185edc7f-437d-5a75-35ef-6e39a38c9210@oracle.com> <8e0c41f8-f4fa-334f-c5d3-3d42b84a21d0@oracle.com> Message-ID: Hi Terry, I'm not sure what would be a good default value, but it could possibly be controlled by a system property allowing to override whatever we pick. best regards, -- daniel On 05/06/2023 20:52, Terry Chow (Simba Technologies Inc) wrote: > Hi Alan and Daniel, > > Agreed, having Windows support the keepalive options as it's done on > other platforms would be the best. But, lobbying them for that change > would be extremely difficult as it would be very significant change that > impacts the whole platform. > > What defaults values do you guys have in mind? I'm still hesitating on > persisting default values because the default values can vary between > machines. > > Thanks, > Terry > ------------------------------------------------------------------------ > *From:* Alan Bateman > *Sent:* June 4, 2023 7:32 AM > *To:* Daniel Fuchs ; Terry Chow (Simba > Technologies Inc) ; net-dev at openjdk.org > > *Subject:* [EXTERNAL] Re: Support for Keepalive Extended Socket Options > On Windows > [You don't often get email from alan.bateman at oracle.com. Learn why this > is important at https://aka.ms/LearnAboutSenderIdentification > ] > > On 04/06/2023 10:49, Daniel Fuchs wrote: >> Hi, >> >> Could we maybe cache the values in the SocketImpl/NIOSocketImpl >> implementation? >> >> IIRC we do something like that for SO_TIMEOUT already, since this >> is handled at NIO level. >> >> If we know the default value then setting one (when the other is >> not set) could set it with the supplied value for the one, and >> the default (or cached value) for the other? >> >> Get would then return the cached value (or possibly default >> value if not set?) >> >> We could also potentially set some sensible defaults when creating >> the socket. >> > Yes, this is what I was suggesting in PR14232 too but it will likely be > a disruptive change. It can be prototyped at least, then we can see how > we could turn it into something that is maintainable. The best outcome > would of course be for Windows to expose the socket options in the same > way as Linux, macOS and others. > > -Alan From dfuchs at openjdk.org Tue Jun 6 11:52:50 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Tue, 6 Jun 2023 11:52:50 GMT Subject: RFR: 8309527: Improve test proxy performance In-Reply-To: References: Message-ID: On Tue, 6 Jun 2023 09:19:20 GMT, Daniel Jeli?ski wrote: > Please review this change to introduce buffering in the tunnelling proxy implementations. > > Copying network data one byte at a time is very inefficient. ProxyAuthDisabledSchemesSSL is 10 seconds faster (from 40 down to 30s) on my Windows machine with these changes. > > I did not quantify the improvements in other tests affected by this change; I only verified that they continue to pass. Good finding! ------------- Marked as reviewed by dfuchs (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14329#pullrequestreview-1464996226 From dfuchs at openjdk.org Tue Jun 6 14:51:55 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Tue, 6 Jun 2023 14:51:55 GMT Subject: RFR: 8305763 : Parsing a URI with an underscore goes through a silent exception, negatively impacting performance In-Reply-To: References: Message-ID: On Tue, 16 May 2023 17:20:08 GMT, Dhamoder Nalla wrote: >>> I will work on addressing this to keep the old behavior unchanged. >> >> Please make sure to run the java/net/URI tests - and when these are successful, tier1, tier2 and tier3. > > Thanks @dfuch, > I have validated the following tests with the new change. > 1. JShell: > jshell> new URI("http://foo_bar:8080/").getHost() > $1 ==> null > > jshell> new URI("http://foo_bar:8080/").getPort() > $2 ==> -1 > > jshell> new URI("http://foobar:8080/").getHost() > $3 ==> "foobar" > > jshell> new URI("http://foobar:8080/").getPort() > $4 ==> 8080 > 2. all tests under "java/net/URI" passed as expected. > 3. no failures related my change in tier1, tier2 and tier3 tests. @dhanalla if you integrate this change I will sponsor it. Alternatively if you'd prefer to wait until after the fork that's fine by me. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13430#issuecomment-1578912063 From dfuchs at openjdk.org Tue Jun 6 14:56:53 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Tue, 6 Jun 2023 14:56:53 GMT Subject: RFR: 8305906: HttpClient may use incorrect key when finding pooled HTTP/2 connection for IPv6 address [v3] In-Reply-To: References: <3b7IrpY4XC5OYB3SWQ2O1xH_ZUdOn2TDhr1y8h2M2Uw=.0e4b095a-c071-444c-9f67-62b2611e7977@github.com> Message-ID: On Fri, 21 Apr 2023 01:26:35 GMT, Jaikiran Pai wrote: >> Can I please get a review of this change which proposes to fix the issue reported in https://bugs.openjdk.org/browse/JDK-8305906? >> >> As noted in that issue, when IPv6 hosts are involved, the HttpClient on certain occasions can end up caching the connection with a key which doesn't match with the key which is then used in a subsequent request against the same target host. >> >> The commit in this PR now wraps the IPv6 address in a square bracket consistently so that the correct key is used both during storing the connection in the pool and when looking up. >> >> A new jtreg test has been added which reproduces this issue without the fix and verifies the fix. > > Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: > > wrapping into brackets is no longer needed Marked as reviewed by dfuchs (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/13456#pullrequestreview-1465411030 From duke at openjdk.org Tue Jun 6 15:55:56 2023 From: duke at openjdk.org (Dhamoder Nalla) Date: Tue, 6 Jun 2023 15:55:56 GMT Subject: RFR: 8305763 : Parsing a URI with an underscore goes through a silent exception, negatively impacting performance In-Reply-To: References: Message-ID: On Tue, 6 Jun 2023 14:49:23 GMT, Daniel Fuchs wrote: >> Thanks @dfuch, >> I have validated the following tests with the new change. >> 1. JShell: >> jshell> new URI("http://foo_bar:8080/").getHost() >> $1 ==> null >> >> jshell> new URI("http://foo_bar:8080/").getPort() >> $2 ==> -1 >> >> jshell> new URI("http://foobar:8080/").getHost() >> $3 ==> "foobar" >> >> jshell> new URI("http://foobar:8080/").getPort() >> $4 ==> 8080 >> 2. all tests under "java/net/URI" passed as expected. >> 3. no failures related my change in tier1, tier2 and tier3 tests. > > @dhanalla if you integrate this change I will sponsor it. Alternatively if you'd prefer to wait until after the fork that's fine by me. @dfuch, Thank you for review and sponsorship. I submitted for integration. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13430#issuecomment-1579029509 From v-terrychow at microsoft.com Tue Jun 6 22:42:45 2023 From: v-terrychow at microsoft.com (Terry Chow (Simba Technologies Inc)) Date: Tue, 6 Jun 2023 22:42:45 +0000 Subject: [EXTERNAL] Re: Support for Keepalive Extended Socket Options On Windows In-Reply-To: References: <185edc7f-437d-5a75-35ef-6e39a38c9210@oracle.com> <8e0c41f8-f4fa-334f-c5d3-3d42b84a21d0@oracle.com> Message-ID: Hi Daniel, That sounds good. I like the idea of using a system property to override the defaults just in case. For the starting default values, 2hrs and 1s for idle time and interval time respectively are the officially documented defaults. So, we could start with these. Just to reiterate, to start off with the prototype: 1. Persist default values at the socket level in either SocketImpl or NIOSocketImpl 2. Allow default values to be overridden through system properties 3. Starting default values for idle time and interval time will be 2hrs and 1s Let me know if that's acceptable or if there's more to add. Thanks, Terry ________________________________ From: Daniel Fuchs Sent: June 6, 2023 4:22 AM To: Terry Chow (Simba Technologies Inc) ; Alan Bateman ; net-dev at openjdk.org Subject: Re: [EXTERNAL] Re: Support for Keepalive Extended Socket Options On Windows [You don't often get email from daniel.fuchs at oracle.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ] Hi Terry, I'm not sure what would be a good default value, but it could possibly be controlled by a system property allowing to override whatever we pick. best regards, -- daniel On 05/06/2023 20:52, Terry Chow (Simba Technologies Inc) wrote: > Hi Alan and Daniel, > > Agreed, having Windows support the keepalive options as it's done on > other platforms would be the best. But, lobbying them for that change > would be extremely difficult as it would be very significant change that > impacts the whole platform. > > What defaults values do you guys have in mind? I'm still hesitating on > persisting default values because the default values can vary between > machines. > > Thanks, > Terry > ------------------------------------------------------------------------ > *From:* Alan Bateman > *Sent:* June 4, 2023 7:32 AM > *To:* Daniel Fuchs ; Terry Chow (Simba > Technologies Inc) ; net-dev at openjdk.org > > *Subject:* [EXTERNAL] Re: Support for Keepalive Extended Socket Options > On Windows > [You don't often get email from alan.bateman at oracle.com. Learn why this > is important at https://aka.ms/LearnAboutSenderIdentification > ] > > On 04/06/2023 10:49, Daniel Fuchs wrote: >> Hi, >> >> Could we maybe cache the values in the SocketImpl/NIOSocketImpl >> implementation? >> >> IIRC we do something like that for SO_TIMEOUT already, since this >> is handled at NIO level. >> >> If we know the default value then setting one (when the other is >> not set) could set it with the supplied value for the one, and >> the default (or cached value) for the other? >> >> Get would then return the cached value (or possibly default >> value if not set?) >> >> We could also potentially set some sensible defaults when creating >> the socket. >> > Yes, this is what I was suggesting in PR14232 too but it will likely be > a disruptive change. It can be prototyped at least, then we can see how > we could turn it into something that is maintainable. The best outcome > would of course be for Windows to expose the socket options in the same > way as Linux, macOS and others. > > -Alan -------------- next part -------------- An HTML attachment was scrubbed... URL: From jpai at openjdk.org Wed Jun 7 01:02:48 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Wed, 7 Jun 2023 01:02:48 GMT Subject: RFR: 8305906: HttpClient may use incorrect key when finding pooled HTTP/2 connection for IPv6 address [v4] In-Reply-To: <3b7IrpY4XC5OYB3SWQ2O1xH_ZUdOn2TDhr1y8h2M2Uw=.0e4b095a-c071-444c-9f67-62b2611e7977@github.com> References: <3b7IrpY4XC5OYB3SWQ2O1xH_ZUdOn2TDhr1y8h2M2Uw=.0e4b095a-c071-444c-9f67-62b2611e7977@github.com> Message-ID: > Can I please get a review of this change which proposes to fix the issue reported in https://bugs.openjdk.org/browse/JDK-8305906? > > As noted in that issue, when IPv6 hosts are involved, the HttpClient on certain occasions can end up caching the connection with a key which doesn't match with the key which is then used in a subsequent request against the same target host. > > The commit in this PR now wraps the IPv6 address in a square bracket consistently so that the correct key is used both during storing the connection in the pool and when looking up. > > A new jtreg test has been added which reproduces this issue without the fix and verifies the fix. Jaikiran Pai has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision: - Merge latest master branch changes - wrapping into brackets is no longer needed - use HttpRequestImpl.getAddress() to lookup cache key instead of HttpRequestImpl.getURI() - 8305906: HttpClient may use incorrect key when finding pooled HTTP/2 connection for IPv6 address ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13456/files - new: https://git.openjdk.org/jdk/pull/13456/files/96b92659..6db0ea8c Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13456&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13456&range=02-03 Stats: 496381 lines in 5623 files changed: 413148 ins; 40702 del; 42531 mod Patch: https://git.openjdk.org/jdk/pull/13456.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13456/head:pull/13456 PR: https://git.openjdk.org/jdk/pull/13456 From serb at openjdk.org Wed Jun 7 04:18:01 2023 From: serb at openjdk.org (Sergey Bylokhov) Date: Wed, 7 Jun 2023 04:18:01 GMT Subject: RFR: 8304885: Reuse stale data to improve DNS resolver resiliency [v15] In-Reply-To: References: Message-ID: On Thu, 1 Jun 2023 21:28:23 GMT, Sergey Bylokhov wrote: >> I would like to get preliminary feedback about the provided patch. >> >> Discussion on net-dev@ https://mail.openjdk.org/pipermail/net-dev/2023-March/020682.html >> >> One of the main issue I try to solve is how the cache handle the intermittent DNS server outages due to overloading or network connection. >> >> At the moment this cache can be configured by the application using the following two properties: >> (1) "networkaddress.cache.ttl"(30 sec) - cache policy for successful lookups >> (2) "networkaddress.cache.negative.ttl"(10 sec) - cache policy for negative lookups >> >> The default timeout for positive responses is good enough to "have recent dns-records" and to "minimize the number of requests to the DNS server". >> >> But the cache for the negative responses is problematic. This is a problem I would like to solve. Caching the negative response means that for **10** seconds the application will not be able to connect to the server. >> >> Possible solutions: >> 1. Decreasing timeout "for the negative responses": unfortunately more requests to the server at the moment of "DNS-outage" cause even more issues, since this is not the right moment to load the network/server more. >> 2. Increasing timeout "for the positive responses": this will decrease the chance to get an error, but the cache will start to use stale data longer. >> 3. This proposal: it would be good to ignore the negative response and continue to use the result of the last "successful lookup" until some additional timeout. >> >> The idea is to split the notion of the TTL and the timeout used for the cache. When TTL for the record will expire we should request the new data from the server. If this request goes fine we will update the record, if it fails we will continue to use the cached date until the next sync. >> >> For example, if the new property "networkaddress.cache.extended.ttl" is set to 10 minutes, then we will cache a positive response for 10 minutes but will try to sync it every 30 seconds. If the new property is not set then as before we will cache positive for 30 seconds and then cache the negative response for 10 seconds. >> >> >> RFC 8767 Serving Stale Data to Improve DNS Resiliency: >> https://www.rfc-editor.org/rfc/rfc8767 >> >> Comments about current and other possible implementations: >> * The code intentionally moved to the separate ValidAddresses class, just to make clear that the default configuration, when the new property is not set is not changed much. >> * The refr... > > Sergey Bylokhov has updated the pull request incrementally with one additional commit since the last revision: > > Fix possible race in the SimpleResolverProviderImpl Does anybody have other comments or the PR is ready to be approved? ------------- PR Comment: https://git.openjdk.org/jdk/pull/13285#issuecomment-1579855284 From jpai at openjdk.org Wed Jun 7 06:03:25 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Wed, 7 Jun 2023 06:03:25 GMT Subject: RFR: 8305906: HttpClient may use incorrect key when finding pooled HTTP/2 connection for IPv6 address [v5] In-Reply-To: <3b7IrpY4XC5OYB3SWQ2O1xH_ZUdOn2TDhr1y8h2M2Uw=.0e4b095a-c071-444c-9f67-62b2611e7977@github.com> References: <3b7IrpY4XC5OYB3SWQ2O1xH_ZUdOn2TDhr1y8h2M2Uw=.0e4b095a-c071-444c-9f67-62b2611e7977@github.com> Message-ID: > Can I please get a review of this change which proposes to fix the issue reported in https://bugs.openjdk.org/browse/JDK-8305906? > > As noted in that issue, when IPv6 hosts are involved, the HttpClient on certain occasions can end up caching the connection with a key which doesn't match with the key which is then used in a subsequent request against the same target host. > > The commit in this PR now wraps the IPv6 address in a square bracket consistently so that the correct key is used both during storing the connection in the pool and when looking up. > > A new jtreg test has been added which reproduces this issue without the fix and verifies the fix. Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: simplify the keyFor method to accept the entire HttpRequestImpl instance ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13456/files - new: https://git.openjdk.org/jdk/pull/13456/files/6db0ea8c..13821d88 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13456&range=04 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13456&range=03-04 Stats: 8 lines in 2 files changed: 2 ins; 1 del; 5 mod Patch: https://git.openjdk.org/jdk/pull/13456.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13456/head:pull/13456 PR: https://git.openjdk.org/jdk/pull/13456 From jpai at openjdk.org Wed Jun 7 06:03:29 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Wed, 7 Jun 2023 06:03:29 GMT Subject: RFR: 8305906: HttpClient may use incorrect key when finding pooled HTTP/2 connection for IPv6 address [v4] In-Reply-To: References: <3b7IrpY4XC5OYB3SWQ2O1xH_ZUdOn2TDhr1y8h2M2Uw=.0e4b095a-c071-444c-9f67-62b2611e7977@github.com> Message-ID: On Tue, 6 Jun 2023 14:53:40 GMT, Daniel Fuchs wrote: >> Jaikiran Pai has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision: >> >> - Merge latest master branch changes >> - wrapping into brackets is no longer needed >> - use HttpRequestImpl.getAddress() to lookup cache key instead of HttpRequestImpl.getURI() >> - 8305906: HttpClient may use incorrect key when finding pooled HTTP/2 connection for IPv6 address > > Marked as reviewed by dfuchs (Reviewer). Hello @dfuch, @djelinski, I've done some minor changes to this PR to have `keyFor` accept a `HttpRequestImpl` instance so that it's clear where the `InetSocketAddress`es get sourced from when constructing the cache key. CI tests with this latest change continue to pass. Requesting a fresh review of this change, please. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13456#issuecomment-1579951670 From jpai at openjdk.org Wed Jun 7 06:27:53 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Wed, 7 Jun 2023 06:27:53 GMT Subject: RFR: 8309527: Improve test proxy performance In-Reply-To: References: Message-ID: On Tue, 6 Jun 2023 09:19:20 GMT, Daniel Jeli?ski wrote: > Please review this change to introduce buffering in the tunnelling proxy implementations. > > Copying network data one byte at a time is very inefficient. ProxyAuthDisabledSchemesSSL is 10 seconds faster (from 40 down to 30s) on my Windows machine with these changes. > > I did not quantify the improvements in other tests affected by this change; I only verified that they continue to pass. Hello Daniel, these changes look good to me. ------------- Marked as reviewed by jpai (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14329#pullrequestreview-1466701145 From djelinski at openjdk.org Wed Jun 7 06:48:56 2023 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Wed, 7 Jun 2023 06:48:56 GMT Subject: RFR: 8305906: HttpClient may use incorrect key when finding pooled HTTP/2 connection for IPv6 address [v5] In-Reply-To: References: <3b7IrpY4XC5OYB3SWQ2O1xH_ZUdOn2TDhr1y8h2M2Uw=.0e4b095a-c071-444c-9f67-62b2611e7977@github.com> Message-ID: On Wed, 7 Jun 2023 06:03:25 GMT, Jaikiran Pai wrote: >> Can I please get a review of this change which proposes to fix the issue reported in https://bugs.openjdk.org/browse/JDK-8305906? >> >> As noted in that issue, when IPv6 hosts are involved, the HttpClient on certain occasions can end up caching the connection with a key which doesn't match with the key which is then used in a subsequent request against the same target host. >> >> The commit in this PR now wraps the IPv6 address in a square bracket consistently so that the correct key is used both during storing the connection in the pool and when looking up. >> >> A new jtreg test has been added which reproduces this issue without the fix and verifies the fix. > > Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: > > simplify the keyFor method to accept the entire HttpRequestImpl instance Marked as reviewed by djelinski (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/13456#pullrequestreview-1466736391 From djelinski at openjdk.org Wed Jun 7 07:54:05 2023 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Wed, 7 Jun 2023 07:54:05 GMT Subject: Integrated: 8309527: Improve test proxy performance In-Reply-To: References: Message-ID: On Tue, 6 Jun 2023 09:19:20 GMT, Daniel Jeli?ski wrote: > Please review this change to introduce buffering in the tunnelling proxy implementations. > > Copying network data one byte at a time is very inefficient. ProxyAuthDisabledSchemesSSL is 10 seconds faster (from 40 down to 30s) on my Windows machine with these changes. > > I did not quantify the improvements in other tests affected by this change; I only verified that they continue to pass. This pull request has now been integrated. Changeset: fadcd650 Author: Daniel Jeli?ski URL: https://git.openjdk.org/jdk/commit/fadcd6501879af40360b217d2f76ab86a6f55d27 Stats: 29 lines in 5 files changed: 5 ins; 0 del; 24 mod 8309527: Improve test proxy performance Reviewed-by: dfuchs, jpai ------------- PR: https://git.openjdk.org/jdk/pull/14329 From bruno at bdasilva.com Wed Jun 7 06:17:08 2023 From: bruno at bdasilva.com (Bruno Da Silva) Date: Wed, 7 Jun 2023 02:17:08 -0400 Subject: Bug in ExtendedSocketOptions: TCP_QUICKACK can't be set in linux due to incorrect syscall level Message-ID: Hi all, Random SWE here. I've found a bug in the LinuxSocketOptions.c native implementation of getting/setting quickack on a socket. When running strace, the socket option that is set is actually changing the SO_PRIORITY. This is because the syscall is incorrectly called with level=SO_SOCKET rather than level=SOL_TCP. You can see this in the openjdk implementation on line 92 and 105: https://github.com/openjdk/jdk/blob/a08c5cb3f1be7a20c8f955951d1605bb8b1c1aa4/src/jdk.net/linux/native/libextnet/LinuxSocketOptions.c#L92. It has existed since the original implementation in JDK-8145635. I believe the fix is to change both get/set syscalls like this: setsockopt(fd, SOL_SOCKET, TCP_QUICKACK, &optval, sizeof (optval)); to setsockopt(fd, SOL_TCP, TCP_QUICKACK, &optval, sizeof (optval)); The bug has existed since JDK 10 and I see it still exists in the most recent versions of Java. It was found and tested in JDK 11. As a non-contributor, I don't know of a way of submitting a patch or directly reporting this bug. Can someone provide guidance on where to take it from here? Thank you, Bruno Da Silva -------------- next part -------------- An HTML attachment was scrubbed... URL: From dfuchs at openjdk.org Wed Jun 7 09:38:58 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Wed, 7 Jun 2023 09:38:58 GMT Subject: RFR: 8305906: HttpClient may use incorrect key when finding pooled HTTP/2 connection for IPv6 address [v5] In-Reply-To: References: <3b7IrpY4XC5OYB3SWQ2O1xH_ZUdOn2TDhr1y8h2M2Uw=.0e4b095a-c071-444c-9f67-62b2611e7977@github.com> Message-ID: On Wed, 7 Jun 2023 06:03:25 GMT, Jaikiran Pai wrote: >> Can I please get a review of this change which proposes to fix the issue reported in https://bugs.openjdk.org/browse/JDK-8305906? >> >> As noted in that issue, when IPv6 hosts are involved, the HttpClient on certain occasions can end up caching the connection with a key which doesn't match with the key which is then used in a subsequent request against the same target host. >> >> The commit in this PR now wraps the IPv6 address in a square bracket consistently so that the correct key is used both during storing the connection in the pool and when looking up. >> >> A new jtreg test has been added which reproduces this issue without the fix and verifies the fix. > > Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: > > simplify the keyFor method to accept the entire HttpRequestImpl instance Marked as reviewed by dfuchs (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/13456#pullrequestreview-1467152670 From jpai at openjdk.org Wed Jun 7 09:47:07 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Wed, 7 Jun 2023 09:47:07 GMT Subject: RFR: 8305906: HttpClient may use incorrect key when finding pooled HTTP/2 connection for IPv6 address [v5] In-Reply-To: References: <3b7IrpY4XC5OYB3SWQ2O1xH_ZUdOn2TDhr1y8h2M2Uw=.0e4b095a-c071-444c-9f67-62b2611e7977@github.com> Message-ID: On Wed, 7 Jun 2023 06:03:25 GMT, Jaikiran Pai wrote: >> Can I please get a review of this change which proposes to fix the issue reported in https://bugs.openjdk.org/browse/JDK-8305906? >> >> As noted in that issue, when IPv6 hosts are involved, the HttpClient on certain occasions can end up caching the connection with a key which doesn't match with the key which is then used in a subsequent request against the same target host. >> >> The commit in this PR now wraps the IPv6 address in a square bracket consistently so that the correct key is used both during storing the connection in the pool and when looking up. >> >> A new jtreg test has been added which reproduces this issue without the fix and verifies the fix. > > Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: > > simplify the keyFor method to accept the entire HttpRequestImpl instance Thank you both for the reviews. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13456#issuecomment-1580320817 From jpai at openjdk.org Wed Jun 7 09:47:15 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Wed, 7 Jun 2023 09:47:15 GMT Subject: Integrated: 8305906: HttpClient may use incorrect key when finding pooled HTTP/2 connection for IPv6 address In-Reply-To: <3b7IrpY4XC5OYB3SWQ2O1xH_ZUdOn2TDhr1y8h2M2Uw=.0e4b095a-c071-444c-9f67-62b2611e7977@github.com> References: <3b7IrpY4XC5OYB3SWQ2O1xH_ZUdOn2TDhr1y8h2M2Uw=.0e4b095a-c071-444c-9f67-62b2611e7977@github.com> Message-ID: On Thu, 13 Apr 2023 11:13:07 GMT, Jaikiran Pai wrote: > Can I please get a review of this change which proposes to fix the issue reported in https://bugs.openjdk.org/browse/JDK-8305906? > > As noted in that issue, when IPv6 hosts are involved, the HttpClient on certain occasions can end up caching the connection with a key which doesn't match with the key which is then used in a subsequent request against the same target host. > > The commit in this PR now wraps the IPv6 address in a square bracket consistently so that the correct key is used both during storing the connection in the pool and when looking up. > > A new jtreg test has been added which reproduces this issue without the fix and verifies the fix. This pull request has now been integrated. Changeset: 3ccb3c0e Author: Jaikiran Pai URL: https://git.openjdk.org/jdk/commit/3ccb3c0e09f9a414229d3f76031f3fc8f271c936 Stats: 194 lines in 3 files changed: 183 ins; 4 del; 7 mod 8305906: HttpClient may use incorrect key when finding pooled HTTP/2 connection for IPv6 address Reviewed-by: djelinski, dfuchs ------------- PR: https://git.openjdk.org/jdk/pull/13456 From Alan.Bateman at oracle.com Wed Jun 7 09:50:31 2023 From: Alan.Bateman at oracle.com (Alan Bateman) Date: Wed, 7 Jun 2023 10:50:31 +0100 Subject: Bug in ExtendedSocketOptions: TCP_QUICKACK can't be set in linux due to incorrect syscall level In-Reply-To: References: Message-ID: <1492ff1f-b501-9557-5159-9592d29db953@oracle.com> On 07/06/2023 07:17, Bruno Da Silva wrote: > Hi all, > > Random SWE here. I've found a bug in the LinuxSocketOptions.c native > implementation of getting/setting quickack on a socket. When running > strace, the socket option that is set is actually changing the > SO_PRIORITY. > > This is because the syscall is incorrectly called with level=SO_SOCKET > rather than level=SOL_TCP. You can see this in the openjdk > implementation on line 92 and 105: > https://github.com/openjdk/jdk/blob/a08c5cb3f1be7a20c8f955951d1605bb8b1c1aa4/src/jdk.net/linux/native/libextnet/LinuxSocketOptions.c#L92. > It has existed since the original implementation in?JDK-8145635. > > I believe the fix is to change both get/set syscalls like this: > setsockopt(fd, SOL_SOCKET, TCP_QUICKACK, &optval, sizeof (optval)); > to > setsockopt(fd, SOL_TCP, TCP_QUICKACK, &optval, sizeof (optval)); > > The bug has existed since JDK 10 and I see it still exists in the most > recent versions of Java. It was found and tested in JDK 11. > > > As a non-contributor, I don't know of?a way of submitting a patch or > directly reporting this bug. Can someone provide guidance on where to > take it from here? > Good find, I've created JDK-8309591 [1] to track it. Create a PR if you want to run with this, otherwise someone else will need to pick this up. -Alan [1] https://bugs.openjdk.org/browse/JDK-8309591 From duke at openjdk.org Wed Jun 7 09:53:08 2023 From: duke at openjdk.org (Dhamoder Nalla) Date: Wed, 7 Jun 2023 09:53:08 GMT Subject: Integrated: 8305763 : Parsing a URI with an underscore goes through a silent exception, negatively impacting performance In-Reply-To: References: Message-ID: On Tue, 11 Apr 2023 18:00:05 GMT, Dhamoder Nalla wrote: > Issue 8305763 : Using underscores in the name for a URI triggers a silent exception in the java standard library, which consumes 5% of the CPU. > > Exception: > java.net.URISyntaxException: Illegal character in hostname at index N: xyz1_abcd.com > at java.base/java.net.URI$Parser.fail(URI.java:2943) > at java.base/java.net.URI$Parser.parseHostname(URI.java:3487) > at java.base/java.net.URI$Parser.parseServer(URI.java:3329) > > This exception is silent and does not produce any messages, except for ODP profiler, there is no other evidence that it?s happening (the stack trace above was printed after changes to Java library). The reason for this is because of how the URI creation is implemented in the java.net.URI class. There are two paths for creating a valid URI, and one of them goes through an exception. > > We can see that if parseServer fails, there is still a way the authority gets assigned and we don?t throw an exception from the method. This means, not being able to parse the server is ok and the exception is silenced. In our case, the server parsing fails because we find an illegal character, as only alphanumeric and dash characters are allowed. This pull request has now been integrated. Changeset: 749d4801 Author: Dhamoder Nalla Committer: Daniel Fuchs URL: https://git.openjdk.org/jdk/commit/749d4801937ac145f945765f0ba0980bbccf384f Stats: 29 lines in 1 file changed: 20 ins; 0 del; 9 mod 8305763: Parsing a URI with an underscore goes through a silent exception, negatively impacting performance Reviewed-by: dfuchs ------------- PR: https://git.openjdk.org/jdk/pull/13430 From msheppar at openjdk.org Wed Jun 7 10:13:55 2023 From: msheppar at openjdk.org (Mark Sheppard) Date: Wed, 7 Jun 2023 10:13:55 GMT Subject: RFR: 8308336: Test java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java failed: java.net.BindException: Address already in use In-Reply-To: References: Message-ID: On Fri, 26 May 2023 13:34:08 GMT, Daniel Fuchs wrote: >> `HttpURLConnectionExpectContinueTest` was throwing an error due to port being hardcoded, updated test to let the system decide which port to use. > > test/jdk/java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java line 76: > >> 74: control.serverSocket = new ServerSocket(); >> 75: control.serverSocket.setReuseAddress(true); >> 76: control.serverSocket.bind(new InetSocketAddress("127.0.0.1", 0)); > > While you're at it can you change the address to use `InetAddress.getLoopbackAddress()`here, and the URIBuilder in createConnection() below? based on Daniel's last comment and requested change then I think it would be useful to add two additional run requests to the test which set the network properties java.net.preferIPv4Stack=true and java.net.preferIPv6Addresses=true, for completeness. You never know what might "pop out of the woodwork" ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14177#discussion_r1221321072 From jai.forums2013 at gmail.com Wed Jun 7 10:18:49 2023 From: jai.forums2013 at gmail.com (Jaikiran Pai) Date: Wed, 7 Jun 2023 15:48:49 +0530 Subject: Bug in ExtendedSocketOptions: TCP_QUICKACK can't be set in linux due to incorrect syscall level In-Reply-To: <1492ff1f-b501-9557-5159-9592d29db953@oracle.com> References: <1492ff1f-b501-9557-5159-9592d29db953@oracle.com> Message-ID: Hello Bruno, Alan has created the JBS issue to track this. In order to submit a patch, you can follow the guidelines that are available at https://openjdk.org/guide/ -Jaikiran On 07/06/23 3:20 pm, Alan Bateman wrote: > On 07/06/2023 07:17, Bruno Da Silva wrote: >> Hi all, >> >> Random SWE here. I've found a bug in the LinuxSocketOptions.c native >> implementation of getting/setting quickack on a socket. When running >> strace, the socket option that is set is actually changing the >> SO_PRIORITY. >> >> This is because the syscall is incorrectly called with >> level=SO_SOCKET rather than level=SOL_TCP. You can see this in the >> openjdk implementation on line 92 and 105: >> https://github.com/openjdk/jdk/blob/a08c5cb3f1be7a20c8f955951d1605bb8b1c1aa4/src/jdk.net/linux/native/libextnet/LinuxSocketOptions.c#L92. >> It has existed since the original implementation in?JDK-8145635. >> >> I believe the fix is to change both get/set syscalls like this: >> setsockopt(fd, SOL_SOCKET, TCP_QUICKACK, &optval, sizeof (optval)); >> to >> setsockopt(fd, SOL_TCP, TCP_QUICKACK, &optval, sizeof (optval)); >> >> The bug has existed since JDK 10 and I see it still exists in the >> most recent versions of Java. It was found and tested in JDK 11. >> >> >> As a non-contributor, I don't know of?a way of submitting a patch or >> directly reporting this bug. Can someone provide guidance on where to >> take it from here? >> > Good find, I've created JDK-8309591 [1] to track it. Create a PR if > you want to run with this, otherwise someone else will need to pick > this up. > > -Alan > > [1] https://bugs.openjdk.org/browse/JDK-8309591 From djelinski1 at gmail.com Wed Jun 7 12:48:27 2023 From: djelinski1 at gmail.com (=?UTF-8?Q?Daniel_Jeli=C5=84ski?=) Date: Wed, 7 Jun 2023 14:48:27 +0200 Subject: [EXTERNAL] Re: Support for Keepalive Extended Socket Options On Windows In-Reply-To: References: <185edc7f-437d-5a75-35ef-6e39a38c9210@oracle.com> <8e0c41f8-f4fa-334f-c5d3-3d42b84a21d0@oracle.com> Message-ID: FWIW, TCP_KEEPIDLE and TCP_KEEPINTVL are available on Windows, starting with Windows 10, version 1709: https://learn.microsoft.com/en-us/windows/win32/winsock/ipproto-tcp-socket-options Apparently TCP_KEEPCNT is available too. Can we use these options and wait for older Windows versions to go out of support? Regards, Daniel ?r., 7 cze 2023 o 00:43 Terry Chow (Simba Technologies Inc) napisa?(a): > > Hi Daniel, > > That sounds good. I like the idea of using a system property to override the defaults just in case. For the starting default values, 2hrs and 1s for idle time and interval time respectively are the officially documented defaults. So, we could start with these. > > Just to reiterate, to start off with the prototype: > > Persist default values at the socket level in either SocketImpl or NIOSocketImpl > Allow default values to be overridden through system properties > Starting default values for idle time and interval time will be 2hrs and 1s > > Let me know if that's acceptable or if there's more to add. > > Thanks, > Terry > ________________________________ > From: Daniel Fuchs > Sent: June 6, 2023 4:22 AM > To: Terry Chow (Simba Technologies Inc) ; Alan Bateman ; net-dev at openjdk.org > Subject: Re: [EXTERNAL] Re: Support for Keepalive Extended Socket Options On Windows > > [You don't often get email from daniel.fuchs at oracle.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ] > > Hi Terry, > > I'm not sure what would be a good default value, but it could > possibly be controlled by a system property allowing to override > whatever we pick. > > best regards, > > -- daniel > > > On 05/06/2023 20:52, Terry Chow (Simba Technologies Inc) wrote: > > Hi Alan and Daniel, > > > > Agreed, having Windows support the keepalive options as it's done on > > other platforms would be the best. But, lobbying them for that change > > would be extremely difficult as it would be very significant change that > > impacts the whole platform. > > > > What defaults values do you guys have in mind? I'm still hesitating on > > persisting default values because the default values can vary between > > machines. > > > > Thanks, > > Terry > > ------------------------------------------------------------------------ > > *From:* Alan Bateman > > *Sent:* June 4, 2023 7:32 AM > > *To:* Daniel Fuchs ; Terry Chow (Simba > > Technologies Inc) ; net-dev at openjdk.org > > > > *Subject:* [EXTERNAL] Re: Support for Keepalive Extended Socket Options > > On Windows > > [You don't often get email from alan.bateman at oracle.com. Learn why this > > is important at https://aka.ms/LearnAboutSenderIdentification > > ] > > > > On 04/06/2023 10:49, Daniel Fuchs wrote: > >> Hi, > >> > >> Could we maybe cache the values in the SocketImpl/NIOSocketImpl > >> implementation? > >> > >> IIRC we do something like that for SO_TIMEOUT already, since this > >> is handled at NIO level. > >> > >> If we know the default value then setting one (when the other is > >> not set) could set it with the supplied value for the one, and > >> the default (or cached value) for the other? > >> > >> Get would then return the cached value (or possibly default > >> value if not set?) > >> > >> We could also potentially set some sensible defaults when creating > >> the socket. > >> > > Yes, this is what I was suggesting in PR14232 too but it will likely be > > a disruptive change. It can be prototyped at least, then we can see how > > we could turn it into something that is maintainable. The best outcome > > would of course be for Windows to expose the socket options in the same > > way as Linux, macOS and others. > > > > -Alan > From bruno at bdasilva.com Wed Jun 7 10:52:41 2023 From: bruno at bdasilva.com (Bruno Da Silva) Date: Wed, 7 Jun 2023 06:52:41 -0400 Subject: Bug in ExtendedSocketOptions: TCP_QUICKACK can't be set in linux due to incorrect syscall level In-Reply-To: References: <1492ff1f-b501-9557-5159-9592d29db953@oracle.com> Message-ID: Thanks, @Alan and @Jaikiran :) I'll set myself up to submit a patch and reply to this chain once one is ready for review. Bruno On Wed, Jun 7, 2023 at 6:18?AM Jaikiran Pai wrote: > Hello Bruno, > > Alan has created the JBS issue to track this. In order to submit a > patch, you can follow the guidelines that are available at > https://openjdk.org/guide/ > > -Jaikiran > > On 07/06/23 3:20 pm, Alan Bateman wrote: > > On 07/06/2023 07:17, Bruno Da Silva wrote: > >> Hi all, > >> > >> Random SWE here. I've found a bug in the LinuxSocketOptions.c native > >> implementation of getting/setting quickack on a socket. When running > >> strace, the socket option that is set is actually changing the > >> SO_PRIORITY. > >> > >> This is because the syscall is incorrectly called with > >> level=SO_SOCKET rather than level=SOL_TCP. You can see this in the > >> openjdk implementation on line 92 and 105: > >> > https://github.com/openjdk/jdk/blob/a08c5cb3f1be7a20c8f955951d1605bb8b1c1aa4/src/jdk.net/linux/native/libextnet/LinuxSocketOptions.c#L92. > > >> It has existed since the original implementation in JDK-8145635. > >> > >> I believe the fix is to change both get/set syscalls like this: > >> setsockopt(fd, SOL_SOCKET, TCP_QUICKACK, &optval, sizeof (optval)); > >> to > >> setsockopt(fd, SOL_TCP, TCP_QUICKACK, &optval, sizeof (optval)); > >> > >> The bug has existed since JDK 10 and I see it still exists in the > >> most recent versions of Java. It was found and tested in JDK 11. > >> > >> > >> As a non-contributor, I don't know of a way of submitting a patch or > >> directly reporting this bug. Can someone provide guidance on where to > >> take it from here? > >> > > Good find, I've created JDK-8309591 [1] to track it. Create a PR if > > you want to run with this, otherwise someone else will need to pick > > this up. > > > > -Alan > > > > [1] https://bugs.openjdk.org/browse/JDK-8309591 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From serb at openjdk.org Wed Jun 7 19:04:15 2023 From: serb at openjdk.org (Sergey Bylokhov) Date: Wed, 7 Jun 2023 19:04:15 GMT Subject: RFR: 8304885: Reuse stale data to improve DNS resolver resiliency [v16] In-Reply-To: References: Message-ID: > I would like to get preliminary feedback about the provided patch. > > Discussion on net-dev@ https://mail.openjdk.org/pipermail/net-dev/2023-March/020682.html > > One of the main issue I try to solve is how the cache handle the intermittent DNS server outages due to overloading or network connection. > > At the moment this cache can be configured by the application using the following two properties: > (1) "networkaddress.cache.ttl"(30 sec) - cache policy for successful lookups > (2) "networkaddress.cache.negative.ttl"(10 sec) - cache policy for negative lookups > > The default timeout for positive responses is good enough to "have recent dns-records" and to "minimize the number of requests to the DNS server". > > But the cache for the negative responses is problematic. This is a problem I would like to solve. Caching the negative response means that for **10** seconds the application will not be able to connect to the server. > > Possible solutions: > 1. Decreasing timeout "for the negative responses": unfortunately more requests to the server at the moment of "DNS-outage" cause even more issues, since this is not the right moment to load the network/server more. > 2. Increasing timeout "for the positive responses": this will decrease the chance to get an error, but the cache will start to use stale data longer. > 3. This proposal: it would be good to ignore the negative response and continue to use the result of the last "successful lookup" until some additional timeout. > > The idea is to split the notion of the TTL and the timeout used for the cache. When TTL for the record will expire we should request the new data from the server. If this request goes fine we will update the record, if it fails we will continue to use the cached date until the next sync. > > For example, if the new property "networkaddress.cache.extended.ttl" is set to 10 minutes, then we will cache a positive response for 10 minutes but will try to sync it every 30 seconds. If the new property is not set then as before we will cache positive for 30 seconds and then cache the negative response for 10 seconds. > > > RFC 8767 Serving Stale Data to Improve DNS Resiliency: > https://www.rfc-editor.org/rfc/rfc8767 > > Comments about current and other possible implementations: > * The code intentionally moved to the separate ValidAddresses class, just to make clear that the default configuration, when the new property is not set is not changed much. > * The refresh timeout includes the time spent on the server lookup. So... Sergey Bylokhov has updated the pull request incrementally with one additional commit since the last revision: CSR feedback ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13285/files - new: https://git.openjdk.org/jdk/pull/13285/files/7bb0de6f..5397b790 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13285&range=15 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13285&range=14-15 Stats: 11 lines in 2 files changed: 2 ins; 0 del; 9 mod Patch: https://git.openjdk.org/jdk/pull/13285.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13285/head:pull/13285 PR: https://git.openjdk.org/jdk/pull/13285 From v-terrychow at microsoft.com Thu Jun 8 02:00:26 2023 From: v-terrychow at microsoft.com (Terry Chow (Simba Technologies Inc)) Date: Thu, 8 Jun 2023 02:00:26 +0000 Subject: [EXTERNAL] Re: Support for Keepalive Extended Socket Options On Windows In-Reply-To: References: <185edc7f-437d-5a75-35ef-6e39a38c9210@oracle.com> <8e0c41f8-f4fa-334f-c5d3-3d42b84a21d0@oracle.com> Message-ID: Hi Daniel Jeli?ski, Thanks for pointing that out. I completely overlooked that doc page. That definitely does look like the best way to conform to how things currently are. There shouldn't be any protest from my team on waiting out older Windows versions (I'll need to double check though). Thanks, Terry ________________________________ From: Daniel Jeli?ski Sent: June 7, 2023 5:48 AM To: Terry Chow (Simba Technologies Inc) Cc: Daniel Fuchs ; Alan Bateman ; net-dev at openjdk.org Subject: Re: [EXTERNAL] Re: Support for Keepalive Extended Socket Options On Windows [You don't often get email from djelinski1 at gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ] FWIW, TCP_KEEPIDLE and TCP_KEEPINTVL are available on Windows, starting with Windows 10, version 1709: https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flearn.microsoft.com%2Fen-us%2Fwindows%2Fwin32%2Fwinsock%2Fipproto-tcp-socket-options&data=05%7C01%7Cv-terrychow%40microsoft.com%7C0dbf70ca1ce047e8370408db675584b8%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638217389237258798%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=JVQxjufRqw84LssZX%2BmRNRxf8tH3OEriTzmWc5tSE8E%3D&reserved=0 Apparently TCP_KEEPCNT is available too. Can we use these options and wait for older Windows versions to go out of support? Regards, Daniel ?r., 7 cze 2023 o 00:43 Terry Chow (Simba Technologies Inc) napisa?(a): > > Hi Daniel, > > That sounds good. I like the idea of using a system property to override the defaults just in case. For the starting default values, 2hrs and 1s for idle time and interval time respectively are the officially documented defaults. So, we could start with these. > > Just to reiterate, to start off with the prototype: > > Persist default values at the socket level in either SocketImpl or NIOSocketImpl > Allow default values to be overridden through system properties > Starting default values for idle time and interval time will be 2hrs and 1s > > Let me know if that's acceptable or if there's more to add. > > Thanks, > Terry > ________________________________ > From: Daniel Fuchs > Sent: June 6, 2023 4:22 AM > To: Terry Chow (Simba Technologies Inc) ; Alan Bateman ; net-dev at openjdk.org > Subject: Re: [EXTERNAL] Re: Support for Keepalive Extended Socket Options On Windows > > [You don't often get email from daniel.fuchs at oracle.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ] > > Hi Terry, > > I'm not sure what would be a good default value, but it could > possibly be controlled by a system property allowing to override > whatever we pick. > > best regards, > > -- daniel > > > On 05/06/2023 20:52, Terry Chow (Simba Technologies Inc) wrote: > > Hi Alan and Daniel, > > > > Agreed, having Windows support the keepalive options as it's done on > > other platforms would be the best. But, lobbying them for that change > > would be extremely difficult as it would be very significant change that > > impacts the whole platform. > > > > What defaults values do you guys have in mind? I'm still hesitating on > > persisting default values because the default values can vary between > > machines. > > > > Thanks, > > Terry > > ------------------------------------------------------------------------ > > *From:* Alan Bateman > > *Sent:* June 4, 2023 7:32 AM > > *To:* Daniel Fuchs ; Terry Chow (Simba > > Technologies Inc) ; net-dev at openjdk.org > > > > *Subject:* [EXTERNAL] Re: Support for Keepalive Extended Socket Options > > On Windows > > [You don't often get email from alan.bateman at oracle.com. Learn why this > > is important at https://aka.ms/LearnAboutSenderIdentification > > > ] > > > > On 04/06/2023 10:49, Daniel Fuchs wrote: > >> Hi, > >> > >> Could we maybe cache the values in the SocketImpl/NIOSocketImpl > >> implementation? > >> > >> IIRC we do something like that for SO_TIMEOUT already, since this > >> is handled at NIO level. > >> > >> If we know the default value then setting one (when the other is > >> not set) could set it with the supplied value for the one, and > >> the default (or cached value) for the other? > >> > >> Get would then return the cached value (or possibly default > >> value if not set?) > >> > >> We could also potentially set some sensible defaults when creating > >> the socket. > >> > > Yes, this is what I was suggesting in PR14232 too but it will likely be > > a disruptive change. It can be prototyped at least, then we can see how > > we could turn it into something that is maintainable. The best outcome > > would of course be for Windows to expose the socket options in the same > > way as Linux, macOS and others. > > > > -Alan > -------------- next part -------------- An HTML attachment was scrubbed... URL: From duke at openjdk.org Thu Jun 8 14:09:01 2023 From: duke at openjdk.org (Darragh Clarke) Date: Thu, 8 Jun 2023 14:09:01 GMT Subject: RFR: 8308336: Test java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java failed: java.net.BindException: Address already in use [v2] In-Reply-To: References: Message-ID: > `HttpURLConnectionExpectContinueTest` was throwing an error due to port being hardcoded, updated test to let the system decide which port to use. Darragh Clarke has updated the pull request incrementally with one additional commit since the last revision: implemented feedback ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14177/files - new: https://git.openjdk.org/jdk/pull/14177/files/be625cf6..49b77cbc Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14177&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14177&range=00-01 Stats: 10 lines in 1 file changed: 7 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/14177.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14177/head:pull/14177 PR: https://git.openjdk.org/jdk/pull/14177 From duke at openjdk.org Thu Jun 8 14:14:50 2023 From: duke at openjdk.org (Darragh Clarke) Date: Thu, 8 Jun 2023 14:14:50 GMT Subject: RFR: 8308336: Test java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java failed: java.net.BindException: Address already in use [v2] In-Reply-To: References: Message-ID: On Wed, 7 Jun 2023 10:11:22 GMT, Mark Sheppard wrote: >> test/jdk/java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java line 76: >> >>> 74: control.serverSocket = new ServerSocket(); >>> 75: control.serverSocket.setReuseAddress(true); >>> 76: control.serverSocket.bind(new InetSocketAddress("127.0.0.1", 0)); >> >> While you're at it can you change the address to use `InetAddress.getLoopbackAddress()`here, and the URIBuilder in createConnection() below? > > based on Daniel's last comment and requested change then I think it would be useful to add two additional run requests to the test which set the network properties java.net.preferIPv4Stack=true and java.net.preferIPv6Addresses=true, for completeness. > You never know what might "pop out of the woodwork" I added those changes and verified that the tests are still passing ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14177#discussion_r1223102358 From serb at openjdk.org Thu Jun 8 14:18:10 2023 From: serb at openjdk.org (Sergey Bylokhov) Date: Thu, 8 Jun 2023 14:18:10 GMT Subject: RFR: 8304885: Reuse stale data to improve DNS resolver resiliency [v17] In-Reply-To: References: Message-ID: > I would like to get preliminary feedback about the provided patch. > > Discussion on net-dev@ https://mail.openjdk.org/pipermail/net-dev/2023-March/020682.html > > One of the main issue I try to solve is how the cache handle the intermittent DNS server outages due to overloading or network connection. > > At the moment this cache can be configured by the application using the following two properties: > (1) "networkaddress.cache.ttl"(30 sec) - cache policy for successful lookups > (2) "networkaddress.cache.negative.ttl"(10 sec) - cache policy for negative lookups > > The default timeout for positive responses is good enough to "have recent dns-records" and to "minimize the number of requests to the DNS server". > > But the cache for the negative responses is problematic. This is a problem I would like to solve. Caching the negative response means that for **10** seconds the application will not be able to connect to the server. > > Possible solutions: > 1. Decreasing timeout "for the negative responses": unfortunately more requests to the server at the moment of "DNS-outage" cause even more issues, since this is not the right moment to load the network/server more. > 2. Increasing timeout "for the positive responses": this will decrease the chance to get an error, but the cache will start to use stale data longer. > 3. This proposal: it would be good to ignore the negative response and continue to use the result of the last "successful lookup" until some additional timeout. > > The idea is to split the notion of the TTL and the timeout used for the cache. When TTL for the record will expire we should request the new data from the server. If this request goes fine we will update the record, if it fails we will continue to use the cached date until the next sync. > > For example, if the new property "networkaddress.cache.extended.ttl" is set to 10 minutes, then we will cache a positive response for 10 minutes but will try to sync it every 30 seconds. If the new property is not set then as before we will cache positive for 30 seconds and then cache the negative response for 10 seconds. > > > RFC 8767 Serving Stale Data to Improve DNS Resiliency: > https://www.rfc-editor.org/rfc/rfc8767 > > Comments about current and other possible implementations: > * The code intentionally moved to the separate ValidAddresses class, just to make clear that the default configuration, when the new property is not set is not changed much. > * The refresh timeout includes the time spent on the server lookup. So... Sergey Bylokhov has updated the pull request incrementally with one additional commit since the last revision: CSR feedback ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13285/files - new: https://git.openjdk.org/jdk/pull/13285/files/5397b790..aa6c12ea Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13285&range=16 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13285&range=15-16 Stats: 2 lines in 2 files changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/13285.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13285/head:pull/13285 PR: https://git.openjdk.org/jdk/pull/13285 From msheppar at openjdk.org Thu Jun 8 14:27:55 2023 From: msheppar at openjdk.org (Mark Sheppard) Date: Thu, 8 Jun 2023 14:27:55 GMT Subject: RFR: 8308336: Test java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java failed: java.net.BindException: Address already in use [v2] In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 14:09:01 GMT, Darragh Clarke wrote: >> `HttpURLConnectionExpectContinueTest` was throwing an error due to port being hardcoded, updated test to let the system decide which port to use. > > Darragh Clarke has updated the pull request incrementally with one additional commit since the last revision: > > implemented feedback test/jdk/java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java line 428: > 426: URL url = URIBuilder.newBuilder() > 427: .scheme("http") > 428: .host(InetAddress.getLoopbackAddress()) This will change the call flow of the test in a slightly subtle way. In the original the "host" is supplied i.e. localhost which should map to the loopback address, and in the change the loopback IP address is being supplied diectly. In terms of equivalence then supplying a host string might be more appropriate: .host("localhost") ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14177#discussion_r1223122614 From dfuchs at openjdk.org Thu Jun 8 15:10:51 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Thu, 8 Jun 2023 15:10:51 GMT Subject: RFR: 8308336: Test java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java failed: java.net.BindException: Address already in use [v2] In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 14:25:20 GMT, Mark Sheppard wrote: >> Darragh Clarke has updated the pull request incrementally with one additional commit since the last revision: >> >> implemented feedback > > test/jdk/java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java line 428: > >> 426: URL url = URIBuilder.newBuilder() >> 427: .scheme("http") >> 428: .host(InetAddress.getLoopbackAddress()) > > This will change the call flow of the test in a slightly subtle way. In the original the "host" is supplied i.e. localhost which should map to the loopback address, and in the change the loopback IP address is being supplied diectly. In terms of equivalence then supplying a host string might be more appropriate: > .host("localhost") No that's precisely what we want to avoid. Because how "localhost" maps to an InetAddress depends on the machine configuration, which is a recipe for intermittent failures. I'd suggest: URL url = URIBuilder.newBuilder() .scheme("http") .localhost() (which is actually the same) ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14177#discussion_r1223187935 From dfuchs at openjdk.org Thu Jun 8 15:13:52 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Thu, 8 Jun 2023 15:13:52 GMT Subject: RFR: 8308336: Test java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java failed: java.net.BindException: Address already in use [v2] In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 14:09:01 GMT, Darragh Clarke wrote: >> `HttpURLConnectionExpectContinueTest` was throwing an error due to port being hardcoded, updated test to let the system decide which port to use. > > Darragh Clarke has updated the pull request incrementally with one additional commit since the last revision: > > implemented feedback test/jdk/java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java line 31: > 29: * @run junit/othervm HttpURLConnectionExpectContinueTest > 30: * @run junit/othervm -Djava.net.preferIPv4Stack=True HttpURLConnectionExpectContinueTest > 31: * @run junit/othervm -Djava.net.preferIPv6Addresses=True HttpURLConnectionExpectContinueTest Suggestion: * @run junit/othervm -Djava.net.preferIPv4Stack=true HttpURLConnectionExpectContinueTest * @run junit/othervm -Djava.net.preferIPv6Addresses=true HttpURLConnectionExpectContinueTest ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14177#discussion_r1223190801 From dfuchs at openjdk.org Thu Jun 8 15:24:57 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Thu, 8 Jun 2023 15:24:57 GMT Subject: RFR: 8304885: Reuse stale data to improve DNS resolver resiliency [v17] In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 14:18:10 GMT, Sergey Bylokhov wrote: >> I would like to get preliminary feedback about the provided patch. >> >> Discussion on net-dev@ https://mail.openjdk.org/pipermail/net-dev/2023-March/020682.html >> >> One of the main issue I try to solve is how the cache handle the intermittent DNS server outages due to overloading or network connection. >> >> At the moment this cache can be configured by the application using the following two properties: >> (1) "networkaddress.cache.ttl"(30 sec) - cache policy for successful lookups >> (2) "networkaddress.cache.negative.ttl"(10 sec) - cache policy for negative lookups >> >> The default timeout for positive responses is good enough to "have recent dns-records" and to "minimize the number of requests to the DNS server". >> >> But the cache for the negative responses is problematic. This is a problem I would like to solve. Caching the negative response means that for **10** seconds the application will not be able to connect to the server. >> >> Possible solutions: >> 1. Decreasing timeout "for the negative responses": unfortunately more requests to the server at the moment of "DNS-outage" cause even more issues, since this is not the right moment to load the network/server more. >> 2. Increasing timeout "for the positive responses": this will decrease the chance to get an error, but the cache will start to use stale data longer. >> 3. This proposal: it would be good to ignore the negative response and continue to use the result of the last "successful lookup" until some additional timeout. >> >> The idea is to split the notion of the TTL and the timeout used for the cache. When TTL for the record will expire we should request the new data from the server. If this request goes fine we will update the record, if it fails we will continue to use the cached date until the next sync. >> >> For example, if the new property "networkaddress.cache.extended.ttl" is set to 10 minutes, then we will cache a positive response for 10 minutes but will try to sync it every 30 seconds. If the new property is not set then as before we will cache positive for 30 seconds and then cache the negative response for 10 seconds. >> >> >> RFC 8767 Serving Stale Data to Improve DNS Resiliency: >> https://www.rfc-editor.org/rfc/rfc8767 >> >> Comments about current and other possible implementations: >> * The code intentionally moved to the separate ValidAddresses class, just to make clear that the default configuration, when the new property is not set is not changed much. >> * The refr... > > Sergey Bylokhov has updated the pull request incrementally with one additional commit since the last revision: > > CSR feedback Thanks for this later change. I agree with Alan that it does look better. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13285#issuecomment-1582807740 From duke at openjdk.org Thu Jun 8 15:53:03 2023 From: duke at openjdk.org (Darragh Clarke) Date: Thu, 8 Jun 2023 15:53:03 GMT Subject: RFR: 8308336: Test java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java failed: java.net.BindException: Address already in use [v3] In-Reply-To: References: Message-ID: <4HPCL92C89ZyFFl3DQ5Cvc5-WC3qTVsWx8YhI_cX0NM=.3e2a2564-f250-4858-9923-dcf0c36ccc2b@github.com> > `HttpURLConnectionExpectContinueTest` was throwing an error due to port being hardcoded, updated test to let the system decide which port to use. Darragh Clarke has updated the pull request incrementally with one additional commit since the last revision: Update test/jdk/java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java Co-authored-by: Daniel Fuchs <67001856+dfuch at users.noreply.github.com> ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14177/files - new: https://git.openjdk.org/jdk/pull/14177/files/49b77cbc..272c8719 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14177&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14177&range=01-02 Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/14177.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14177/head:pull/14177 PR: https://git.openjdk.org/jdk/pull/14177 From duke at openjdk.org Thu Jun 8 15:53:05 2023 From: duke at openjdk.org (Darragh Clarke) Date: Thu, 8 Jun 2023 15:53:05 GMT Subject: RFR: 8308336: Test java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java failed: java.net.BindException: Address already in use [v2] In-Reply-To: References: Message-ID: <_hKoATUpEqVAoha8sXc5sggA4yavlr9zBFWUMyWE9rk=.8cf8c1e4-d9ce-4f5c-b224-76292382ab28@github.com> On Thu, 8 Jun 2023 15:08:22 GMT, Daniel Fuchs wrote: >> test/jdk/java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java line 428: >> >>> 426: URL url = URIBuilder.newBuilder() >>> 427: .scheme("http") >>> 428: .host(InetAddress.getLoopbackAddress()) >> >> This will change the call flow of the test in a slightly subtle way. In the original the "host" is supplied i.e. localhost which should map to the loopback address, and in the change the loopback IP address is being supplied diectly. In terms of equivalence then supplying a host string might be more appropriate: >> .host("localhost") > > No that's precisely what we want to avoid. Because how "localhost" maps to an InetAddress depends on the machine configuration, which is a recipe for intermittent failures. > > I'd suggest: > > URL url = URIBuilder.newBuilder() > .scheme("http") > .localhost() > > (which is actually the same) At a glance there isn't a `.localhost()` only a `.loopback()` is that what you were referring to? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14177#discussion_r1223236970 From dfuchs at openjdk.org Thu Jun 8 16:22:48 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Thu, 8 Jun 2023 16:22:48 GMT Subject: RFR: 8308336: Test java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java failed: java.net.BindException: Address already in use [v2] In-Reply-To: <_hKoATUpEqVAoha8sXc5sggA4yavlr9zBFWUMyWE9rk=.8cf8c1e4-d9ce-4f5c-b224-76292382ab28@github.com> References: <_hKoATUpEqVAoha8sXc5sggA4yavlr9zBFWUMyWE9rk=.8cf8c1e4-d9ce-4f5c-b224-76292382ab28@github.com> Message-ID: On Thu, 8 Jun 2023 15:47:43 GMT, Darragh Clarke wrote: >> No that's precisely what we want to avoid. Because how "localhost" maps to an InetAddress depends on the machine configuration, which is a recipe for intermittent failures. >> >> I'd suggest: >> >> URL url = URIBuilder.newBuilder() >> .scheme("http") >> .localhost() >> >> (which is actually the same) > > At a glance there isn't a `.localhost()` only a `.loopback()` is that what you were referring to? Yes! Sorry - my mistake. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14177#discussion_r1223282455 From duke at openjdk.org Thu Jun 8 16:47:33 2023 From: duke at openjdk.org (Darragh Clarke) Date: Thu, 8 Jun 2023 16:47:33 GMT Subject: RFR: 8308336: Test java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java failed: java.net.BindException: Address already in use [v4] In-Reply-To: References: Message-ID: > `HttpURLConnectionExpectContinueTest` was throwing an error due to port being hardcoded, updated test to let the system decide which port to use. Darragh Clarke has updated the pull request incrementally with one additional commit since the last revision: use loopback ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14177/files - new: https://git.openjdk.org/jdk/pull/14177/files/272c8719..9dd40a4c Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14177&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14177&range=02-03 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/14177.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14177/head:pull/14177 PR: https://git.openjdk.org/jdk/pull/14177 From duke at openjdk.org Thu Jun 8 16:47:36 2023 From: duke at openjdk.org (Darragh Clarke) Date: Thu, 8 Jun 2023 16:47:36 GMT Subject: RFR: 8308336: Test java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java failed: java.net.BindException: Address already in use [v2] In-Reply-To: References: <_hKoATUpEqVAoha8sXc5sggA4yavlr9zBFWUMyWE9rk=.8cf8c1e4-d9ce-4f5c-b224-76292382ab28@github.com> Message-ID: On Thu, 8 Jun 2023 16:20:02 GMT, Daniel Fuchs wrote: >> At a glance there isn't a `.localhost()` only a `.loopback()` is that what you were referring to? > > Yes! Sorry - my mistake. I pushed that change now and am currently rerunning tests ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14177#discussion_r1223305673 From dfuchs at openjdk.org Thu Jun 8 16:50:49 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Thu, 8 Jun 2023 16:50:49 GMT Subject: RFR: 8308336: Test java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java failed: java.net.BindException: Address already in use [v4] In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 16:47:33 GMT, Darragh Clarke wrote: >> `HttpURLConnectionExpectContinueTest` was throwing an error due to port being hardcoded, updated test to let the system decide which port to use. > > Darragh Clarke has updated the pull request incrementally with one additional commit since the last revision: > > use loopback LGTM. ------------- Marked as reviewed by dfuchs (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14177#pullrequestreview-1470395438 From jjg at openjdk.org Thu Jun 8 17:29:59 2023 From: jjg at openjdk.org (Jonathan Gibbons) Date: Thu, 8 Jun 2023 17:29:59 GMT Subject: RFR: JDK-8305406: Add @spec tags in java.base/java.* (part 2) [v3] In-Reply-To: <8GpnL45DR-AOzXUpzHoIPsD-PCH9X0D9jpqBczHGVRU=.cdefb63e-84c8-4489-9c98-ce2a00d34e72@github.com> References: <8GpnL45DR-AOzXUpzHoIPsD-PCH9X0D9jpqBczHGVRU=.cdefb63e-84c8-4489-9c98-ce2a00d34e72@github.com> Message-ID: <4aXf_OR_EF_CqqIhswGgOr0dZeHEoJRPRIAIQHtTHD4=.3849ecb7-c0c1-41bf-b81e-b823eb882899@github.com> On Wed, 5 Apr 2023 16:45:06 GMT, Jonathan Gibbons wrote: >> Please review a doc update to add `@spec` into the rest of the files in `java.base` (compared to those in [JDK-8305206](https://bugs.openjdk.org/browse/JDK-8305206) PR #13248) > > Jonathan Gibbons has updated the pull request incrementally with one additional commit since the last revision: > > Address review feedback keep-alive comment ------------- PR Comment: https://git.openjdk.org/jdk/pull/13336#issuecomment-1583064392 From jjg at openjdk.org Thu Jun 8 20:18:46 2023 From: jjg at openjdk.org (Jonathan Gibbons) Date: Thu, 8 Jun 2023 20:18:46 GMT Subject: RFR: JDK-8305406: Add @spec tags in java.base/java.* (part 2) [v3] In-Reply-To: <8GpnL45DR-AOzXUpzHoIPsD-PCH9X0D9jpqBczHGVRU=.cdefb63e-84c8-4489-9c98-ce2a00d34e72@github.com> References: <8GpnL45DR-AOzXUpzHoIPsD-PCH9X0D9jpqBczHGVRU=.cdefb63e-84c8-4489-9c98-ce2a00d34e72@github.com> Message-ID: On Wed, 5 Apr 2023 16:45:06 GMT, Jonathan Gibbons wrote: >> Please review a doc update to add `@spec` into the rest of the files in `java.base` (compared to those in [JDK-8305206](https://bugs.openjdk.org/browse/JDK-8305206) PR #13248) > > Jonathan Gibbons has updated the pull request incrementally with one additional commit since the last revision: > > Address review feedback I checked out references to `nist.gov`. I found 7 references to 4 documents: $ grep -r '*.*href=[^ ]*nist.gov' open/src/java.base | grep -o 'nist.gov[^"]*' nist.gov/nistpubs/FIPS/NIST.FIPS.140-2.pdf nist.gov/publications/fips/fips186-3/fips_186-3.pdf nist.gov/nistpubs/SpecialPublications/NIST.SP.800-90Ar1.pdf nist.gov/nistpubs/SpecialPublications/NIST.SP.800-38F.pdf> nist.gov/nistpubs/SpecialPublications/NIST.SP.800-38F.pdf> nist.gov/nistpubs/SpecialPublications/NIST.SP.800-38F.pdf> nist.gov/nistpubs/SpecialPublications/NIST.SP.800-38F.pdf> Of these 4, 1 shows a page that says the spec has been superseded, and one is effectively a 404 Oops, that's not standard?! Sorry, we cannot find that page. The page you requested cannot be found at this time. I would like to defer these issues to be handled separately, and add `@spec` tags for these pages later, once the appropriate specs have been identified. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13336#issuecomment-1583280716 From jjg at openjdk.org Thu Jun 8 20:49:49 2023 From: jjg at openjdk.org (Jonathan Gibbons) Date: Thu, 8 Jun 2023 20:49:49 GMT Subject: RFR: JDK-8305406: Add @spec tags in java.base/java.* (part 2) [v3] In-Reply-To: References: <8GpnL45DR-AOzXUpzHoIPsD-PCH9X0D9jpqBczHGVRU=.cdefb63e-84c8-4489-9c98-ce2a00d34e72@github.com> Message-ID: On Thu, 8 Jun 2023 20:16:21 GMT, Jonathan Gibbons wrote: > I checked out references to `nist.gov`. > > I found 7 references to 4 documents: > > ``` > $ grep -r '*.*href=[^ ]*nist.gov' open/src/java.base | grep -o 'nist.gov[^"]*' > nist.gov/nistpubs/FIPS/NIST.FIPS.140-2.pdf > nist.gov/publications/fips/fips186-3/fips_186-3.pdf > nist.gov/nistpubs/SpecialPublications/NIST.SP.800-90Ar1.pdf > nist.gov/nistpubs/SpecialPublications/NIST.SP.800-38F.pdf> > nist.gov/nistpubs/SpecialPublications/NIST.SP.800-38F.pdf> > nist.gov/nistpubs/SpecialPublications/NIST.SP.800-38F.pdf> > nist.gov/nistpubs/SpecialPublications/NIST.SP.800-38F.pdf> > ``` > > Of these 4, 1 shows a page that says the spec has been superseded, and one is effectively a 404 > > ``` > Oops, that's not standard?! > Sorry, we cannot find that page. > > The page you requested cannot be found at this time. > ``` > > I would like to defer these issues to be handled separately, and add `@spec` tags for these pages later, once the appropriate specs have been identified. Update, the apparent 404 is explained by a scripting error, due to an unquoted attribute value. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13336#issuecomment-1583319302 From jjg at openjdk.org Thu Jun 8 21:20:07 2023 From: jjg at openjdk.org (Jonathan Gibbons) Date: Thu, 8 Jun 2023 21:20:07 GMT Subject: RFR: JDK-8305406: Add @spec tags in java.base/java.* (part 2) [v4] In-Reply-To: References: Message-ID: > Please review a doc update to add `@spec` into the rest of the files in `java.base` (compared to those in [JDK-8305206](https://bugs.openjdk.org/browse/JDK-8305206) PR #13248) Jonathan Gibbons has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision: - Add @spec tags for nist.gov docs - Merge remote-tracking branch 'upstream/master' into 8305406.at-spec-java.base-java-2-javax - Address review feedback - Update src/java.base/share/classes/java/security/cert/X509Certificate.java Co-authored-by: Daniel Jelinski - JDK-8305406: Add @spec tags in java.base/java.* (part 2) ------------- Changes: - all: https://git.openjdk.org/jdk/pull/13336/files - new: https://git.openjdk.org/jdk/pull/13336/files/03a70694..1b997359 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=13336&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13336&range=02-03 Stats: 554345 lines in 6384 files changed: 454872 ins; 53914 del; 45559 mod Patch: https://git.openjdk.org/jdk/pull/13336.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/13336/head:pull/13336 PR: https://git.openjdk.org/jdk/pull/13336 From tsteele at openjdk.org Thu Jun 8 22:09:50 2023 From: tsteele at openjdk.org (Tyler Steele) Date: Thu, 8 Jun 2023 22:09:50 GMT Subject: RFR: 8305906: HttpClient may use incorrect key when finding pooled HTTP/2 connection for IPv6 address [v5] In-Reply-To: References: <3b7IrpY4XC5OYB3SWQ2O1xH_ZUdOn2TDhr1y8h2M2Uw=.0e4b095a-c071-444c-9f67-62b2611e7977@github.com> Message-ID: <1zCGLhVlv4oX23fJ7OzdsvJMAyxsEzK2D4DSiWISB34=.ed03d3eb-4f87-46d3-950a-585d04bd14c3@github.com> On Wed, 7 Jun 2023 09:43:08 GMT, Jaikiran Pai wrote: >> Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: >> >> simplify the keyFor method to accept the entire HttpRequestImpl instance > > Thank you both for the reviews. Thanks for your change @jaikiran! We've seen this issue in my organization occurring in jdk17, and jdk11. It's nice to see that it has been fixed. Do you have any plans to backport it? ------------- PR Comment: https://git.openjdk.org/jdk/pull/13456#issuecomment-1583452832 From serb at openjdk.org Fri Jun 9 04:05:47 2023 From: serb at openjdk.org (Sergey Bylokhov) Date: Fri, 9 Jun 2023 04:05:47 GMT Subject: RFR: 8304885: Reuse stale data to improve DNS resolver resiliency [v17] In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 14:18:10 GMT, Sergey Bylokhov wrote: >> I would like to get preliminary feedback about the provided patch. >> >> Discussion on net-dev@ https://mail.openjdk.org/pipermail/net-dev/2023-March/020682.html >> >> One of the main issue I try to solve is how the cache handle the intermittent DNS server outages due to overloading or network connection. >> >> At the moment this cache can be configured by the application using the following two properties: >> (1) "networkaddress.cache.ttl"(30 sec) - cache policy for successful lookups >> (2) "networkaddress.cache.negative.ttl"(10 sec) - cache policy for negative lookups >> >> The default timeout for positive responses is good enough to "have recent dns-records" and to "minimize the number of requests to the DNS server". >> >> But the cache for the negative responses is problematic. This is a problem I would like to solve. Caching the negative response means that for **10** seconds the application will not be able to connect to the server. >> >> Possible solutions: >> 1. Decreasing timeout "for the negative responses": unfortunately more requests to the server at the moment of "DNS-outage" cause even more issues, since this is not the right moment to load the network/server more. >> 2. Increasing timeout "for the positive responses": this will decrease the chance to get an error, but the cache will start to use stale data longer. >> 3. This proposal: it would be good to ignore the negative response and continue to use the result of the last "successful lookup" until some additional timeout. >> >> The idea is to split the notion of the TTL and the timeout used for the cache. When TTL for the record will expire we should request the new data from the server. If this request goes fine we will update the record, if it fails we will continue to use the cached date until the next sync. >> >> For example, if the new property "networkaddress.cache.extended.ttl" is set to 10 minutes, then we will cache a positive response for 10 minutes but will try to sync it every 30 seconds. If the new property is not set then as before we will cache positive for 30 seconds and then cache the negative response for 10 seconds. >> >> >> RFC 8767 Serving Stale Data to Improve DNS Resiliency: >> https://www.rfc-editor.org/rfc/rfc8767 >> >> Comments about current and other possible implementations: >> * The code intentionally moved to the separate ValidAddresses class, just to make clear that the default configuration, when the new property is not set is not changed much. >> * The refr... > > Sergey Bylokhov has updated the pull request incrementally with one additional commit since the last revision: > > CSR feedback The CSR is approved, please take a look to the final version. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13285#issuecomment-1583938870 From jpai at openjdk.org Fri Jun 9 09:19:53 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Fri, 9 Jun 2023 09:19:53 GMT Subject: RFR: 8305906: HttpClient may use incorrect key when finding pooled HTTP/2 connection for IPv6 address [v5] In-Reply-To: References: <3b7IrpY4XC5OYB3SWQ2O1xH_ZUdOn2TDhr1y8h2M2Uw=.0e4b095a-c071-444c-9f67-62b2611e7977@github.com> Message-ID: On Wed, 7 Jun 2023 06:03:25 GMT, Jaikiran Pai wrote: >> Can I please get a review of this change which proposes to fix the issue reported in https://bugs.openjdk.org/browse/JDK-8305906? >> >> As noted in that issue, when IPv6 hosts are involved, the HttpClient on certain occasions can end up caching the connection with a key which doesn't match with the key which is then used in a subsequent request against the same target host. >> >> The commit in this PR now wraps the IPv6 address in a square bracket consistently so that the correct key is used both during storing the connection in the pool and when looking up. >> >> A new jtreg test has been added which reproduces this issue without the fix and verifies the fix. > > Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: > > simplify the keyFor method to accept the entire HttpRequestImpl instance Hello Tyler, > Do you have any plans to backport it? I haven't been involved in the 11/17 backports in recent times, so I don't have any specific plans to backport this. Having said that, I think this does look like a good candidate for backporting, so if you or anyone has done it before, please do go ahead. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13456#issuecomment-1584247606 From duke at openjdk.org Fri Jun 9 10:17:44 2023 From: duke at openjdk.org (Ferenc Rakoczi) Date: Fri, 9 Jun 2023 10:17:44 GMT Subject: RFR: JDK-8305406: Add @spec tags in java.base/java.* (part 2) [v3] In-Reply-To: References: <8GpnL45DR-AOzXUpzHoIPsD-PCH9X0D9jpqBczHGVRU=.cdefb63e-84c8-4489-9c98-ce2a00d34e72@github.com> Message-ID: On Thu, 8 Jun 2023 20:46:41 GMT, Jonathan Gibbons wrote: > > I checked out references to `nist.gov`. > > I found 7 references to 4 documents: > > ``` > > $ grep -r '*.*href=[^ ]*nist.gov' open/src/java.base | grep -o 'nist.gov[^"]*' > > nist.gov/nistpubs/FIPS/NIST.FIPS.140-2.pdf > > nist.gov/publications/fips/fips186-3/fips_186-3.pdf > > nist.gov/nistpubs/SpecialPublications/NIST.SP.800-90Ar1.pdf > > nist.gov/nistpubs/SpecialPublications/NIST.SP.800-38F.pdf> > > nist.gov/nistpubs/SpecialPublications/NIST.SP.800-38F.pdf> > > nist.gov/nistpubs/SpecialPublications/NIST.SP.800-38F.pdf> > > nist.gov/nistpubs/SpecialPublications/NIST.SP.800-38F.pdf> > > ``` > > Of these 4, 1 shows a page that says the spec has been superseded, and one is effectively a 404 > > ``` > > Oops, that's not standard?! > > Sorry, we cannot find that page. > > > > The page you requested cannot be found at this time. > > ``` > > > > I would like to defer these issues to be handled separately, and add `@spec` tags for these pages later, once the appropriate specs have been identified. > > Update, the apparent 404 is explained by a scripting error, due to an unquoted attribute value. The site name in the urls has changed to nvlpubs.nist.gov . For the DSS, the latest version in which DSA is described is nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf . It will be with withdrawn on February 23, 2024, though, and the superseding FIPS 186-5 standard says that it can only be used for signature verification from then on, but for the algorithm description it points back to FIPS 186-4. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13336#issuecomment-1584332934 From duke at openjdk.org Fri Jun 9 12:22:42 2023 From: duke at openjdk.org (Darragh Clarke) Date: Fri, 9 Jun 2023 12:22:42 GMT Subject: RFR: 8308336: Test java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java failed: java.net.BindException: Address already in use [v4] In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 16:47:33 GMT, Darragh Clarke wrote: >> `HttpURLConnectionExpectContinueTest` was throwing an error due to port being hardcoded, updated test to let the system decide which port to use. > > Darragh Clarke has updated the pull request incrementally with one additional commit since the last revision: > > use loopback Spent some time double checking tests and everything seems to be stable ------------- PR Comment: https://git.openjdk.org/jdk/pull/14177#issuecomment-1584485997 From duke at openjdk.org Fri Jun 9 14:09:06 2023 From: duke at openjdk.org (Darragh Clarke) Date: Fri, 9 Jun 2023 14:09:06 GMT Subject: Integrated: 8308336: Test java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java failed: java.net.BindException: Address already in use In-Reply-To: References: Message-ID: On Fri, 26 May 2023 12:57:59 GMT, Darragh Clarke wrote: > `HttpURLConnectionExpectContinueTest` was throwing an error due to port being hardcoded, updated test to let the system decide which port to use. This pull request has now been integrated. Changeset: a48bcf36 Author: Darragh Clarke Committer: Daniel Fuchs URL: https://git.openjdk.org/jdk/commit/a48bcf367120fc7cde88b19097dabe9c86c90bb7 Stats: 10 lines in 1 file changed: 7 ins; 0 del; 3 mod 8308336: Test java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java failed: java.net.BindException: Address already in use Reviewed-by: dfuchs ------------- PR: https://git.openjdk.org/jdk/pull/14177 From dfuchs at openjdk.org Fri Jun 9 14:12:51 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Fri, 9 Jun 2023 14:12:51 GMT Subject: RFR: 8304885: Reuse stale data to improve DNS resolver resiliency [v17] In-Reply-To: References: Message-ID: <13GjPc_YaHjziMJ3lpx80x26VBPBAXbm2xY-1EBscQQ=.03371722-22b0-4f57-8101-b72dcd9ad03e@github.com> On Thu, 8 Jun 2023 14:18:10 GMT, Sergey Bylokhov wrote: >> I would like to get preliminary feedback about the provided patch. >> >> Discussion on net-dev@ https://mail.openjdk.org/pipermail/net-dev/2023-March/020682.html >> >> One of the main issue I try to solve is how the cache handle the intermittent DNS server outages due to overloading or network connection. >> >> At the moment this cache can be configured by the application using the following two properties: >> (1) "networkaddress.cache.ttl"(30 sec) - cache policy for successful lookups >> (2) "networkaddress.cache.negative.ttl"(10 sec) - cache policy for negative lookups >> >> The default timeout for positive responses is good enough to "have recent dns-records" and to "minimize the number of requests to the DNS server". >> >> But the cache for the negative responses is problematic. This is a problem I would like to solve. Caching the negative response means that for **10** seconds the application will not be able to connect to the server. >> >> Possible solutions: >> 1. Decreasing timeout "for the negative responses": unfortunately more requests to the server at the moment of "DNS-outage" cause even more issues, since this is not the right moment to load the network/server more. >> 2. Increasing timeout "for the positive responses": this will decrease the chance to get an error, but the cache will start to use stale data longer. >> 3. This proposal: it would be good to ignore the negative response and continue to use the result of the last "successful lookup" until some additional timeout. >> >> The idea is to split the notion of the TTL and the timeout used for the cache. When TTL for the record will expire we should request the new data from the server. If this request goes fine we will update the record, if it fails we will continue to use the cached date until the next sync. >> >> For example, if the new property "networkaddress.cache.extended.ttl" is set to 10 minutes, then we will cache a positive response for 10 minutes but will try to sync it every 30 seconds. If the new property is not set then as before we will cache positive for 30 seconds and then cache the negative response for 10 seconds. >> >> >> RFC 8767 Serving Stale Data to Improve DNS Resiliency: >> https://www.rfc-editor.org/rfc/rfc8767 >> >> Comments about current and other possible implementations: >> * The code intentionally moved to the separate ValidAddresses class, just to make clear that the default configuration, when the new property is not set is not changed much. >> * The refr... > > Sergey Bylokhov has updated the pull request incrementally with one additional commit since the last revision: > > CSR feedback LGTM Having it in 22 early will increase the test exposure. ------------- Marked as reviewed by dfuchs (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/13285#pullrequestreview-1472195416 From jpai at openjdk.org Fri Jun 9 15:06:03 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Fri, 9 Jun 2023 15:06:03 GMT Subject: RFR: 8308184: Launching java with large number of jars in classpath with java.protocol.handler.pkgs system property set can lead to StackOverflowError Message-ID: Can I please get a review of this change which proposes to fix the issue noted in https://bugs.openjdk.org/browse/JDK-8308184? When an application is launched, the `app` classloader internally uses a `jdk.internal.loader.URLClassPath` to find and load the main class being launched. The `URLClassPath` uses a list of classpath entries to find resources. Depending on the classpath entry, the `URLClassPath` will use a relevant loader. A couple of such loaders are `URLClassPath$FileLoader` (for loading resources from directories) and `URLClassPath$JarLoader` (for loading resources from jar files). `JarLoader` creates instances of `java.net.URL` to represent the jar file being loaded. `java.net.URL` uses protocol specific `java.net.URLStreamHandler` instance to handle connections to those URLs. When constructing an instance of `URL`, callers can pass a protocol handler. If it is not passed then the `URL` class looks for protocol handlers that might have been configured by the application. The `java.protocol.handler.pkgs` system property is the one which allows overriding the protocol handlers (even for the `jar` protocol). When this property is set, the `URL` class triggers lookup and classloading of the protocol handler classes. The issue that is reported is triggered when the `java.protocol.handler.pkgs` system property is set and the classpath has too many jar files. `app` classloader triggers lookup of the main class and the `URLClassPath` picks up the first entry in the classpath and uses a `JarLoader` (in this example our classpath entries have a jar file at the beginning of the list). The `JarLoader` instantiates a `java.net.URL`, which notices that the `java.protocol.handler.pkgs` is set, so it now triggers lookup of a (different) class using the same classloader and thus the same `URLClassPath`. The `URLClassPath` picks the next classpath entry and then calls into the `URL` again through the `JarLoader`. This sequence ends up being re-entrant calls and given the large number of classpath entries, these re-entrant calls end up with a `StackOverflowError` as shown in the linked JBS issue. The commit in this PR fixes this issue by using the system provided protocol handler implementation of the `jar` protocol in the `app` classloader. This results in the `URL` instances created through the `JarLoader` to use this specific handler instance. This allows the `app` classloader which is responsible for loading the application's main class to reliably use the system provided protocol handler. Do note that this doesn't in any way impact the ability of applications to override the protocol handler for `jar` protocol. Applications can still continue to do it by setting the `java.protocol.handler.pkgs` system property to configure their application specific implementation for the `jar` protocol (or other protocols). `URL` instances created by the application code will continue to use their overridden `jar` protocol handler. The commit in this PR merely fixes the jar protocol handler that is used by the `app` classloader. A new jtreg test has been added which reproduces this issue and verifies the fix. tier testing is in progress. ------------- Commit messages: - 8308184: Launching java with large number of jars in classpath with java.protocol.handler.pkgs system property set can lead to StackOverflowError Changes: https://git.openjdk.org/jdk/pull/14395/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14395&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8308184 Stats: 148 lines in 3 files changed: 143 ins; 0 del; 5 mod Patch: https://git.openjdk.org/jdk/pull/14395.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14395/head:pull/14395 PR: https://git.openjdk.org/jdk/pull/14395 From alanb at openjdk.org Fri Jun 9 15:06:04 2023 From: alanb at openjdk.org (Alan Bateman) Date: Fri, 9 Jun 2023 15:06:04 GMT Subject: RFR: 8308184: Launching java with large number of jars in classpath with java.protocol.handler.pkgs system property set can lead to StackOverflowError In-Reply-To: References: Message-ID: On Fri, 9 Jun 2023 14:55:50 GMT, Jaikiran Pai wrote: > Can I please get a review of this change which proposes to fix the issue noted in https://bugs.openjdk.org/browse/JDK-8308184? > > When an application is launched, the `app` classloader internally uses a `jdk.internal.loader.URLClassPath` to find and load the main class being launched. The `URLClassPath` uses a list of classpath entries to find resources. Depending on the classpath entry, the `URLClassPath` will use a relevant loader. A couple of such loaders are `URLClassPath$FileLoader` (for loading resources from directories) and `URLClassPath$JarLoader` (for loading resources from jar files). > > `JarLoader` creates instances of `java.net.URL` to represent the jar file being loaded. `java.net.URL` uses protocol specific `java.net.URLStreamHandler` instance to handle connections to those URLs. When constructing an instance of `URL`, callers can pass a protocol handler. If it is not passed then the `URL` class looks for protocol handlers that might have been configured by the application. The `java.protocol.handler.pkgs` system property is the one which allows overriding the protocol handlers (even for the `jar` protocol). When this property is set, the `URL` class triggers lookup and classloading of the protocol handler classes. > > The issue that is reported is triggered when the `java.protocol.handler.pkgs` system property is set and the classpath has too many jar files. `app` classloader triggers lookup of the main class and the `URLClassPath` picks up the first entry in the classpath and uses a `JarLoader` (in this example our classpath entries have a jar file at the beginning of the list). The `JarLoader` instantiates a `java.net.URL`, which notices that the `java.protocol.handler.pkgs` is set, so it now triggers lookup of a (different) class using the same classloader and thus the same `URLClassPath`. The `URLClassPath` picks the next classpath entry and then calls into the `URL` again through the `JarLoader`. This sequence ends up being re-entrant calls and given the large number of classpath entries, these re-entrant calls end up with a `StackOverflowError` as shown in the linked JBS issue. > > The commit in this PR fixes this issue by using the system provided protocol handler implementation of the `jar` protocol in the `app` classloader. This results in the `URL` instances created through the `JarLoader` to use this specific handler instance. This allows the `app` classloader which is responsible for loading the application's main class to reliably use th... src/java.base/share/classes/jdk/internal/loader/URLClassPath.java line 186: > 184: * @apiNote Used to create the application class path. > 185: */ > 186: URLClassPath(String cp, URLStreamHandler jarHandler, boolean skipEmptyElements) { This is a special constructor for the application class path so shouldn't have the jarHandle parameter. This should allow you to drop the changes to ClassLoaders. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14395#discussion_r1224427082 From jpai at openjdk.org Fri Jun 9 15:23:09 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Fri, 9 Jun 2023 15:23:09 GMT Subject: RFR: 8308184: Launching java with large number of jars in classpath with java.protocol.handler.pkgs system property set can lead to StackOverflowError [v2] In-Reply-To: References: Message-ID: > Can I please get a review of this change which proposes to fix the issue noted in https://bugs.openjdk.org/browse/JDK-8308184? > > When an application is launched, the `app` classloader internally uses a `jdk.internal.loader.URLClassPath` to find and load the main class being launched. The `URLClassPath` uses a list of classpath entries to find resources. Depending on the classpath entry, the `URLClassPath` will use a relevant loader. A couple of such loaders are `URLClassPath$FileLoader` (for loading resources from directories) and `URLClassPath$JarLoader` (for loading resources from jar files). > > `JarLoader` creates instances of `java.net.URL` to represent the jar file being loaded. `java.net.URL` uses protocol specific `java.net.URLStreamHandler` instance to handle connections to those URLs. When constructing an instance of `URL`, callers can pass a protocol handler. If it is not passed then the `URL` class looks for protocol handlers that might have been configured by the application. The `java.protocol.handler.pkgs` system property is the one which allows overriding the protocol handlers (even for the `jar` protocol). When this property is set, the `URL` class triggers lookup and classloading of the protocol handler classes. > > The issue that is reported is triggered when the `java.protocol.handler.pkgs` system property is set and the classpath has too many jar files. `app` classloader triggers lookup of the main class and the `URLClassPath` picks up the first entry in the classpath and uses a `JarLoader` (in this example our classpath entries have a jar file at the beginning of the list). The `JarLoader` instantiates a `java.net.URL`, which notices that the `java.protocol.handler.pkgs` is set, so it now triggers lookup of a (different) class using the same classloader and thus the same `URLClassPath`. The `URLClassPath` picks the next classpath entry and then calls into the `URL` again through the `JarLoader`. This sequence ends up being re-entrant calls and given the large number of classpath entries, these re-entrant calls end up with a `StackOverflowError` as shown in the linked JBS issue. > > The commit in this PR fixes this issue by using the system provided protocol handler implementation of the `jar` protocol in the `app` classloader. This results in the `URL` instances created through the `JarLoader` to use this specific handler instance. This allows the `app` classloader which is responsible for loading the application's main class to reliably use th... Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: Alan's review suggestion - no need to pass jarHandler as a parameter to the URLClassPath ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14395/files - new: https://git.openjdk.org/jdk/pull/14395/files/418dd36d..2fdb5679 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14395&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14395&range=00-01 Stats: 15 lines in 2 files changed: 4 ins; 6 del; 5 mod Patch: https://git.openjdk.org/jdk/pull/14395.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14395/head:pull/14395 PR: https://git.openjdk.org/jdk/pull/14395 From michaelm at openjdk.org Fri Jun 9 15:33:49 2023 From: michaelm at openjdk.org (Michael McMahon) Date: Fri, 9 Jun 2023 15:33:49 GMT Subject: RFR: 8304885: Reuse stale data to improve DNS resolver resiliency [v17] In-Reply-To: References: Message-ID: On Thu, 8 Jun 2023 14:18:10 GMT, Sergey Bylokhov wrote: >> I would like to get preliminary feedback about the provided patch. >> >> Discussion on net-dev@ https://mail.openjdk.org/pipermail/net-dev/2023-March/020682.html >> >> One of the main issue I try to solve is how the cache handle the intermittent DNS server outages due to overloading or network connection. >> >> At the moment this cache can be configured by the application using the following two properties: >> (1) "networkaddress.cache.ttl"(30 sec) - cache policy for successful lookups >> (2) "networkaddress.cache.negative.ttl"(10 sec) - cache policy for negative lookups >> >> The default timeout for positive responses is good enough to "have recent dns-records" and to "minimize the number of requests to the DNS server". >> >> But the cache for the negative responses is problematic. This is a problem I would like to solve. Caching the negative response means that for **10** seconds the application will not be able to connect to the server. >> >> Possible solutions: >> 1. Decreasing timeout "for the negative responses": unfortunately more requests to the server at the moment of "DNS-outage" cause even more issues, since this is not the right moment to load the network/server more. >> 2. Increasing timeout "for the positive responses": this will decrease the chance to get an error, but the cache will start to use stale data longer. >> 3. This proposal: it would be good to ignore the negative response and continue to use the result of the last "successful lookup" until some additional timeout. >> >> The idea is to split the notion of the TTL and the timeout used for the cache. When TTL for the record will expire we should request the new data from the server. If this request goes fine we will update the record, if it fails we will continue to use the cached date until the next sync. >> >> For example, if the new property "networkaddress.cache.extended.ttl" is set to 10 minutes, then we will cache a positive response for 10 minutes but will try to sync it every 30 seconds. If the new property is not set then as before we will cache positive for 30 seconds and then cache the negative response for 10 seconds. >> >> >> RFC 8767 Serving Stale Data to Improve DNS Resiliency: >> https://www.rfc-editor.org/rfc/rfc8767 >> >> Comments about current and other possible implementations: >> * The code intentionally moved to the separate ValidAddresses class, just to make clear that the default configuration, when the new property is not set is not changed much. >> * The refr... > > Sergey Bylokhov has updated the pull request incrementally with one additional commit since the last revision: > > CSR feedback Looks good. ------------- Marked as reviewed by michaelm (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/13285#pullrequestreview-1472436178 From jpai at openjdk.org Fri Jun 9 15:47:54 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Fri, 9 Jun 2023 15:47:54 GMT Subject: RFR: 8308184: Launching java with large number of jars in classpath with java.protocol.handler.pkgs system property set can lead to StackOverflowError [v3] In-Reply-To: References: Message-ID: > Can I please get a review of this change which proposes to fix the issue noted in https://bugs.openjdk.org/browse/JDK-8308184? > > When an application is launched, the `app` classloader internally uses a `jdk.internal.loader.URLClassPath` to find and load the main class being launched. The `URLClassPath` uses a list of classpath entries to find resources. Depending on the classpath entry, the `URLClassPath` will use a relevant loader. A couple of such loaders are `URLClassPath$FileLoader` (for loading resources from directories) and `URLClassPath$JarLoader` (for loading resources from jar files). > > `JarLoader` creates instances of `java.net.URL` to represent the jar file being loaded. `java.net.URL` uses protocol specific `java.net.URLStreamHandler` instance to handle connections to those URLs. When constructing an instance of `URL`, callers can pass a protocol handler. If it is not passed then the `URL` class looks for protocol handlers that might have been configured by the application. The `java.protocol.handler.pkgs` system property is the one which allows overriding the protocol handlers (even for the `jar` protocol). When this property is set, the `URL` class triggers lookup and classloading of the protocol handler classes. > > The issue that is reported is triggered when the `java.protocol.handler.pkgs` system property is set and the classpath has too many jar files. `app` classloader triggers lookup of the main class and the `URLClassPath` picks up the first entry in the classpath and uses a `JarLoader` (in this example our classpath entries have a jar file at the beginning of the list). The `JarLoader` instantiates a `java.net.URL`, which notices that the `java.protocol.handler.pkgs` is set, so it now triggers lookup of a (different) class using the same classloader and thus the same `URLClassPath`. The `URLClassPath` picks the next classpath entry and then calls into the `URL` again through the `JarLoader`. This sequence ends up being re-entrant calls and given the large number of classpath entries, these re-entrant calls end up with a `StackOverflowError` as shown in the linked JBS issue. > > The commit in this PR fixes this issue by using the system provided protocol handler implementation of the `jar` protocol in the `app` classloader. This results in the `URL` instances created through the `JarLoader` to use this specific handler instance. This allows the `app` classloader which is responsible for loading the application's main class to reliably use th... Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: newline at end of test file ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14395/files - new: https://git.openjdk.org/jdk/pull/14395/files/2fdb5679..b1260557 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14395&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14395&range=01-02 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/14395.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14395/head:pull/14395 PR: https://git.openjdk.org/jdk/pull/14395 From jpai at openjdk.org Fri Jun 9 15:47:56 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Fri, 9 Jun 2023 15:47:56 GMT Subject: RFR: 8308184: Launching java with large number of jars in classpath with java.protocol.handler.pkgs system property set can lead to StackOverflowError [v3] In-Reply-To: References: Message-ID: <3Lv8BY42EmlwpuzfQSUZvLvZ5M3ZG47h-cQ4nmTgqi8=.71c93fb0-f206-4c97-8b4f-62f3493d5dcd@github.com> On Fri, 9 Jun 2023 15:01:47 GMT, Alan Bateman wrote: >> Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: >> >> newline at end of test file > > src/java.base/share/classes/jdk/internal/loader/URLClassPath.java line 186: > >> 184: * @apiNote Used to create the application class path. >> 185: */ >> 186: URLClassPath(String cp, URLStreamHandler jarHandler, boolean skipEmptyElements) { > > This is a special constructor for the application class path so shouldn't have the jarHandle parameter. This should allow you to drop the changes to ClassLoaders. Thank you Alan for the suggestion. I've updated the PR accordingly. The test continues to pass. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14395#discussion_r1224470836 From tsteele at openjdk.org Fri Jun 9 16:13:59 2023 From: tsteele at openjdk.org (Tyler Steele) Date: Fri, 9 Jun 2023 16:13:59 GMT Subject: RFR: 8305906: HttpClient may use incorrect key when finding pooled HTTP/2 connection for IPv6 address [v5] In-Reply-To: References: <3b7IrpY4XC5OYB3SWQ2O1xH_ZUdOn2TDhr1y8h2M2Uw=.0e4b095a-c071-444c-9f67-62b2611e7977@github.com> Message-ID: On Wed, 7 Jun 2023 06:03:25 GMT, Jaikiran Pai wrote: >> Can I please get a review of this change which proposes to fix the issue reported in https://bugs.openjdk.org/browse/JDK-8305906? >> >> As noted in that issue, when IPv6 hosts are involved, the HttpClient on certain occasions can end up caching the connection with a key which doesn't match with the key which is then used in a subsequent request against the same target host. >> >> The commit in this PR now wraps the IPv6 address in a square bracket consistently so that the correct key is used both during storing the connection in the pool and when looking up. >> >> A new jtreg test has been added which reproduces this issue without the fix and verifies the fix. > > Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: > > simplify the keyFor method to accept the entire HttpRequestImpl instance Sure. I can give it a go. ------------- PR Comment: https://git.openjdk.org/jdk/pull/13456#issuecomment-1584827469 From alanb at openjdk.org Fri Jun 9 16:45:45 2023 From: alanb at openjdk.org (Alan Bateman) Date: Fri, 9 Jun 2023 16:45:45 GMT Subject: RFR: 8308184: Launching java with large number of jars in classpath with java.protocol.handler.pkgs system property set can lead to StackOverflowError [v3] In-Reply-To: References: Message-ID: On Fri, 9 Jun 2023 15:47:54 GMT, Jaikiran Pai wrote: >> Can I please get a review of this change which proposes to fix the issue noted in https://bugs.openjdk.org/browse/JDK-8308184? >> >> When an application is launched, the `app` classloader internally uses a `jdk.internal.loader.URLClassPath` to find and load the main class being launched. The `URLClassPath` uses a list of classpath entries to find resources. Depending on the classpath entry, the `URLClassPath` will use a relevant loader. A couple of such loaders are `URLClassPath$FileLoader` (for loading resources from directories) and `URLClassPath$JarLoader` (for loading resources from jar files). >> >> `JarLoader` creates instances of `java.net.URL` to represent the jar file being loaded. `java.net.URL` uses protocol specific `java.net.URLStreamHandler` instance to handle connections to those URLs. When constructing an instance of `URL`, callers can pass a protocol handler. If it is not passed then the `URL` class looks for protocol handlers that might have been configured by the application. The `java.protocol.handler.pkgs` system property is the one which allows overriding the protocol handlers (even for the `jar` protocol). When this property is set, the `URL` class triggers lookup and classloading of the protocol handler classes. >> >> The issue that is reported is triggered when the `java.protocol.handler.pkgs` system property is set and the classpath has too many jar files. `app` classloader triggers lookup of the main class and the `URLClassPath` picks up the first entry in the classpath and uses a `JarLoader` (in this example our classpath entries have a jar file at the beginning of the list). The `JarLoader` instantiates a `java.net.URL`, which notices that the `java.protocol.handler.pkgs` is set, so it now triggers lookup of a (different) class using the same classloader and thus the same `URLClassPath`. The `URLClassPath` picks the next classpath entry and then calls into the `URL` again through the `JarLoader`. This sequence ends up being re-entrant calls and given the large number of classpath entries, these re-entrant calls end up with a `StackOverflowError` as shown in the linked JBS issue. >> >> The commit in this PR fixes this issue by using the system provided protocol handler implementation of the `jar` protocol in the `app` classloader. This results in the `URL` instances created through the `JarLoader` to use this specific handler instance. This allows the `app` classloader which is responsible for loading the application's main class ... > > Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: > > newline at end of test file src/java.base/share/classes/jdk/internal/loader/URLClassPath.java line 215: > 213: // this URLClassPath constructor is solely for the app classloader, for which we use > 214: // the system provided jar protocol handler implementation for loading jars > 215: // in the classpath The apiNote on the constructor makes it clear that the constructor is for the application class path. Also just to say that the term used in the URL docs is "built-in protocol handler". Combined then it might be clearer if the comment says that the application class loader must use the built-in protocol handler. src/java.base/share/classes/jdk/internal/loader/URLClassPath.java line 216: > 214: // the system provided jar protocol handler implementation for loading jars > 215: // in the classpath > 216: this.jarHandler = new Handler(); I wouldn't normally suggest dropping an import and using a qualified class name but "Handler" is a very generic class name, replacing it with "new sun.net.www.protocol.jar.Handler()" might be clearer. Another approach would be to move the registry/lookup of the built-in protocol handler from URL to a support class so it could be used in several places but that that might be more trouble that it is worth so what you have is okay. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14395#discussion_r1224523768 PR Review Comment: https://git.openjdk.org/jdk/pull/14395#discussion_r1224527185 From mchung at openjdk.org Fri Jun 9 17:48:43 2023 From: mchung at openjdk.org (Mandy Chung) Date: Fri, 9 Jun 2023 17:48:43 GMT Subject: RFR: 8308184: Launching java with large number of jars in classpath with java.protocol.handler.pkgs system property set can lead to StackOverflowError [v3] In-Reply-To: References: Message-ID: On Fri, 9 Jun 2023 15:47:54 GMT, Jaikiran Pai wrote: >> Can I please get a review of this change which proposes to fix the issue noted in https://bugs.openjdk.org/browse/JDK-8308184? >> >> When an application is launched, the `app` classloader internally uses a `jdk.internal.loader.URLClassPath` to find and load the main class being launched. The `URLClassPath` uses a list of classpath entries to find resources. Depending on the classpath entry, the `URLClassPath` will use a relevant loader. A couple of such loaders are `URLClassPath$FileLoader` (for loading resources from directories) and `URLClassPath$JarLoader` (for loading resources from jar files). >> >> `JarLoader` creates instances of `java.net.URL` to represent the jar file being loaded. `java.net.URL` uses protocol specific `java.net.URLStreamHandler` instance to handle connections to those URLs. When constructing an instance of `URL`, callers can pass a protocol handler. If it is not passed then the `URL` class looks for protocol handlers that might have been configured by the application. The `java.protocol.handler.pkgs` system property is the one which allows overriding the protocol handlers (even for the `jar` protocol). When this property is set, the `URL` class triggers lookup and classloading of the protocol handler classes. >> >> The issue that is reported is triggered when the `java.protocol.handler.pkgs` system property is set and the classpath has too many jar files. `app` classloader triggers lookup of the main class and the `URLClassPath` picks up the first entry in the classpath and uses a `JarLoader` (in this example our classpath entries have a jar file at the beginning of the list). The `JarLoader` instantiates a `java.net.URL`, which notices that the `java.protocol.handler.pkgs` is set, so it now triggers lookup of a (different) class using the same classloader and thus the same `URLClassPath`. The `URLClassPath` picks the next classpath entry and then calls into the `URL` again through the `JarLoader`. This sequence ends up being re-entrant calls and given the large number of classpath entries, these re-entrant calls end up with a `StackOverflowError` as shown in the linked JBS issue. >> >> The commit in this PR fixes this issue by using the system provided protocol handler implementation of the `jar` protocol in the `app` classloader. This results in the `URL` instances created through the `JarLoader` to use this specific handler instance. This allows the `app` classloader which is responsible for loading the application's main class ... > > Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: > > newline at end of test file Using the built-in jar protocol handler looks right. I like Alan's suggestion to use the fully qualified name in the source to make it clearer. test/jdk/java/net/URL/HandlersPkgPrefix/LargeClasspathWithPkgPrefix.java line 115: > 113: // javac -d > 114: private static void compile(Path javaFile, Path destDir) throws Exception { > 115: String javacPath = JDKToolFinder.getJDKTool("javac"); FYI. `jdk.test.lib.compiler.CompilerUtils` can be used to compile classes in process. ------------- Marked as reviewed by mchung (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14395#pullrequestreview-1472770525 PR Review Comment: https://git.openjdk.org/jdk/pull/14395#discussion_r1224585461 From duke at openjdk.org Fri Jun 9 18:11:37 2023 From: duke at openjdk.org (Deepa Kumari) Date: Fri, 9 Jun 2023 18:11:37 GMT Subject: RFR: 8308807: [AIX] MulticastSocket and jdp test fails due to joinGroup In-Reply-To: References: <4tkYKvpBoxO7IK4HevAqpEY5KoqxXUK6rs0scqyxgJc=.69de9b21-5a2f-45ef-b05f-1bc8ad398dad@github.com> Message-ID: On Tue, 6 Jun 2023 07:25:57 GMT, Alan Bateman wrote: >> I've moved the JBS issue to the right place and fix the description. >> >> The changes proposed here impact all platforms and will require discussion and cleanup. If I understand the intent, if you create a DatagramSocket or MulticastSocket that is bound to a specific local address then you want to use that to determine if the underlying socket is IPv4 or IPv6. That might be okay but multicasting normally means binding to the wildcard address so it doesn't help - I assume it only works for the test because new InetSocketAddress(port).getAddress() returns an Inet4Address so you get an IPv4 socket. It should only create a dual IPv4/IPv6 socket for this case so this is why it will break other platforms. In any case, can you look at the isXXX methods defined by sun.nio.ch.Net to see how it is handled on other platforms. > >> Yes, I agree with @AlanBateman and @msheppar . Even when we try to have an IPv4 multicast socket join an IPv4 multicast group, we still fail because the delegate that is created for an IPv4 multicast socket is IPv4/IPv6 (dual stack) in nature. AIX does not allow dual stack (IPv4/IPv6) sockets to join IPv4 multicast groups. > > The "Platform dependencies" section in the java.nio.channels.MulticastChannel (implemented by DatagramChannel) makes it clear that it is implementation specific as to whether a channel to an IPv6 socket can join an IPv4 multicast group. The recommendation is to specify the protocol family when creating the channel. Legacy DatagramSocket/MulticastSocket do not define a constructor that allows the protocol family be specified at xxxSocket create time. That issue has been there since JDK 1.4 when IPv6 support was added. I'm curious why this might be coming up with AIX now. Here, We are looking at all of the test failures mentioned in the JBS issue right now and trying to fix them . So, @AlanBateman Do you have any suggestion to fix these tests? I would be happy to look into that. Thanks. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14142#issuecomment-1584958570 From serb at openjdk.org Fri Jun 9 23:25:00 2023 From: serb at openjdk.org (Sergey Bylokhov) Date: Fri, 9 Jun 2023 23:25:00 GMT Subject: Integrated: 8304885: Reuse stale data to improve DNS resolver resiliency In-Reply-To: References: Message-ID: <4tSstu3qcBX9RXzAe4mSIJST4Lv1GKokDoJsMCowvGA=.4cbaf4eb-9fa9-4f19-8218-ee6d834f0096@github.com> On Mon, 3 Apr 2023 05:30:38 GMT, Sergey Bylokhov wrote: > I would like to get preliminary feedback about the provided patch. > > Discussion on net-dev@ https://mail.openjdk.org/pipermail/net-dev/2023-March/020682.html > > One of the main issue I try to solve is how the cache handle the intermittent DNS server outages due to overloading or network connection. > > At the moment this cache can be configured by the application using the following two properties: > (1) "networkaddress.cache.ttl"(30 sec) - cache policy for successful lookups > (2) "networkaddress.cache.negative.ttl"(10 sec) - cache policy for negative lookups > > The default timeout for positive responses is good enough to "have recent dns-records" and to "minimize the number of requests to the DNS server". > > But the cache for the negative responses is problematic. This is a problem I would like to solve. Caching the negative response means that for **10** seconds the application will not be able to connect to the server. > > Possible solutions: > 1. Decreasing timeout "for the negative responses": unfortunately more requests to the server at the moment of "DNS-outage" cause even more issues, since this is not the right moment to load the network/server more. > 2. Increasing timeout "for the positive responses": this will decrease the chance to get an error, but the cache will start to use stale data longer. > 3. This proposal: it would be good to ignore the negative response and continue to use the result of the last "successful lookup" until some additional timeout. > > The idea is to split the notion of the TTL and the timeout used for the cache. When TTL for the record will expire we should request the new data from the server. If this request goes fine we will update the record, if it fails we will continue to use the cached date until the next sync. > > For example, if the new property "networkaddress.cache.extended.ttl" is set to 10 minutes, then we will cache a positive response for 10 minutes but will try to sync it every 30 seconds. If the new property is not set then as before we will cache positive for 30 seconds and then cache the negative response for 10 seconds. > > > RFC 8767 Serving Stale Data to Improve DNS Resiliency: > https://www.rfc-editor.org/rfc/rfc8767 > > Comments about current and other possible implementations: > * The code intentionally moved to the separate ValidAddresses class, just to make clear that the default configuration, when the new property is not set is not changed much. > * The refresh timeout includes the time spent on the server lookup. So... This pull request has now been integrated. Changeset: bdd81b31 Author: Sergey Bylokhov URL: https://git.openjdk.org/jdk/commit/bdd81b31825a9eb6a0f0883fca56a011ac2aebf8 Stats: 516 lines in 16 files changed: 429 ins; 55 del; 32 mod 8304885: Reuse stale data to improve DNS resolver resiliency Reviewed-by: michaelm, dfuchs ------------- PR: https://git.openjdk.org/jdk/pull/13285 From jpai at openjdk.org Sat Jun 10 01:21:39 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Sat, 10 Jun 2023 01:21:39 GMT Subject: RFR: 8308184: Launching java with large number of jars in classpath with java.protocol.handler.pkgs system property set can lead to StackOverflowError [v4] In-Reply-To: References: Message-ID: <2F1C0gU9OvBMqrVj7LzO2aqZA-aLXRakqvIxAb-9iJs=.c8581831-5e74-46f9-8142-f68b82350bd4@github.com> > Can I please get a review of this change which proposes to fix the issue noted in https://bugs.openjdk.org/browse/JDK-8308184? > > When an application is launched, the `app` classloader internally uses a `jdk.internal.loader.URLClassPath` to find and load the main class being launched. The `URLClassPath` uses a list of classpath entries to find resources. Depending on the classpath entry, the `URLClassPath` will use a relevant loader. A couple of such loaders are `URLClassPath$FileLoader` (for loading resources from directories) and `URLClassPath$JarLoader` (for loading resources from jar files). > > `JarLoader` creates instances of `java.net.URL` to represent the jar file being loaded. `java.net.URL` uses protocol specific `java.net.URLStreamHandler` instance to handle connections to those URLs. When constructing an instance of `URL`, callers can pass a protocol handler. If it is not passed then the `URL` class looks for protocol handlers that might have been configured by the application. The `java.protocol.handler.pkgs` system property is the one which allows overriding the protocol handlers (even for the `jar` protocol). When this property is set, the `URL` class triggers lookup and classloading of the protocol handler classes. > > The issue that is reported is triggered when the `java.protocol.handler.pkgs` system property is set and the classpath has too many jar files. `app` classloader triggers lookup of the main class and the `URLClassPath` picks up the first entry in the classpath and uses a `JarLoader` (in this example our classpath entries have a jar file at the beginning of the list). The `JarLoader` instantiates a `java.net.URL`, which notices that the `java.protocol.handler.pkgs` is set, so it now triggers lookup of a (different) class using the same classloader and thus the same `URLClassPath`. The `URLClassPath` picks the next classpath entry and then calls into the `URL` again through the `JarLoader`. This sequence ends up being re-entrant calls and given the large number of classpath entries, these re-entrant calls end up with a `StackOverflowError` as shown in the linked JBS issue. > > The commit in this PR fixes this issue by using the system provided protocol handler implementation of the `jar` protocol in the `app` classloader. This results in the `URL` instances created through the `JarLoader` to use this specific handler instance. This allows the `app` classloader which is responsible for loading the application's main class to reliably use th... Jaikiran Pai has updated the pull request incrementally with three additional commits since the last revision: - minor comment adjustment on test method - Mandy's suggestion - use CompilerUtils for in-process compilation - minor code comment change and use fully qualified classname at call site ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14395/files - new: https://git.openjdk.org/jdk/pull/14395/files/b1260557..39d7ea28 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14395&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14395&range=02-03 Stats: 18 lines in 2 files changed: 2 ins; 6 del; 10 mod Patch: https://git.openjdk.org/jdk/pull/14395.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14395/head:pull/14395 PR: https://git.openjdk.org/jdk/pull/14395 From jpai at openjdk.org Sat Jun 10 01:21:42 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Sat, 10 Jun 2023 01:21:42 GMT Subject: RFR: 8308184: Launching java with large number of jars in classpath with java.protocol.handler.pkgs system property set can lead to StackOverflowError [v3] In-Reply-To: References: Message-ID: On Fri, 9 Jun 2023 16:42:21 GMT, Alan Bateman wrote: > I wouldn't normally suggest dropping an import and using a qualified class name but "Handler" is a very generic class name, replacing it with "new sun.net.www.protocol.jar.Handler()" might be clearer. I agree. I have now updated the PR to use the fully qualified name at the call site and also adjusted the code comment as recommended. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14395#discussion_r1224950954 From jpai at openjdk.org Sat Jun 10 01:21:44 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Sat, 10 Jun 2023 01:21:44 GMT Subject: RFR: 8308184: Launching java with large number of jars in classpath with java.protocol.handler.pkgs system property set can lead to StackOverflowError [v3] In-Reply-To: References: Message-ID: <7ni-A5R5dQ_mN49wgVhKR6Bv25NI7z-pwFIYxlhXm4M=.13e6c838-80da-4def-80ca-3e65f8e26228@github.com> On Fri, 9 Jun 2023 17:40:58 GMT, Mandy Chung wrote: >> Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: >> >> newline at end of test file > > test/jdk/java/net/URL/HandlersPkgPrefix/LargeClasspathWithPkgPrefix.java line 115: > >> 113: // javac -d >> 114: private static void compile(Path javaFile, Path destDir) throws Exception { >> 115: String javacPath = JDKToolFinder.getJDKTool("javac"); > > FYI. `jdk.test.lib.compiler.CompilerUtils` can be used to compile classes in process. Thank you Mandy, this is useful, I wasn't aware of this one. I have now updated the test to use this utility class. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14395#discussion_r1224951220 From jpai at openjdk.org Sat Jun 10 05:16:28 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Sat, 10 Jun 2023 05:16:28 GMT Subject: RFR: 8308184: Launching java with large number of jars in classpath with java.protocol.handler.pkgs system property set can lead to StackOverflowError [v5] In-Reply-To: References: Message-ID: <1ErvU2_EMZH071GN6vX_ipZCB1EGegBMDOD-f_Mq6qg=.394e9487-934d-406c-9240-aa0c53c38846@github.com> > Can I please get a review of this change which proposes to fix the issue noted in https://bugs.openjdk.org/browse/JDK-8308184? > > When an application is launched, the `app` classloader internally uses a `jdk.internal.loader.URLClassPath` to find and load the main class being launched. The `URLClassPath` uses a list of classpath entries to find resources. Depending on the classpath entry, the `URLClassPath` will use a relevant loader. A couple of such loaders are `URLClassPath$FileLoader` (for loading resources from directories) and `URLClassPath$JarLoader` (for loading resources from jar files). > > `JarLoader` creates instances of `java.net.URL` to represent the jar file being loaded. `java.net.URL` uses protocol specific `java.net.URLStreamHandler` instance to handle connections to those URLs. When constructing an instance of `URL`, callers can pass a protocol handler. If it is not passed then the `URL` class looks for protocol handlers that might have been configured by the application. The `java.protocol.handler.pkgs` system property is the one which allows overriding the protocol handlers (even for the `jar` protocol). When this property is set, the `URL` class triggers lookup and classloading of the protocol handler classes. > > The issue that is reported is triggered when the `java.protocol.handler.pkgs` system property is set and the classpath has too many jar files. `app` classloader triggers lookup of the main class and the `URLClassPath` picks up the first entry in the classpath and uses a `JarLoader` (in this example our classpath entries have a jar file at the beginning of the list). The `JarLoader` instantiates a `java.net.URL`, which notices that the `java.protocol.handler.pkgs` is set, so it now triggers lookup of a (different) class using the same classloader and thus the same `URLClassPath`. The `URLClassPath` picks the next classpath entry and then calls into the `URL` again through the `JarLoader`. This sequence ends up being re-entrant calls and given the large number of classpath entries, these re-entrant calls end up with a `StackOverflowError` as shown in the linked JBS issue. > > The commit in this PR fixes this issue by using the system provided protocol handler implementation of the `jar` protocol in the `app` classloader. This results in the `URL` instances created through the `JarLoader` to use this specific handler instance. This allows the `app` classloader which is responsible for loading the application's main class to reliably use th... Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: minor update to the test to allow tracking the time taken to create the jars for debug purpose ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14395/files - new: https://git.openjdk.org/jdk/pull/14395/files/39d7ea28..362ef5ce Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14395&range=04 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14395&range=03-04 Stats: 5 lines in 1 file changed: 3 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/14395.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14395/head:pull/14395 PR: https://git.openjdk.org/jdk/pull/14395 From alanb at openjdk.org Sat Jun 10 06:21:43 2023 From: alanb at openjdk.org (Alan Bateman) Date: Sat, 10 Jun 2023 06:21:43 GMT Subject: RFR: 8308184: Launching java with large number of jars in classpath with java.protocol.handler.pkgs system property set can lead to StackOverflowError [v5] In-Reply-To: <1ErvU2_EMZH071GN6vX_ipZCB1EGegBMDOD-f_Mq6qg=.394e9487-934d-406c-9240-aa0c53c38846@github.com> References: <1ErvU2_EMZH071GN6vX_ipZCB1EGegBMDOD-f_Mq6qg=.394e9487-934d-406c-9240-aa0c53c38846@github.com> Message-ID: On Sat, 10 Jun 2023 05:16:28 GMT, Jaikiran Pai wrote: >> Can I please get a review of this change which proposes to fix the issue noted in https://bugs.openjdk.org/browse/JDK-8308184? >> >> When an application is launched, the `app` classloader internally uses a `jdk.internal.loader.URLClassPath` to find and load the main class being launched. The `URLClassPath` uses a list of classpath entries to find resources. Depending on the classpath entry, the `URLClassPath` will use a relevant loader. A couple of such loaders are `URLClassPath$FileLoader` (for loading resources from directories) and `URLClassPath$JarLoader` (for loading resources from jar files). >> >> `JarLoader` creates instances of `java.net.URL` to represent the jar file being loaded. `java.net.URL` uses protocol specific `java.net.URLStreamHandler` instance to handle connections to those URLs. When constructing an instance of `URL`, callers can pass a protocol handler. If it is not passed then the `URL` class looks for protocol handlers that might have been configured by the application. The `java.protocol.handler.pkgs` system property is the one which allows overriding the protocol handlers (even for the `jar` protocol). When this property is set, the `URL` class triggers lookup and classloading of the protocol handler classes. >> >> The issue that is reported is triggered when the `java.protocol.handler.pkgs` system property is set and the classpath has too many jar files. `app` classloader triggers lookup of the main class and the `URLClassPath` picks up the first entry in the classpath and uses a `JarLoader` (in this example our classpath entries have a jar file at the beginning of the list). The `JarLoader` instantiates a `java.net.URL`, which notices that the `java.protocol.handler.pkgs` is set, so it now triggers lookup of a (different) class using the same classloader and thus the same `URLClassPath`. The `URLClassPath` picks the next classpath entry and then calls into the `URL` again through the `JarLoader`. This sequence ends up being re-entrant calls and given the large number of classpath entries, these re-entrant calls end up with a `StackOverflowError` as shown in the linked JBS issue. >> >> The commit in this PR fixes this issue by using the system provided protocol handler implementation of the `jar` protocol in the `app` classloader. This results in the `URL` instances created through the `JarLoader` to use this specific handler instance. This allows the `app` classloader which is responsible for loading the application's main class ... > > Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: > > minor update to the test to allow tracking the time taken to create the jars for debug purpose Thanks for taking this one. My guess is that this issue goes back 20+ but not noticed because it's running with the system property to specify another location for protocol handlers is probably rare, and it seems a scanning of a large large class path to trigger it. I assume you'll see the comment about moving the test to be with the other tests for URLClassPath. src/java.base/share/classes/jdk/internal/loader/URLClassPath.java line 212: > 210: // the application class loader uses the built-in protocol handler to avoid protocol > 211: // handler lookup when opening JAR files on the class path. > 212: this.jarHandler = new sun.net.www.protocol.jar.Handler(); Good, this looks much better. test/jdk/java/net/URL/HandlersPkgPrefix/LargeClasspathWithPkgPrefix.java line 44: > 42: * @run driver LargeClasspathWithPkgPrefix > 43: */ > 44: public class LargeClasspathWithPkgPrefix { test/jdk/java/net/URL/HandlersPkgPrefix is an unusual location for the test, maybe it could move to test/jdk/sun/misc/URLClassPath so it's the same location as the other tests for URLClassPath. Separately (not suggesting it for this PR) is that test directory should probably be renamed to jdk/internal/loader as the URLClassPath moved in JDK 9. ------------- Marked as reviewed by alanb (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14395#pullrequestreview-1473325189 PR Review Comment: https://git.openjdk.org/jdk/pull/14395#discussion_r1225140617 PR Review Comment: https://git.openjdk.org/jdk/pull/14395#discussion_r1225140504 From jpai at openjdk.org Sat Jun 10 06:44:56 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Sat, 10 Jun 2023 06:44:56 GMT Subject: RFR: 8308184: Launching java with large number of jars in classpath with java.protocol.handler.pkgs system property set can lead to StackOverflowError [v6] In-Reply-To: References: Message-ID: > Can I please get a review of this change which proposes to fix the issue noted in https://bugs.openjdk.org/browse/JDK-8308184? > > When an application is launched, the `app` classloader internally uses a `jdk.internal.loader.URLClassPath` to find and load the main class being launched. The `URLClassPath` uses a list of classpath entries to find resources. Depending on the classpath entry, the `URLClassPath` will use a relevant loader. A couple of such loaders are `URLClassPath$FileLoader` (for loading resources from directories) and `URLClassPath$JarLoader` (for loading resources from jar files). > > `JarLoader` creates instances of `java.net.URL` to represent the jar file being loaded. `java.net.URL` uses protocol specific `java.net.URLStreamHandler` instance to handle connections to those URLs. When constructing an instance of `URL`, callers can pass a protocol handler. If it is not passed then the `URL` class looks for protocol handlers that might have been configured by the application. The `java.protocol.handler.pkgs` system property is the one which allows overriding the protocol handlers (even for the `jar` protocol). When this property is set, the `URL` class triggers lookup and classloading of the protocol handler classes. > > The issue that is reported is triggered when the `java.protocol.handler.pkgs` system property is set and the classpath has too many jar files. `app` classloader triggers lookup of the main class and the `URLClassPath` picks up the first entry in the classpath and uses a `JarLoader` (in this example our classpath entries have a jar file at the beginning of the list). The `JarLoader` instantiates a `java.net.URL`, which notices that the `java.protocol.handler.pkgs` is set, so it now triggers lookup of a (different) class using the same classloader and thus the same `URLClassPath`. The `URLClassPath` picks the next classpath entry and then calls into the `URL` again through the `JarLoader`. This sequence ends up being re-entrant calls and given the large number of classpath entries, these re-entrant calls end up with a `StackOverflowError` as shown in the linked JBS issue. > > The commit in this PR fixes this issue by using the system provided protocol handler implementation of the `jar` protocol in the `app` classloader. This results in the `URL` instances created through the `JarLoader` to use this specific handler instance. This allows the `app` classloader which is responsible for loading the application's main class to reliably use th... Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: move the test to test/jdk/sun/misc/URLClassPath directory ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14395/files - new: https://git.openjdk.org/jdk/pull/14395/files/362ef5ce..5a57fe8a Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14395&range=05 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14395&range=04-05 Stats: 0 lines in 1 file changed: 0 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/14395.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14395/head:pull/14395 PR: https://git.openjdk.org/jdk/pull/14395 From alanb at openjdk.org Sat Jun 10 06:45:46 2023 From: alanb at openjdk.org (Alan Bateman) Date: Sat, 10 Jun 2023 06:45:46 GMT Subject: RFR: 8308807: [AIX] MulticastSocket and jdp test fails due to joinGroup In-Reply-To: <4tkYKvpBoxO7IK4HevAqpEY5KoqxXUK6rs0scqyxgJc=.69de9b21-5a2f-45ef-b05f-1bc8ad398dad@github.com> References: <4tkYKvpBoxO7IK4HevAqpEY5KoqxXUK6rs0scqyxgJc=.69de9b21-5a2f-45ef-b05f-1bc8ad398dad@github.com> Message-ID: On Thu, 25 May 2023 07:14:19 GMT, Deepa Kumari wrote: > DatagramSocket delegates to an inner DatagramSocket object. Irrespective of whether datagramSocket is IPv4 or IPv6, we create an IPv6 datagramChannel as its's delegate. So, This can cause problems with operations like joinGroup. > > On AIX, IPv6 datagramSocket can not join an IPv4 multicast group. > > These failures can be fixed by making sure that the delegate created for a datagram socket has the same protocol family. > > > > > Reported Issue : [JDK-8308807](https://bugs.openjdk.org/browse/JDK-8308807) @MBaesken @RealCLanger I wonder if you might have a bit of time to comment on this issue. If I read Deepa's comment correctly, she is saying that IPv6 UDP sockets on AIX cannot join IPv4 multicast groups. The spec doesn't require this but it problematic for MulticastSocket (as it has been since Java 4 when IPv6 was added). The part that I'm wondering about is what this issue might be coming up now. As I understand, SAP have supporting/maintaining/testing on AIX for a long time. Maybe your systems don't have IPv6 enabled so you never run into this? ------------- PR Comment: https://git.openjdk.org/jdk/pull/14142#issuecomment-1585521766 From jpai at openjdk.org Sat Jun 10 13:45:43 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Sat, 10 Jun 2023 13:45:43 GMT Subject: RFR: 8308184: Launching java with large number of jars in classpath with java.protocol.handler.pkgs system property set can lead to StackOverflowError [v6] In-Reply-To: References: Message-ID: On Sat, 10 Jun 2023 06:44:56 GMT, Jaikiran Pai wrote: >> Can I please get a review of this change which proposes to fix the issue noted in https://bugs.openjdk.org/browse/JDK-8308184? >> >> When an application is launched, the `app` classloader internally uses a `jdk.internal.loader.URLClassPath` to find and load the main class being launched. The `URLClassPath` uses a list of classpath entries to find resources. Depending on the classpath entry, the `URLClassPath` will use a relevant loader. A couple of such loaders are `URLClassPath$FileLoader` (for loading resources from directories) and `URLClassPath$JarLoader` (for loading resources from jar files). >> >> `JarLoader` creates instances of `java.net.URL` to represent the jar file being loaded. `java.net.URL` uses protocol specific `java.net.URLStreamHandler` instance to handle connections to those URLs. When constructing an instance of `URL`, callers can pass a protocol handler. If it is not passed then the `URL` class looks for protocol handlers that might have been configured by the application. The `java.protocol.handler.pkgs` system property is the one which allows overriding the protocol handlers (even for the `jar` protocol). When this property is set, the `URL` class triggers lookup and classloading of the protocol handler classes. >> >> The issue that is reported is triggered when the `java.protocol.handler.pkgs` system property is set and the classpath has too many jar files. `app` classloader triggers lookup of the main class and the `URLClassPath` picks up the first entry in the classpath and uses a `JarLoader` (in this example our classpath entries have a jar file at the beginning of the list). The `JarLoader` instantiates a `java.net.URL`, which notices that the `java.protocol.handler.pkgs` is set, so it now triggers lookup of a (different) class using the same classloader and thus the same `URLClassPath`. The `URLClassPath` picks the next classpath entry and then calls into the `URL` again through the `JarLoader`. This sequence ends up being re-entrant calls and given the large number of classpath entries, these re-entrant calls end up with a `StackOverflowError` as shown in the linked JBS issue. >> >> The commit in this PR fixes this issue by using the system provided protocol handler implementation of the `jar` protocol in the `app` classloader. This results in the `URL` instances created through the `JarLoader` to use this specific handler instance. This allows the `app` classloader which is responsible for loading the application's main class ... > > Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: > > move the test to test/jdk/sun/misc/URLClassPath directory Hello Alan, > Thanks for taking this one. My guess is that this issue goes back 20+ years but not noticed because it's running with the system property to specify another location for protocol handlers is probably rare, and it seems a scanning of a large large class path to trigger it. When I started looking into this issue, I was curious why this wasn't reported in Java 8 since the reporter was merely switching Java version from 8 to a newer version. When I look into Java 8 code, I see that the `sun.misc.Launcher` in Java 8 specifically deals with this case by using the built-in protocol handler and uses the bootstrap classloader for loading that hander, while launching the application's main class: https://github.com/openjdk/jdk8u-dev/blob/master/jdk/src/share/classes/sun/misc/Launcher.java#L53 https://github.com/openjdk/jdk8u-dev/blob/master/jdk/src/share/classes/sun/misc/Launcher.java#L512 I think that explains why it isn't seen in that version. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14395#issuecomment-1585669219 From jpai at openjdk.org Sat Jun 10 13:45:45 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Sat, 10 Jun 2023 13:45:45 GMT Subject: RFR: 8308184: Launching java with large number of jars in classpath with java.protocol.handler.pkgs system property set can lead to StackOverflowError [v5] In-Reply-To: References: <1ErvU2_EMZH071GN6vX_ipZCB1EGegBMDOD-f_Mq6qg=.394e9487-934d-406c-9240-aa0c53c38846@github.com> Message-ID: <3vgCaO9kdHXB7Z1pYpz4Kg8jnSBAm9Pjfn_HhU56KrA=.08ea249e-2056-49f3-9460-07200518b40f@github.com> On Sat, 10 Jun 2023 06:18:32 GMT, Alan Bateman wrote: > I assume you'll see the comment about moving the test to be with the other tests for URLClassPath. I have updated the PR to change the location of this new test class. Additionally I've filed https://bugs.openjdk.org/browse/JDK-8309763 to move the `sun/misc/URLClassPath` tests to `jdk/internal/loader` directory. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14395#issuecomment-1585669931 From alanb at openjdk.org Sat Jun 10 19:01:58 2023 From: alanb at openjdk.org (Alan Bateman) Date: Sat, 10 Jun 2023 19:01:58 GMT Subject: RFR: 8308184: Launching java with large number of jars in classpath with java.protocol.handler.pkgs system property set can lead to StackOverflowError [v6] In-Reply-To: References: Message-ID: On Sat, 10 Jun 2023 06:44:56 GMT, Jaikiran Pai wrote: >> Can I please get a review of this change which proposes to fix the issue noted in https://bugs.openjdk.org/browse/JDK-8308184? >> >> When an application is launched, the `app` classloader internally uses a `jdk.internal.loader.URLClassPath` to find and load the main class being launched. The `URLClassPath` uses a list of classpath entries to find resources. Depending on the classpath entry, the `URLClassPath` will use a relevant loader. A couple of such loaders are `URLClassPath$FileLoader` (for loading resources from directories) and `URLClassPath$JarLoader` (for loading resources from jar files). >> >> `JarLoader` creates instances of `java.net.URL` to represent the jar file being loaded. `java.net.URL` uses protocol specific `java.net.URLStreamHandler` instance to handle connections to those URLs. When constructing an instance of `URL`, callers can pass a protocol handler. If it is not passed then the `URL` class looks for protocol handlers that might have been configured by the application. The `java.protocol.handler.pkgs` system property is the one which allows overriding the protocol handlers (even for the `jar` protocol). When this property is set, the `URL` class triggers lookup and classloading of the protocol handler classes. >> >> The issue that is reported is triggered when the `java.protocol.handler.pkgs` system property is set and the classpath has too many jar files. `app` classloader triggers lookup of the main class and the `URLClassPath` picks up the first entry in the classpath and uses a `JarLoader` (in this example our classpath entries have a jar file at the beginning of the list). The `JarLoader` instantiates a `java.net.URL`, which notices that the `java.protocol.handler.pkgs` is set, so it now triggers lookup of a (different) class using the same classloader and thus the same `URLClassPath`. The `URLClassPath` picks the next classpath entry and then calls into the `URL` again through the `JarLoader`. This sequence ends up being re-entrant calls and given the large number of classpath entries, these re-entrant calls end up with a `StackOverflowError` as shown in the linked JBS issue. >> >> The commit in this PR fixes this issue by using the system provided protocol handler implementation of the `jar` protocol in the `app` classloader. This results in the `URL` instances created through the `JarLoader` to use this specific handler instance. This allows the `app` classloader which is responsible for loading the application's main class ... > > Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: > > move the test to test/jdk/sun/misc/URLClassPath directory Marked as reviewed by alanb (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14395#pullrequestreview-1473475851 From alanb at openjdk.org Sat Jun 10 19:02:00 2023 From: alanb at openjdk.org (Alan Bateman) Date: Sat, 10 Jun 2023 19:02:00 GMT Subject: RFR: 8308184: Launching java with large number of jars in classpath with java.protocol.handler.pkgs system property set can lead to StackOverflowError [v6] In-Reply-To: References: Message-ID: On Sat, 10 Jun 2023 13:40:30 GMT, Jaikiran Pai wrote: > When I started looking into this issue, I was curious why this wasn't reported in Java 8 since the reporter was merely switching Java version from 8 to a newer version. When I look into Java 8 code, I see that the `sun.misc.Launcher` in Java 8 specifically deals with this case by using the built-in protocol handler Thanks for the digging into that, I was curious why this hasn't come up before now. I suppose part of it is that it's rare to run with this system property to override or add URL protocol handlers. There are a number of JDK 1.0/1.1 era APIs that used this approach for pluggability. In time it may be possible to deprecate this mechanism, newer code use services and URLStreamHandlerProvider. Anyway, it's good that you've tracked this down, thanks for spending time on it. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14395#issuecomment-1585771873 From clanger at openjdk.org Mon Jun 12 08:59:52 2023 From: clanger at openjdk.org (Christoph Langer) Date: Mon, 12 Jun 2023 08:59:52 GMT Subject: RFR: 8308807: [AIX] MulticastSocket and jdp test fails due to joinGroup In-Reply-To: References: <4tkYKvpBoxO7IK4HevAqpEY5KoqxXUK6rs0scqyxgJc=.69de9b21-5a2f-45ef-b05f-1bc8ad398dad@github.com> Message-ID: On Sat, 10 Jun 2023 06:42:32 GMT, Alan Bateman wrote: > @MBaesken @RealCLanger I wonder if you might have a bit of time to comment on this issue. If I read Deepa's comment correctly, she is saying that IPv6 UDP sockets on AIX cannot join IPv4 multicast groups. The spec doesn't require this but it problematic for MulticastSocket (as it has been since Java 4 when IPv6 was added). The part that I'm wondering about is why this issue might be coming up now. As I understand, SAP have supporting/maintaining/testing on AIX for a long time. Maybe your systems don't have IPv6 enabled so you never run into this? Well, in that area we always had deviations on AIX, so definitely this rings a bell. However, since AIX was not the most important platform for us and that particular IPv6/IPv4 multicast feature didn't seem to be mission critical and wouldn't fail TCK tests, we rather resorted to excluding some tests internally, I believe. But it would be good to really resolve this compatibility/spec/documentation issue, if possible. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14142#issuecomment-1586887143 From jpai at openjdk.org Mon Jun 12 09:47:54 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Mon, 12 Jun 2023 09:47:54 GMT Subject: RFR: 8308184: Launching java with large number of jars in classpath with java.protocol.handler.pkgs system property set can lead to StackOverflowError [v6] In-Reply-To: References: Message-ID: <3lGk4K_Hp5ezIMmA5jwoJKELEdh3Mlrc_z5DvgN2xWQ=.d4132e17-a8a9-4e9e-83d8-f16c16908b25@github.com> On Sat, 10 Jun 2023 06:44:56 GMT, Jaikiran Pai wrote: >> Can I please get a review of this change which proposes to fix the issue noted in https://bugs.openjdk.org/browse/JDK-8308184? >> >> When an application is launched, the `app` classloader internally uses a `jdk.internal.loader.URLClassPath` to find and load the main class being launched. The `URLClassPath` uses a list of classpath entries to find resources. Depending on the classpath entry, the `URLClassPath` will use a relevant loader. A couple of such loaders are `URLClassPath$FileLoader` (for loading resources from directories) and `URLClassPath$JarLoader` (for loading resources from jar files). >> >> `JarLoader` creates instances of `java.net.URL` to represent the jar file being loaded. `java.net.URL` uses protocol specific `java.net.URLStreamHandler` instance to handle connections to those URLs. When constructing an instance of `URL`, callers can pass a protocol handler. If it is not passed then the `URL` class looks for protocol handlers that might have been configured by the application. The `java.protocol.handler.pkgs` system property is the one which allows overriding the protocol handlers (even for the `jar` protocol). When this property is set, the `URL` class triggers lookup and classloading of the protocol handler classes. >> >> The issue that is reported is triggered when the `java.protocol.handler.pkgs` system property is set and the classpath has too many jar files. `app` classloader triggers lookup of the main class and the `URLClassPath` picks up the first entry in the classpath and uses a `JarLoader` (in this example our classpath entries have a jar file at the beginning of the list). The `JarLoader` instantiates a `java.net.URL`, which notices that the `java.protocol.handler.pkgs` is set, so it now triggers lookup of a (different) class using the same classloader and thus the same `URLClassPath`. The `URLClassPath` picks the next classpath entry and then calls into the `URL` again through the `JarLoader`. This sequence ends up being re-entrant calls and given the large number of classpath entries, these re-entrant calls end up with a `StackOverflowError` as shown in the linked JBS issue. >> >> The commit in this PR fixes this issue by using the system provided protocol handler implementation of the `jar` protocol in the `app` classloader. This results in the `URL` instances created through the `JarLoader` to use this specific handler instance. This allows the `app` classloader which is responsible for loading the application's main class ... > > Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision: > > move the test to test/jdk/sun/misc/URLClassPath directory Thank you Alan and Mandy for the reviews. tier1, tier2, tier3 testing came back fine. I'll go ahead and merge this. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14395#issuecomment-1586976047 From jpai at openjdk.org Mon Jun 12 09:47:56 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Mon, 12 Jun 2023 09:47:56 GMT Subject: Integrated: 8308184: Launching java with large number of jars in classpath with java.protocol.handler.pkgs system property set can lead to StackOverflowError In-Reply-To: References: Message-ID: On Fri, 9 Jun 2023 14:55:50 GMT, Jaikiran Pai wrote: > Can I please get a review of this change which proposes to fix the issue noted in https://bugs.openjdk.org/browse/JDK-8308184? > > When an application is launched, the `app` classloader internally uses a `jdk.internal.loader.URLClassPath` to find and load the main class being launched. The `URLClassPath` uses a list of classpath entries to find resources. Depending on the classpath entry, the `URLClassPath` will use a relevant loader. A couple of such loaders are `URLClassPath$FileLoader` (for loading resources from directories) and `URLClassPath$JarLoader` (for loading resources from jar files). > > `JarLoader` creates instances of `java.net.URL` to represent the jar file being loaded. `java.net.URL` uses protocol specific `java.net.URLStreamHandler` instance to handle connections to those URLs. When constructing an instance of `URL`, callers can pass a protocol handler. If it is not passed then the `URL` class looks for protocol handlers that might have been configured by the application. The `java.protocol.handler.pkgs` system property is the one which allows overriding the protocol handlers (even for the `jar` protocol). When this property is set, the `URL` class triggers lookup and classloading of the protocol handler classes. > > The issue that is reported is triggered when the `java.protocol.handler.pkgs` system property is set and the classpath has too many jar files. `app` classloader triggers lookup of the main class and the `URLClassPath` picks up the first entry in the classpath and uses a `JarLoader` (in this example our classpath entries have a jar file at the beginning of the list). The `JarLoader` instantiates a `java.net.URL`, which notices that the `java.protocol.handler.pkgs` is set, so it now triggers lookup of a (different) class using the same classloader and thus the same `URLClassPath`. The `URLClassPath` picks the next classpath entry and then calls into the `URL` again through the `JarLoader`. This sequence ends up being re-entrant calls and given the large number of classpath entries, these re-entrant calls end up with a `StackOverflowError` as shown in the linked JBS issue. > > The commit in this PR fixes this issue by using the system provided protocol handler implementation of the `jar` protocol in the `app` classloader. This results in the `URL` instances created through the `JarLoader` to use this specific handler instance. This allows the `app` classloader which is responsible for loading the application's main class to reliably use th... This pull request has now been integrated. Changeset: 268ec61d Author: Jaikiran Pai URL: https://git.openjdk.org/jdk/commit/268ec61d4fa9c5b7d2c7bcafb942b33e5b189974 Stats: 145 lines in 2 files changed: 142 ins; 2 del; 1 mod 8308184: Launching java with large number of jars in classpath with java.protocol.handler.pkgs system property set can lead to StackOverflowError Reviewed-by: mchung, alanb ------------- PR: https://git.openjdk.org/jdk/pull/14395 From alanb at openjdk.org Mon Jun 12 11:12:44 2023 From: alanb at openjdk.org (Alan Bateman) Date: Mon, 12 Jun 2023 11:12:44 GMT Subject: RFR: 8308807: [AIX] MulticastSocket and jdp test fails due to joinGroup In-Reply-To: References: <4tkYKvpBoxO7IK4HevAqpEY5KoqxXUK6rs0scqyxgJc=.69de9b21-5a2f-45ef-b05f-1bc8ad398dad@github.com> Message-ID: On Mon, 12 Jun 2023 08:57:19 GMT, Christoph Langer wrote: > Well, in that area we always had deviations on AIX, so definitely this rings a bell. However, since AIX was not the most important platform for us and that particular IPv6/IPv4 multicast feature didn't seem to be mission critical and wouldn't fail TCK tests, we rather resorted to excluding some tests internally, I believe. But it would be good to really resolve this compatibility/spec/documentation issue, if possible. Thanks. So yes, if some/all of the tests for multicasting were excluded then it helps explain why it didn't come up. The spec doesn't require that a DatgaramChannel or DatagramChannel to an IPv6 socket be capable of joining an IPv4 multicast group. So the tests in several areas might need as I don't think we've had a platform to date where it wasn't possible. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14142#issuecomment-1587110996 From duke at openjdk.org Mon Jun 12 19:30:52 2023 From: duke at openjdk.org (Deepa Kumari) Date: Mon, 12 Jun 2023 19:30:52 GMT Subject: RFR: 8308807: [AIX] MulticastSocket and jdp test fails due to joinGroup In-Reply-To: References: <4tkYKvpBoxO7IK4HevAqpEY5KoqxXUK6rs0scqyxgJc=.69de9b21-5a2f-45ef-b05f-1bc8ad398dad@github.com> Message-ID: <5ai8MHV2EQmFEcuMNWYM7Rz88cUl9dVnXNQolLQ3Jp8=.af5976df-6b30-4842-9b5a-7550e2fcdd0a@github.com> On Mon, 12 Jun 2023 11:09:32 GMT, Alan Bateman wrote: > > Well, in that area we always had deviations on AIX, so definitely this rings a bell. However, since AIX was not the most important platform for us and that particular IPv6/IPv4 multicast feature didn't seem to be mission critical and wouldn't fail TCK tests, we rather resorted to excluding some tests internally, I believe. But it would be good to really resolve this compatibility/spec/documentation issue, if possible. > > Thanks. So yes, if some/all of the tests for multicasting were excluded then it helps explain why it didn't come up. The spec doesn't require that a DatgaramSocket or DatagramChannel to an IPv6 socket be capable of joining an IPv4 multicast group. So the tests in several areas might need updates as I don't think we've had a platform to date where it wasn't possible. @AlanBateman , is it possible if there is a central place where the change could me made for fixing all of the multicast test cases? ------------- PR Comment: https://git.openjdk.org/jdk/pull/14142#issuecomment-1587947194 From alanb at openjdk.org Tue Jun 13 07:04:41 2023 From: alanb at openjdk.org (Alan Bateman) Date: Tue, 13 Jun 2023 07:04:41 GMT Subject: RFR: 8308807: [AIX] MulticastSocket and jdp test fails due to joinGroup In-Reply-To: References: <4tkYKvpBoxO7IK4HevAqpEY5KoqxXUK6rs0scqyxgJc=.69de9b21-5a2f-45ef-b05f-1bc8ad398dad@github.com> Message-ID: On Mon, 12 Jun 2023 11:09:32 GMT, Alan Bateman wrote: >>> @MBaesken @RealCLanger I wonder if you might have a bit of time to comment on this issue. If I read Deepa's comment correctly, she is saying that IPv6 UDP sockets on AIX cannot join IPv4 multicast groups. The spec doesn't require this but it problematic for MulticastSocket (as it has been since Java 4 when IPv6 was added). The part that I'm wondering about is why this issue might be coming up now. As I understand, SAP have supporting/maintaining/testing on AIX for a long time. Maybe your systems don't have IPv6 enabled so you never run into this? >> >> Well, in that area we always had deviations on AIX, so definitely this rings a bell. However, since AIX was not the most important platform for us and that particular IPv6/IPv4 multicast feature didn't seem to be mission critical and wouldn't fail TCK tests, we rather resorted to excluding some tests internally, I believe. But it would be good to really resolve this compatibility/spec/documentation issue, if possible. > >> Well, in that area we always had deviations on AIX, so definitely this rings a bell. However, since AIX was not the most important platform for us and that particular IPv6/IPv4 multicast feature didn't seem to be mission critical and wouldn't fail TCK tests, we rather resorted to excluding some tests internally, I believe. But it would be good to really resolve this compatibility/spec/documentation issue, if possible. > > Thanks. So yes, if some/all of the tests for multicasting were excluded then it helps explain why it didn't come up. The spec doesn't require that a DatgaramSocket or DatagramChannel to an IPv6 socket be capable of joining an IPv4 multicast group. So the tests in several areas might need updates as I don't think we've had a platform to date where it wasn't possible. > @AlanBateman , is it possible if there is a central place where the change could me made for fixing all of the multicast test cases? Your starting point is probably to exclude all of the tests that are failing. This will be tests for DatagramSocket/MulticastSocket, DatagramChannel and the tests for the JMX agent that use the discovery protocol. Once they are excluded then you can start working through the issues. For the JMX agent, then I would expect that if if the system property com.sun.management.jdp.address is configured then the protocol family is known so it should be possible to create the DatagramChannel to use that protocol family. It might so already, but you can check that. For the networking and NIO tests then you probably should look at jdk.test.lib.NetworkConfiguration. That has a number of AIX specific comments that may be out of date. After that I think you will need to work through the tests one by one. Between NetworkConfiguration and jdk.test.lib.net.IPSupport, I would expect you have all the infrastructure needed for the tests to not attempt to join IPv4 multicast groups when IPSupport.hasIPv6() is true. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14142#issuecomment-1588666107 From alanb at openjdk.org Tue Jun 13 07:26:50 2023 From: alanb at openjdk.org (Alan Bateman) Date: Tue, 13 Jun 2023 07:26:50 GMT Subject: RFR: 8308593: Add Keepalive Extended Socket Options Support for Windows In-Reply-To: <7yOv2rc-pawQNLJSkjIU_fP2Z0hofqh1SMvN0dihFUk=.75f29eed-dbc0-48b6-8e59-86750691e6c1@github.com> References: <7yOv2rc-pawQNLJSkjIU_fP2Z0hofqh1SMvN0dihFUk=.75f29eed-dbc0-48b6-8e59-86750691e6c1@github.com> Message-ID: <9Qc7jA1I12yBiwskkvXi_2Y_IlEymkkvH2-u29w_kns=.71e358c2-4d4e-4ef9-a71c-17a6656761bb@github.com> On Tue, 30 May 2023 22:46:05 GMT, Terry Chow wrote: > The PR adds support for setting the keepalive extended socket options on Windows. The implemented native code uses the SIO_KEEPALIVE_VALS control code, which is how keepalive values are set on Windows and so there are a few caveats. > > 1. The keepalive time and keepalive interval must both be set at the same time. In the implementation, a new SioKeepAlive class and ExtendedSocketOptions is created to capture this behaviour for Windows only. Keepalive enablement must also be configured when using SIO_KEEPALIVE_VALS, and so by default when setting keepalive time and keepalive interval, > keepalive will automatically be enabled. > > [SIO_KEEPALIVE_VALS doc](https://learn.microsoft.com/en-us/windows/win32/winsock/sio-keepalive-vals) > > 2. It doesn't seem possible to acquire the Keepalive time and keepalive interval values on Windows. So, the implementation doesn't support acquiring the values. > > https://stackoverflow.com/questions/14197347/how-to-query-socket-keep-alive-values-using-winsock/14198462#14198462 > https://stackoverflow.com/questions/18391341/reading-sio-keepalive-vals-fields-on-a-windows-socket-for-keepalive-idle-and-in > > 3. Keepalive probes are not supported. On Windows Vista and later, the number of keep-alive probes is set to 10 and cannot be changed. > > [SIO_KEEPALIVE_VALS Remarks](https://learn.microsoft.com/en-us/windows/win32/winsock/sio-keepalive-vals#remarks) > > For testing, I've updated the existing keepalive tests. But, since it's not possible to acquire the keepalive values on Windows to verify, I've indirectly tested setting the keepalive values by confirming keepalive is enabled where possible (since keepalive is enabled also when keepalive values are set). In the discussion on net-dev/nio-dev, Daniel Jeli?ski pointed out that Windows does have TCP_KEEPIDLE and TCP_KEEPINTVL since Windows 10 version 1709. So I assume this PR can be returned to closed or re-returned to draft while the implementation changes are developed to make use of these socket options. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14232#issuecomment-1588700452 From jpai at openjdk.org Tue Jun 13 09:34:17 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Tue, 13 Jun 2023 09:34:17 GMT Subject: RFR: 8309910: Introduce jdk.internal.net.http.HttpConnection.getSNIServerNames() method Message-ID: Can I please get a review of this change which addresses https://bugs.openjdk.org/browse/JDK-8309910? As noted in that issue, this introduces a new method on the internal class `jdk.internal.net.http.HttpConnection` to return the SNI names that were used (if any) during a connection establishment. Given the nature of the change, no new tests have been introduced. Existing tests in `test/jdk/java/net/httpclient` continue to pass with this change. tier testing in CI is currently in progress. ------------- Commit messages: - 8309910: Introduce jdk.internal.net.http.HttpConnection.getSNIServerNames() method Changes: https://git.openjdk.org/jdk/pull/14443/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14443&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8309910 Stats: 56 lines in 3 files changed: 29 ins; 17 del; 10 mod Patch: https://git.openjdk.org/jdk/pull/14443.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14443/head:pull/14443 PR: https://git.openjdk.org/jdk/pull/14443 From dfuchs at openjdk.org Tue Jun 13 13:15:43 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Tue, 13 Jun 2023 13:15:43 GMT Subject: RFR: 8309910: Introduce jdk.internal.net.http.HttpConnection.getSNIServerNames() method In-Reply-To: References: Message-ID: On Tue, 13 Jun 2023 09:27:39 GMT, Jaikiran Pai wrote: > Can I please get a review of this change which addresses https://bugs.openjdk.org/browse/JDK-8309910? > > As noted in that issue, this introduces a new method on the internal class `jdk.internal.net.http.HttpConnection` to return the SNI names that were used (if any) during a connection establishment. > > Given the nature of the change, no new tests have been introduced. Existing tests in `test/jdk/java/net/httpclient` continue to pass with this change. tier testing in CI is currently in progress. Good cleanup! ------------- Marked as reviewed by dfuchs (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14443#pullrequestreview-1477143394 From dfuchs at openjdk.org Tue Jun 13 15:48:56 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Tue, 13 Jun 2023 15:48:56 GMT Subject: RFR: 8309939: HttpClient should not use Instant.now() as Instant source for deadlines Message-ID: <2he50rg26x_11srLEcMzVKcOj6BkQs6CyWsqF4WoXD8=.524fb1b2-c02b-48d8-9df0-83ed6ef3e2d1@github.com> The HttpClient uses `Instant.now()` to create deadlines for timeouts. This could have undesirable effects since `Instant.now()` is linked to the wall clock, which is not monotonic. This fix changes the HttpClient to use a monotonic instant source based on `System.nanoTime()` for the purpose of setting and comparing deadlines. ------------- Commit messages: - 8309939 Changes: https://git.openjdk.org/jdk/pull/14450/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14450&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8309939 Stats: 162 lines in 6 files changed: 146 ins; 0 del; 16 mod Patch: https://git.openjdk.org/jdk/pull/14450.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14450/head:pull/14450 PR: https://git.openjdk.org/jdk/pull/14450 From jpai at openjdk.org Wed Jun 14 01:41:01 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Wed, 14 Jun 2023 01:41:01 GMT Subject: RFR: 8309910: Introduce jdk.internal.net.http.HttpConnection.getSNIServerNames() method In-Reply-To: References: Message-ID: On Tue, 13 Jun 2023 09:27:39 GMT, Jaikiran Pai wrote: > Can I please get a review of this change which addresses https://bugs.openjdk.org/browse/JDK-8309910? > > As noted in that issue, this introduces a new method on the internal class `jdk.internal.net.http.HttpConnection` to return the SNI names that were used (if any) during a connection establishment. > > Given the nature of the change, no new tests have been introduced. Existing tests in `test/jdk/java/net/httpclient` continue to pass with this change. tier testing in CI is currently in progress. Thank you Daniel for the review. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14443#issuecomment-1590307844 From jpai at openjdk.org Wed Jun 14 01:41:02 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Wed, 14 Jun 2023 01:41:02 GMT Subject: Integrated: 8309910: Introduce jdk.internal.net.http.HttpConnection.getSNIServerNames() method In-Reply-To: References: Message-ID: On Tue, 13 Jun 2023 09:27:39 GMT, Jaikiran Pai wrote: > Can I please get a review of this change which addresses https://bugs.openjdk.org/browse/JDK-8309910? > > As noted in that issue, this introduces a new method on the internal class `jdk.internal.net.http.HttpConnection` to return the SNI names that were used (if any) during a connection establishment. > > Given the nature of the change, no new tests have been introduced. Existing tests in `test/jdk/java/net/httpclient` continue to pass with this change. tier testing in CI is currently in progress. This pull request has now been integrated. Changeset: ba837b4b Author: Jaikiran Pai URL: https://git.openjdk.org/jdk/commit/ba837b4bfa2dea85653d8a8fccd0817a569b4378 Stats: 56 lines in 3 files changed: 29 ins; 17 del; 10 mod 8309910: Introduce jdk.internal.net.http.HttpConnection.getSNIServerNames() method Reviewed-by: dfuchs ------------- PR: https://git.openjdk.org/jdk/pull/14443 From dholmes at openjdk.org Wed Jun 14 05:22:19 2023 From: dholmes at openjdk.org (David Holmes) Date: Wed, 14 Jun 2023 05:22:19 GMT Subject: RFR: 8304478: Initial nroff manpage generation for JDK 22 Message-ID: Updated the version to 22-ea and year to 2024. The following unpublished changes will also be included in this update: - [JDK-8290626](https://bugs.openjdk.org/browse/JDK-8290626): keytool manpage contains a special character - [JDK-8303928](https://bugs.openjdk.org/browse/JDK-8303928): Update jarsigner man page after [JDK-8303410](https://bugs.openjdk.org/browse/JDK-8303410) - [JDK-8301207](https://bugs.openjdk.org/browse/JDK-8301207): (jdeps) Deprecate jdeps -profile option The following changes were never applied to the closed sources and are "lost" by this update. These changes will need to be re-applied directly in JDK 21 and JDK 22: - [JDK-8296656](https://bugs.openjdk.org/browse/JDK-8296656): java.lang.NoClassDefFoundError exception on running fully legitimate code - [JDK-8015831](https://bugs.openjdk.org/browse/JDK-8015831): Add lint check for calling overridable methods from a constructor Thanks. ------------- Commit messages: - 8304478: Initial nroff manpage generation for JDK 22 Changes: https://git.openjdk.org/jdk/pull/14462/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14462&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8304478 Stats: 140 lines in 28 files changed: 1 ins; 105 del; 34 mod Patch: https://git.openjdk.org/jdk/pull/14462.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14462/head:pull/14462 PR: https://git.openjdk.org/jdk/pull/14462 From alanb at openjdk.org Wed Jun 14 06:11:55 2023 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 14 Jun 2023 06:11:55 GMT Subject: RFR: 8304478: Initial nroff manpage generation for JDK 22 In-Reply-To: References: Message-ID: On Wed, 14 Jun 2023 04:53:58 GMT, David Holmes wrote: > Updated the version to 22-ea and year to 2024. > > The following unpublished changes will also be included in this update: > - [JDK-8290626](https://bugs.openjdk.org/browse/JDK-8290626): keytool manpage contains a special character > - [JDK-8303928](https://bugs.openjdk.org/browse/JDK-8303928): Update jarsigner man page after [JDK-8303410](https://bugs.openjdk.org/browse/JDK-8303410) > - [JDK-8301207](https://bugs.openjdk.org/browse/JDK-8301207): (jdeps) Deprecate jdeps -profile option > > The following changes, to `javac.1`, were never applied to the closed sources and are "lost" by this update. These changes will need to be re-applied directly in JDK 21 and JDK 22: > - [JDK-8296656](https://bugs.openjdk.org/browse/JDK-8296656): java.lang.NoClassDefFoundError exception on running fully legitimate code > - [JDK-8015831](https://bugs.openjdk.org/browse/JDK-8015831): Add lint check for calling overridable methods from a constructor > > Thanks. Looks fine. ------------- Marked as reviewed by alanb (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14462#pullrequestreview-1478549017 From dholmes at openjdk.org Wed Jun 14 06:11:55 2023 From: dholmes at openjdk.org (David Holmes) Date: Wed, 14 Jun 2023 06:11:55 GMT Subject: RFR: 8304478: Initial nroff manpage generation for JDK 22 In-Reply-To: References: Message-ID: On Wed, 14 Jun 2023 06:08:59 GMT, Alan Bateman wrote: >> Updated the version to 22-ea and year to 2024. >> >> The following unpublished changes will also be included in this update: >> - [JDK-8290626](https://bugs.openjdk.org/browse/JDK-8290626): keytool manpage contains a special character >> - [JDK-8303928](https://bugs.openjdk.org/browse/JDK-8303928): Update jarsigner man page after [JDK-8303410](https://bugs.openjdk.org/browse/JDK-8303410) >> - [JDK-8301207](https://bugs.openjdk.org/browse/JDK-8301207): (jdeps) Deprecate jdeps -profile option >> >> The following changes, to `javac.1`, were never applied to the closed sources and are "lost" by this update. These changes will need to be re-applied directly in JDK 21 and JDK 22: >> - [JDK-8296656](https://bugs.openjdk.org/browse/JDK-8296656): java.lang.NoClassDefFoundError exception on running fully legitimate code >> - [JDK-8015831](https://bugs.openjdk.org/browse/JDK-8015831): Add lint check for calling overridable methods from a constructor >> >> Thanks. > > Looks fine. Thanks @AlanBateman ! ------------- PR Comment: https://git.openjdk.org/jdk/pull/14462#issuecomment-1590531861 From sspitsyn at openjdk.org Wed Jun 14 09:28:11 2023 From: sspitsyn at openjdk.org (Serguei Spitsyn) Date: Wed, 14 Jun 2023 09:28:11 GMT Subject: RFR: 8304478: Initial nroff manpage generation for JDK 22 In-Reply-To: References: Message-ID: On Wed, 14 Jun 2023 04:53:58 GMT, David Holmes wrote: > Updated the version to 22-ea and year to 2024. > > The following unpublished changes will also be included in this update: > - [JDK-8290626](https://bugs.openjdk.org/browse/JDK-8290626): keytool manpage contains a special character > - [JDK-8303928](https://bugs.openjdk.org/browse/JDK-8303928): Update jarsigner man page after [JDK-8303410](https://bugs.openjdk.org/browse/JDK-8303410) > - [JDK-8301207](https://bugs.openjdk.org/browse/JDK-8301207): (jdeps) Deprecate jdeps -profile option > > The following changes, to `javac.1`, were never applied to the closed sources and are "lost" by this update. These changes will need to be re-applied directly in JDK 21 and JDK 22: > - [JDK-8296656](https://bugs.openjdk.org/browse/JDK-8296656): java.lang.NoClassDefFoundError exception on running fully legitimate code > - [JDK-8015831](https://bugs.openjdk.org/browse/JDK-8015831): Add lint check for calling overridable methods from a constructor > > Thanks. The Serviceability changes look good. Thanks, Serguei ------------- Marked as reviewed by sspitsyn (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14462#pullrequestreview-1478940868 From dfuchs at openjdk.org Wed Jun 14 11:02:04 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Wed, 14 Jun 2023 11:02:04 GMT Subject: RFR: 8309939: HttpClient should not use Instant.now() as Instant source for deadlines [v2] In-Reply-To: <2he50rg26x_11srLEcMzVKcOj6BkQs6CyWsqF4WoXD8=.524fb1b2-c02b-48d8-9df0-83ed6ef3e2d1@github.com> References: <2he50rg26x_11srLEcMzVKcOj6BkQs6CyWsqF4WoXD8=.524fb1b2-c02b-48d8-9df0-83ed6ef3e2d1@github.com> Message-ID: > The HttpClient uses `Instant.now()` to create deadlines for timeouts. This could have undesirable effects since `Instant.now()` is linked to the wall clock, which is not monotonic. This fix changes the HttpClient to use a monotonic instant source based on `System.nanoTime()` for the purpose of setting and comparing deadlines. Daniel Fuchs has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision: - Merge branch 'master' into TimeSource - 8309939 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14450/files - new: https://git.openjdk.org/jdk/pull/14450/files/1ab59db0..e30a6834 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14450&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14450&range=00-01 Stats: 9503 lines in 264 files changed: 1433 ins; 7240 del; 830 mod Patch: https://git.openjdk.org/jdk/pull/14450.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14450/head:pull/14450 PR: https://git.openjdk.org/jdk/pull/14450 From jpai at openjdk.org Wed Jun 14 11:21:00 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Wed, 14 Jun 2023 11:21:00 GMT Subject: RFR: 8309939: HttpClient should not use Instant.now() as Instant source for deadlines [v2] In-Reply-To: References: <2he50rg26x_11srLEcMzVKcOj6BkQs6CyWsqF4WoXD8=.524fb1b2-c02b-48d8-9df0-83ed6ef3e2d1@github.com> Message-ID: On Wed, 14 Jun 2023 11:02:04 GMT, Daniel Fuchs wrote: >> The HttpClient uses `Instant.now()` to create deadlines for timeouts. This could have undesirable effects since `Instant.now()` is linked to the wall clock, which is not monotonic. This fix changes the HttpClient to use a monotonic instant source based on `System.nanoTime()` for the purpose of setting and comparing deadlines. > > Daniel Fuchs has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision: > > - Merge branch 'master' into TimeSource > - 8309939 src/java.net.http/share/classes/jdk/internal/net/http/ConnectionPool.java line 132: > 130: } > 131: > 132: ConnectionPool(long clientId, TimeSource timeSource) { Hello Daniel, as far as I can see, no one calls this constructor outside of this very class and this seems to be always passed a constant `TimeSource.source()`. So maybe we don't have to have a `timeSource` field in this class and instead just use `TimeSource.now()` at call sites within this class (and `ExpiryList`) whenever we want `now()`? src/java.net.http/share/classes/jdk/internal/net/http/common/TimeSource.java line 76: > 74: // The use of Integer.MAX_VALUE is arbitrary. > 75: // Any value not too close to Long.MAX_VALUE > 76: // would do. The `Integer.MAX_VALUE` gets used in `isInWindow()` method implementation, through the use of `TIME_WINDOW` member. Should this comment about `Integer.MAX_VALUE` instead be moved as a field comment for `TIME_WINDOW`? That way it's closer to where the `Integer.MAX_VALUE` is actually used. src/java.net.http/share/classes/jdk/internal/net/http/common/TimeSource.java line 82: > 80: } > 81: > 82: // @ForceInline Should these couple of commented out `@ForceInline` be deleted? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14450#discussion_r1229428984 PR Review Comment: https://git.openjdk.org/jdk/pull/14450#discussion_r1229432322 PR Review Comment: https://git.openjdk.org/jdk/pull/14450#discussion_r1229430561 From djelinski at openjdk.org Wed Jun 14 12:18:02 2023 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Wed, 14 Jun 2023 12:18:02 GMT Subject: RFR: 8309939: HttpClient should not use Instant.now() as Instant source for deadlines [v2] In-Reply-To: References: <2he50rg26x_11srLEcMzVKcOj6BkQs6CyWsqF4WoXD8=.524fb1b2-c02b-48d8-9df0-83ed6ef3e2d1@github.com> Message-ID: On Wed, 14 Jun 2023 11:02:04 GMT, Daniel Fuchs wrote: >> The HttpClient uses `Instant.now()` to create deadlines for timeouts. This could have undesirable effects since `Instant.now()` is linked to the wall clock, which is not monotonic. This fix changes the HttpClient to use a monotonic instant source based on `System.nanoTime()` for the purpose of setting and comparing deadlines. > > Daniel Fuchs has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision: > > - Merge branch 'master' into TimeSource > - 8309939 src/java.net.http/share/classes/jdk/internal/net/http/common/TimeSource.java line 41: > 39: * of monotonicity than the {@link System#nanoTime()} it is based on. > 40: */ > 41: public final class TimeSource implements InstantSource { Given that all instances of TimeSource are essentially the same (through the use of shared `nanoSource`), can we add a private constructor and make this class a singleton? src/java.net.http/share/classes/jdk/internal/net/http/common/TimeSource.java line 46: > 44: private static final TimeSource SOURCE = new TimeSource(); > 45: > 46: private static final class NanoSource implements InstantSource { This class doesn't need to implement InstantSource src/java.net.http/share/classes/jdk/internal/net/http/common/TimeSource.java line 59: > 57: > 58: @Override > 59: public Instant instant() { This method is not used anywhere ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14450#discussion_r1229507872 PR Review Comment: https://git.openjdk.org/jdk/pull/14450#discussion_r1229505949 PR Review Comment: https://git.openjdk.org/jdk/pull/14450#discussion_r1229506241 From dfuchs at openjdk.org Wed Jun 14 12:37:03 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Wed, 14 Jun 2023 12:37:03 GMT Subject: RFR: 8309939: HttpClient should not use Instant.now() as Instant source for deadlines [v2] In-Reply-To: References: <2he50rg26x_11srLEcMzVKcOj6BkQs6CyWsqF4WoXD8=.524fb1b2-c02b-48d8-9df0-83ed6ef3e2d1@github.com> Message-ID: On Wed, 14 Jun 2023 11:14:02 GMT, Jaikiran Pai wrote: >> Daniel Fuchs has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision: >> >> - Merge branch 'master' into TimeSource >> - 8309939 > > src/java.net.http/share/classes/jdk/internal/net/http/ConnectionPool.java line 132: > >> 130: } >> 131: >> 132: ConnectionPool(long clientId, TimeSource timeSource) { > > Hello Daniel, as far as I can see, no one calls this constructor outside of this very class and this seems to be always passed a constant `TimeSource.source()`. So maybe we don't have to have a `timeSource` field in this class and instead just use `TimeSource.now()` at call sites within this class (and `ExpiryList`) whenever we want `now()`? This constructor should in fact take an InstantSource, not a TimeSource. It was added in case we wanted to upgrade the whitebox ConnectionPoolTest to create an instance of ConnectionPool with a custom InstantSource. > src/java.net.http/share/classes/jdk/internal/net/http/common/TimeSource.java line 76: > >> 74: // The use of Integer.MAX_VALUE is arbitrary. >> 75: // Any value not too close to Long.MAX_VALUE >> 76: // would do. > > The `Integer.MAX_VALUE` gets used in `isInWindow()` method implementation, through the use of `TIME_WINDOW` member. Should this comment about `Integer.MAX_VALUE` instead be moved as a field comment for `TIME_WINDOW`? That way it's closer to where the `Integer.MAX_VALUE` is actually used. Done > src/java.net.http/share/classes/jdk/internal/net/http/common/TimeSource.java line 82: > >> 80: } >> 81: >> 82: // @ForceInline > > Should these couple of commented out `@ForceInline` be deleted? Done ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14450#discussion_r1229539076 PR Review Comment: https://git.openjdk.org/jdk/pull/14450#discussion_r1229540292 PR Review Comment: https://git.openjdk.org/jdk/pull/14450#discussion_r1229540099 From dfuchs at openjdk.org Wed Jun 14 12:44:30 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Wed, 14 Jun 2023 12:44:30 GMT Subject: RFR: 8309939: HttpClient should not use Instant.now() as Instant source for deadlines [v3] In-Reply-To: <2he50rg26x_11srLEcMzVKcOj6BkQs6CyWsqF4WoXD8=.524fb1b2-c02b-48d8-9df0-83ed6ef3e2d1@github.com> References: <2he50rg26x_11srLEcMzVKcOj6BkQs6CyWsqF4WoXD8=.524fb1b2-c02b-48d8-9df0-83ed6ef3e2d1@github.com> Message-ID: > The HttpClient uses `Instant.now()` to create deadlines for timeouts. This could have undesirable effects since `Instant.now()` is linked to the wall clock, which is not monotonic. This fix changes the HttpClient to use a monotonic instant source based on `System.nanoTime()` for the purpose of setting and comparing deadlines. Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: Review feedback ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14450/files - new: https://git.openjdk.org/jdk/pull/14450/files/e30a6834..35da58e2 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14450&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14450&range=01-02 Stats: 30 lines in 3 files changed: 11 ins; 11 del; 8 mod Patch: https://git.openjdk.org/jdk/pull/14450.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14450/head:pull/14450 PR: https://git.openjdk.org/jdk/pull/14450 From dfuchs at openjdk.org Wed Jun 14 12:44:31 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Wed, 14 Jun 2023 12:44:31 GMT Subject: RFR: 8309939: HttpClient should not use Instant.now() as Instant source for deadlines [v2] In-Reply-To: References: <2he50rg26x_11srLEcMzVKcOj6BkQs6CyWsqF4WoXD8=.524fb1b2-c02b-48d8-9df0-83ed6ef3e2d1@github.com> Message-ID: On Wed, 14 Jun 2023 12:12:37 GMT, Daniel Jeli?ski wrote: >> Daniel Fuchs has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision: >> >> - Merge branch 'master' into TimeSource >> - 8309939 > > src/java.net.http/share/classes/jdk/internal/net/http/common/TimeSource.java line 41: > >> 39: * of monotonicity than the {@link System#nanoTime()} it is based on. >> 40: */ >> 41: public final class TimeSource implements InstantSource { > > Given that all instances of TimeSource are essentially the same (through the use of shared `nanoSource`), can we add a private constructor and make this class a singleton? Good point. That's an oversight. > src/java.net.http/share/classes/jdk/internal/net/http/common/TimeSource.java line 46: > >> 44: private static final TimeSource SOURCE = new TimeSource(); >> 45: >> 46: private static final class NanoSource implements InstantSource { > > This class doesn't need to implement InstantSource Good point ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14450#discussion_r1229547997 PR Review Comment: https://git.openjdk.org/jdk/pull/14450#discussion_r1229547152 From dfuchs at openjdk.org Wed Jun 14 13:46:10 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Wed, 14 Jun 2023 13:46:10 GMT Subject: RFR: 8309939: HttpClient should not use Instant.now() as Instant source for deadlines [v4] In-Reply-To: <2he50rg26x_11srLEcMzVKcOj6BkQs6CyWsqF4WoXD8=.524fb1b2-c02b-48d8-9df0-83ed6ef3e2d1@github.com> References: <2he50rg26x_11srLEcMzVKcOj6BkQs6CyWsqF4WoXD8=.524fb1b2-c02b-48d8-9df0-83ed6ef3e2d1@github.com> Message-ID: > The HttpClient uses `Instant.now()` to create deadlines for timeouts. This could have undesirable effects since `Instant.now()` is linked to the wall clock, which is not monotonic. This fix changes the HttpClient to use a monotonic instant source based on `System.nanoTime()` for the purpose of setting and comparing deadlines. Daniel Fuchs has updated the pull request incrementally with two additional commits since the last revision: - more cleanup - whitespaces ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14450/files - new: https://git.openjdk.org/jdk/pull/14450/files/35da58e2..4636ccb0 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14450&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14450&range=02-03 Stats: 5 lines in 2 files changed: 2 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/14450.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14450/head:pull/14450 PR: https://git.openjdk.org/jdk/pull/14450 From rriggs at openjdk.org Wed Jun 14 13:51:02 2023 From: rriggs at openjdk.org (Roger Riggs) Date: Wed, 14 Jun 2023 13:51:02 GMT Subject: RFR: 8309939: HttpClient should not use Instant.now() as Instant source for deadlines [v4] In-Reply-To: References: <2he50rg26x_11srLEcMzVKcOj6BkQs6CyWsqF4WoXD8=.524fb1b2-c02b-48d8-9df0-83ed6ef3e2d1@github.com> Message-ID: On Wed, 14 Jun 2023 13:46:10 GMT, Daniel Fuchs wrote: >> The HttpClient uses `Instant.now()` to create deadlines for timeouts. This could have undesirable effects since `Instant.now()` is linked to the wall clock, which is not monotonic. This fix changes the HttpClient to use a monotonic instant source based on `System.nanoTime()` for the purpose of setting and comparing deadlines. > > Daniel Fuchs has updated the pull request incrementally with two additional commits since the last revision: > > - more cleanup > - whitespaces Changes requested by rriggs (Reviewer). src/java.net.http/share/classes/jdk/internal/net/http/common/TimeSource.java line 36: > 34: * caused by changes to the wall clock. Consequently, callers should use > 35: * instants returned by this time source solely for the purpose of > 36: * comparing them with other instants returned by this same time source. Do not use `Instant` as the value from this time source. It is not comparable with the real Instants and would be misleading lead to bugs. ------------- PR Review: https://git.openjdk.org/jdk/pull/14450#pullrequestreview-1479500686 PR Review Comment: https://git.openjdk.org/jdk/pull/14450#discussion_r1229651020 From dfuchs at openjdk.org Wed Jun 14 15:39:10 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Wed, 14 Jun 2023 15:39:10 GMT Subject: RFR: 8309939: HttpClient should not use Instant.now() as Instant source for deadlines [v5] In-Reply-To: <2he50rg26x_11srLEcMzVKcOj6BkQs6CyWsqF4WoXD8=.524fb1b2-c02b-48d8-9df0-83ed6ef3e2d1@github.com> References: <2he50rg26x_11srLEcMzVKcOj6BkQs6CyWsqF4WoXD8=.524fb1b2-c02b-48d8-9df0-83ed6ef3e2d1@github.com> Message-ID: > The HttpClient uses `Instant.now()` to create deadlines for timeouts. This could have undesirable effects since `Instant.now()` is linked to the wall clock, which is not monotonic. This fix changes the HttpClient to use a monotonic instant source based on `System.nanoTime()` for the purpose of setting and comparing deadlines. Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: Use Deadline rather than Instant ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14450/files - new: https://git.openjdk.org/jdk/pull/14450/files/4636ccb0..e5f6cd60 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14450&range=04 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14450&range=03-04 Stats: 297 lines in 7 files changed: 265 ins; 3 del; 29 mod Patch: https://git.openjdk.org/jdk/pull/14450.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14450/head:pull/14450 PR: https://git.openjdk.org/jdk/pull/14450 From dfuchs at openjdk.org Wed Jun 14 15:39:13 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Wed, 14 Jun 2023 15:39:13 GMT Subject: RFR: 8309939: HttpClient should not use Instant.now() as Instant source for deadlines [v4] In-Reply-To: References: <2he50rg26x_11srLEcMzVKcOj6BkQs6CyWsqF4WoXD8=.524fb1b2-c02b-48d8-9df0-83ed6ef3e2d1@github.com> Message-ID: On Wed, 14 Jun 2023 13:47:17 GMT, Roger Riggs wrote: >> Daniel Fuchs has updated the pull request incrementally with two additional commits since the last revision: >> >> - more cleanup >> - whitespaces > > src/java.net.http/share/classes/jdk/internal/net/http/common/TimeSource.java line 36: > >> 34: * caused by changes to the wall clock. Consequently, callers should use >> 35: * instants returned by this time source solely for the purpose of >> 36: * comparing them with other instants returned by this same time source. > > Do not use `Instant` as the value from this time source. It is not comparable with the real Instants and would be misleading and cause bugs. OK. Here is a version that uses a new class "Deadline" instead of "Instant". ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14450#discussion_r1229818891 From rriggs at openjdk.org Wed Jun 14 17:34:56 2023 From: rriggs at openjdk.org (Roger Riggs) Date: Wed, 14 Jun 2023 17:34:56 GMT Subject: RFR: 8309939: HttpClient should not use Instant.now() as Instant source for deadlines [v4] In-Reply-To: References: <2he50rg26x_11srLEcMzVKcOj6BkQs6CyWsqF4WoXD8=.524fb1b2-c02b-48d8-9df0-83ed6ef3e2d1@github.com> Message-ID: <8Y2MX5Je-XIigKQ2JU0xRMDkWt1Q_4GDgg4qZdctj-8=.f73f738a-6e06-4e87-b9ff-16cd2b446370@github.com> On Wed, 14 Jun 2023 15:32:57 GMT, Daniel Fuchs wrote: >> src/java.net.http/share/classes/jdk/internal/net/http/common/TimeSource.java line 36: >> >>> 34: * caused by changes to the wall clock. Consequently, callers should use >>> 35: * instants returned by this time source solely for the purpose of >>> 36: * comparing them with other instants returned by this same time source. >> >> Do not use `Instant` as the value from this time source. It is not comparable with the real Instants and would be misleading and cause bugs. > > OK. Here is a version that uses a new class "Deadline" instead of "Instant". Wrapping the Instant is safe/fine. However, it could quite a bit simpler (it seems) to just use the raw `long` nanoTime values. Though milliseconds or seconds would be sufficient for the timeouts. The complexity of the volatile read and needing to reset the nanoSource could be avoided. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14450#discussion_r1229952947 From dfuchs at openjdk.org Wed Jun 14 17:34:56 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Wed, 14 Jun 2023 17:34:56 GMT Subject: RFR: 8309939: HttpClient should not use Instant.now() as Instant source for deadlines [v4] In-Reply-To: <8Y2MX5Je-XIigKQ2JU0xRMDkWt1Q_4GDgg4qZdctj-8=.f73f738a-6e06-4e87-b9ff-16cd2b446370@github.com> References: <2he50rg26x_11srLEcMzVKcOj6BkQs6CyWsqF4WoXD8=.524fb1b2-c02b-48d8-9df0-83ed6ef3e2d1@github.com> <8Y2MX5Je-XIigKQ2JU0xRMDkWt1Q_4GDgg4qZdctj-8=.f73f738a-6e06-4e87-b9ff-16cd2b446370@github.com> Message-ID: On Wed, 14 Jun 2023 17:29:06 GMT, Roger Riggs wrote: >> OK. Here is a version that uses a new class "Deadline" instead of "Instant". > > Wrapping the Instant is safe/fine. > However, it could quite a bit simpler (it seems) to just use the raw `long` nanoTime values. > Though milliseconds or seconds would be sufficient for the timeouts. > The complexity of the volatile read and needing to reset the nanoSource could be avoided. Working with Instant (now Deadline) and Duration is much safer and easier than working with longs representing nano time, especially when you have a sorted list of deadlines. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14450#discussion_r1229955654 From mchung at openjdk.org Wed Jun 14 18:43:57 2023 From: mchung at openjdk.org (Mandy Chung) Date: Wed, 14 Jun 2023 18:43:57 GMT Subject: RFR: 8304478: Initial nroff manpage generation for JDK 22 In-Reply-To: References: Message-ID: On Wed, 14 Jun 2023 04:53:58 GMT, David Holmes wrote: > Updated the version to 22-ea and year to 2024. > > The following unpublished changes will also be included in this update: > - [JDK-8290626](https://bugs.openjdk.org/browse/JDK-8290626): keytool manpage contains a special character > - [JDK-8303928](https://bugs.openjdk.org/browse/JDK-8303928): Update jarsigner man page after [JDK-8303410](https://bugs.openjdk.org/browse/JDK-8303410) > - [JDK-8301207](https://bugs.openjdk.org/browse/JDK-8301207): (jdeps) Deprecate jdeps -profile option > > The following changes, to `javac.1`, were never applied to the closed sources and are "lost" by this update. These changes will need to be re-applied directly in JDK 21 and JDK 22: > - [JDK-8296656](https://bugs.openjdk.org/browse/JDK-8296656): java.lang.NoClassDefFoundError exception on running fully legitimate code > - [JDK-8015831](https://bugs.openjdk.org/browse/JDK-8015831): Add lint check for calling overridable methods from a constructor > > Thanks. Marked as reviewed by mchung (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14462#pullrequestreview-1480088199 From lancea at openjdk.org Wed Jun 14 18:51:10 2023 From: lancea at openjdk.org (Lance Andersen) Date: Wed, 14 Jun 2023 18:51:10 GMT Subject: RFR: 8304478: Initial nroff manpage generation for JDK 22 In-Reply-To: References: Message-ID: On Wed, 14 Jun 2023 04:53:58 GMT, David Holmes wrote: > Updated the version to 22-ea and year to 2024. > > The following unpublished changes will also be included in this update: > - [JDK-8290626](https://bugs.openjdk.org/browse/JDK-8290626): keytool manpage contains a special character > - [JDK-8303928](https://bugs.openjdk.org/browse/JDK-8303928): Update jarsigner man page after [JDK-8303410](https://bugs.openjdk.org/browse/JDK-8303410) > - [JDK-8301207](https://bugs.openjdk.org/browse/JDK-8301207): (jdeps) Deprecate jdeps -profile option > > The following changes, to `javac.1`, were never applied to the closed sources and are "lost" by this update. These changes will need to be re-applied directly in JDK 21 and JDK 22: > - [JDK-8296656](https://bugs.openjdk.org/browse/JDK-8296656): java.lang.NoClassDefFoundError exception on running fully legitimate code > - [JDK-8015831](https://bugs.openjdk.org/browse/JDK-8015831): Add lint check for calling overridable methods from a constructor > > Thanks. Marked as reviewed by lancea (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14462#pullrequestreview-1480097706 From acobbs at openjdk.org Wed Jun 14 19:23:59 2023 From: acobbs at openjdk.org (Archie Cobbs) Date: Wed, 14 Jun 2023 19:23:59 GMT Subject: RFR: 8304478: Initial nroff manpage generation for JDK 22 In-Reply-To: References: Message-ID: On Wed, 14 Jun 2023 04:53:58 GMT, David Holmes wrote: > The following changes, to javac.1, were never applied to the closed sources and are "lost" by this update. These changes will need to be re-applied directly in JDK 21 and JDK 22 Just curious, since you have access to the secret closed sources, can you not backport these changes yourself? Instead of just deleting them and expecting someone else to rescue them from oblivion? To be clear, I'm not blaming you for this situation - the problem is that there exist "closed sources" at all (why??) - but that doesn't seem like a good excuse for deleting work without a clear path to ensuring it is preserved (and the simplest way to do that is to do it yourself). Obviously I'd do it myself if I could. Thanks. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14462#issuecomment-1591849483 From dholmes at openjdk.org Wed Jun 14 21:31:00 2023 From: dholmes at openjdk.org (David Holmes) Date: Wed, 14 Jun 2023 21:31:00 GMT Subject: RFR: 8304478: Initial nroff manpage generation for JDK 22 In-Reply-To: References: Message-ID: On Wed, 14 Jun 2023 19:21:01 GMT, Archie Cobbs wrote: > Just curious, since you have access to the secret closed sources, can you not backport these changes yourself? Instead of just deleting them and expecting someone else to rescue them from oblivion? @archiecobbs we (Oracle) will take care of restoring this text so please don't be concerned about that. It will just be a temporary glitch. It should have been handled when the original PRs were done. It needs to be handled as a separate issue and PR though - whether that were to happen before or after this PR is somewhat immaterial. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14462#issuecomment-1592014026 From dholmes at openjdk.org Wed Jun 14 21:31:03 2023 From: dholmes at openjdk.org (David Holmes) Date: Wed, 14 Jun 2023 21:31:03 GMT Subject: RFR: 8304478: Initial nroff manpage generation for JDK 22 In-Reply-To: References: Message-ID: On Wed, 14 Jun 2023 09:25:14 GMT, Serguei Spitsyn wrote: >> Updated the version to 22-ea and year to 2024. >> >> The following unpublished changes will also be included in this update: >> - [JDK-8290626](https://bugs.openjdk.org/browse/JDK-8290626): keytool manpage contains a special character >> - [JDK-8303928](https://bugs.openjdk.org/browse/JDK-8303928): Update jarsigner man page after [JDK-8303410](https://bugs.openjdk.org/browse/JDK-8303410) >> - [JDK-8301207](https://bugs.openjdk.org/browse/JDK-8301207): (jdeps) Deprecate jdeps -profile option >> >> The following changes, to `javac.1`, were never applied to the closed sources and are "lost" by this update. These changes will need to be re-applied directly in JDK 21 and JDK 22: >> - [JDK-8296656](https://bugs.openjdk.org/browse/JDK-8296656): java.lang.NoClassDefFoundError exception on running fully legitimate code >> - [JDK-8015831](https://bugs.openjdk.org/browse/JDK-8015831): Add lint check for calling overridable methods from a constructor >> >> Thanks. > > The Serviceability changes look good. > Thanks, > Serguei Thanks for the additional reviews @sspitsyn , @LanceAndersen and @mlchung ! ------------- PR Comment: https://git.openjdk.org/jdk/pull/14462#issuecomment-1592014943 From acobbs at openjdk.org Wed Jun 14 21:40:57 2023 From: acobbs at openjdk.org (Archie Cobbs) Date: Wed, 14 Jun 2023 21:40:57 GMT Subject: RFR: 8304478: Initial nroff manpage generation for JDK 22 In-Reply-To: References: Message-ID: On Wed, 14 Jun 2023 21:28:01 GMT, David Holmes wrote: > > Just curious, since you have access to the secret closed sources, can you not backport these changes yourself? Instead of just deleting them and expecting someone else to rescue them from oblivion? > > @archiecobbs we (Oracle) will take care of restoring this text so please don't be concerned about that. It will just be a temporary glitch. OK thanks. Putting my trust in you :) ------------- PR Comment: https://git.openjdk.org/jdk/pull/14462#issuecomment-1592023452 From dholmes at openjdk.org Wed Jun 14 22:11:57 2023 From: dholmes at openjdk.org (David Holmes) Date: Wed, 14 Jun 2023 22:11:57 GMT Subject: RFR: 8304478: Initial nroff manpage generation for JDK 22 In-Reply-To: References: Message-ID: On Wed, 14 Jun 2023 04:53:58 GMT, David Holmes wrote: > Updated the version to 22-ea and year to 2024. > > The following unpublished changes will also be included in this update: > - [JDK-8290626](https://bugs.openjdk.org/browse/JDK-8290626): keytool manpage contains a special character > - [JDK-8303928](https://bugs.openjdk.org/browse/JDK-8303928): Update jarsigner man page after [JDK-8303410](https://bugs.openjdk.org/browse/JDK-8303410) > - [JDK-8301207](https://bugs.openjdk.org/browse/JDK-8301207): (jdeps) Deprecate jdeps -profile option > > The following changes, to `javac.1`, were never applied to the closed sources and are "lost" by this update. These changes will need to be re-applied directly in JDK 21 and JDK 22: > - [JDK-8296656](https://bugs.openjdk.org/browse/JDK-8296656): java.lang.NoClassDefFoundError exception on running fully legitimate code > - [JDK-8015831](https://bugs.openjdk.org/browse/JDK-8015831): Add lint check for calling overridable methods from a constructor > > Thanks. I've filed https://bugs.openjdk.org/browse/JDK-8310067 for the javac manpage fixup. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14462#issuecomment-1592056009 From djelinski at openjdk.org Fri Jun 16 12:49:05 2023 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Fri, 16 Jun 2023 12:49:05 GMT Subject: RFR: 8309939: HttpClient should not use Instant.now() as Instant source for deadlines [v5] In-Reply-To: References: <2he50rg26x_11srLEcMzVKcOj6BkQs6CyWsqF4WoXD8=.524fb1b2-c02b-48d8-9df0-83ed6ef3e2d1@github.com> Message-ID: On Wed, 14 Jun 2023 15:39:10 GMT, Daniel Fuchs wrote: >> The HttpClient uses `Instant.now()` to create deadlines for timeouts. This could have undesirable effects since `Instant.now()` is linked to the wall clock, which is not monotonic. This fix changes the HttpClient to use a monotonic instant source based on `System.nanoTime()` for the purpose of setting and comparing deadlines. > > Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: > > Use Deadline rather than Instant src/java.net.http/share/classes/jdk/internal/net/http/common/Deadline.java line 203: > 201: @Override > 202: public String toString() { > 203: return deadline.toString(); I'm not sure about using `Instant.toString` here; if we ever log a `Deadline` instance along with the current time and the clock skews, we will need to read the code along with the logs to figure out which date represents a deadline and which one represents an instant. I guess the problem would also go away if we initialized the first NanoSource with something other than Instant.now(). ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14450#discussion_r1232206107 From dfuchs at openjdk.org Fri Jun 16 14:42:03 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Fri, 16 Jun 2023 14:42:03 GMT Subject: RFR: 8309939: HttpClient should not use Instant.now() as Instant source for deadlines [v5] In-Reply-To: References: <2he50rg26x_11srLEcMzVKcOj6BkQs6CyWsqF4WoXD8=.524fb1b2-c02b-48d8-9df0-83ed6ef3e2d1@github.com> Message-ID: On Fri, 16 Jun 2023 12:46:35 GMT, Daniel Jeli?ski wrote: >> Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: >> >> Use Deadline rather than Instant > > src/java.net.http/share/classes/jdk/internal/net/http/common/Deadline.java line 203: > >> 201: @Override >> 202: public String toString() { >> 203: return deadline.toString(); > > I'm not sure about using `Instant.toString` here; if we ever log a `Deadline` instance along with the current time and the clock skews, we will need to read the code along with the logs to figure out which date represents a deadline and which one represents an instant. > I guess the problem would also go away if we initialized the first NanoSource with something other than Instant.now(). I can modify the toString to be return "Deadline(" + deadline.toString() + ")"; if you think it's better. But I do believe that using a fake instant for the origin of the NanoSource would be way more confusing. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14450#discussion_r1232342691 From djelinski at openjdk.org Fri Jun 16 16:19:01 2023 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Fri, 16 Jun 2023 16:19:01 GMT Subject: RFR: 8309939: HttpClient should not use Instant.now() as Instant source for deadlines [v5] In-Reply-To: References: <2he50rg26x_11srLEcMzVKcOj6BkQs6CyWsqF4WoXD8=.524fb1b2-c02b-48d8-9df0-83ed6ef3e2d1@github.com> Message-ID: On Fri, 16 Jun 2023 14:39:03 GMT, Daniel Fuchs wrote: >> src/java.net.http/share/classes/jdk/internal/net/http/common/Deadline.java line 203: >> >>> 201: @Override >>> 202: public String toString() { >>> 203: return deadline.toString(); >> >> I'm not sure about using `Instant.toString` here; if we ever log a `Deadline` instance along with the current time and the clock skews, we will need to read the code along with the logs to figure out which date represents a deadline and which one represents an instant. >> I guess the problem would also go away if we initialized the first NanoSource with something other than Instant.now(). > > I can modify the toString to be > > return "Deadline(" + deadline.toString() + ")"; > > if you think it's better. > > But I do believe that using a fake instant for the origin of the NanoSource would be way more confusing. We can also avoid using that method. I guess we can always deal with it later if it proves to be a problem. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14450#discussion_r1232450331 From djelinski at openjdk.org Fri Jun 16 16:27:08 2023 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Fri, 16 Jun 2023 16:27:08 GMT Subject: RFR: 8309939: HttpClient should not use Instant.now() as Instant source for deadlines [v5] In-Reply-To: References: <2he50rg26x_11srLEcMzVKcOj6BkQs6CyWsqF4WoXD8=.524fb1b2-c02b-48d8-9df0-83ed6ef3e2d1@github.com> Message-ID: On Wed, 14 Jun 2023 15:39:10 GMT, Daniel Fuchs wrote: >> The HttpClient uses `Instant.now()` to create deadlines for timeouts. This could have undesirable effects since `Instant.now()` is linked to the wall clock, which is not monotonic. This fix changes the HttpClient to use a monotonic instant source based on `System.nanoTime()` for the purpose of setting and comparing deadlines. > > Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: > > Use Deadline rather than Instant Using nanoTime as @RogerRiggs suggested is worth exploring, but IMO the current version is good enough for internal use. ------------- Marked as reviewed by djelinski (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14450#pullrequestreview-1483896129 From duke at openjdk.org Fri Jun 16 17:19:28 2023 From: duke at openjdk.org (Terry Chow) Date: Fri, 16 Jun 2023 17:19:28 GMT Subject: RFR: 8308593: Add Keepalive Extended Socket Options Support for Windows [v2] In-Reply-To: <7yOv2rc-pawQNLJSkjIU_fP2Z0hofqh1SMvN0dihFUk=.75f29eed-dbc0-48b6-8e59-86750691e6c1@github.com> References: <7yOv2rc-pawQNLJSkjIU_fP2Z0hofqh1SMvN0dihFUk=.75f29eed-dbc0-48b6-8e59-86750691e6c1@github.com> Message-ID: > The PR adds support for the keepalive extended socket options on Windows. For TCP_KEEPIDLE and TCP_KEEPINTVL, these options are supported starting from Windows 10 version 1709. TCP_KEEPCNT is supported starting from Windows 10 version 1703. Information on these socket options can be found [here](https://learn.microsoft.com/en-us/windows/win32/winsock/ipproto-tcp-socket-options). > > I've also corrected the `handleError()` function. On Windows, the error needs to be retrieved using `WSAGetLastError()` and error codes are prefixed with "WSA". Information on this can be found [here](https://learn.microsoft.com/en-us/windows/win32/winsock/error-codes-errno-h-errno-and-wsagetlasterror-2). > >>The error codes returned by Windows Sockets are similar to UNIX socket error code constants, but the constants are all prefixed with WSA. > >>Error codes set by Windows Sockets are not made available through the errno variable. > > No new tests were added as the existing tests should cover this. Terry Chow has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains one additional commit since the last revision: Support keepalive extended socket options for Windows ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14232/files - new: https://git.openjdk.org/jdk/pull/14232/files/a7858982..2ada2207 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14232&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14232&range=00-01 Stats: 78650 lines in 1390 files changed: 57268 ins; 16375 del; 5007 mod Patch: https://git.openjdk.org/jdk/pull/14232.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14232/head:pull/14232 PR: https://git.openjdk.org/jdk/pull/14232 From dfuchs at openjdk.org Mon Jun 19 09:50:14 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Mon, 19 Jun 2023 09:50:14 GMT Subject: RFR: 8309939: HttpClient should not use Instant.now() as Instant source for deadlines [v6] In-Reply-To: <2he50rg26x_11srLEcMzVKcOj6BkQs6CyWsqF4WoXD8=.524fb1b2-c02b-48d8-9df0-83ed6ef3e2d1@github.com> References: <2he50rg26x_11srLEcMzVKcOj6BkQs6CyWsqF4WoXD8=.524fb1b2-c02b-48d8-9df0-83ed6ef3e2d1@github.com> Message-ID: > The HttpClient uses `Instant.now()` to create deadlines for timeouts. This could have undesirable effects since `Instant.now()` is linked to the wall clock, which is not monotonic. This fix changes the HttpClient to use a monotonic instant source based on `System.nanoTime()` for the purpose of setting and comparing deadlines. Daniel Fuchs has updated the pull request incrementally with two additional commits since the last revision: - whitespaces - Change Deadline::toString ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14450/files - new: https://git.openjdk.org/jdk/pull/14450/files/e5f6cd60..e512b7cb Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14450&range=05 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14450&range=04-05 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/14450.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14450/head:pull/14450 PR: https://git.openjdk.org/jdk/pull/14450 From dfuchs at openjdk.org Mon Jun 19 13:29:25 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Mon, 19 Jun 2023 13:29:25 GMT Subject: Integrated: 8309939: HttpClient should not use Instant.now() as Instant source for deadlines In-Reply-To: <2he50rg26x_11srLEcMzVKcOj6BkQs6CyWsqF4WoXD8=.524fb1b2-c02b-48d8-9df0-83ed6ef3e2d1@github.com> References: <2he50rg26x_11srLEcMzVKcOj6BkQs6CyWsqF4WoXD8=.524fb1b2-c02b-48d8-9df0-83ed6ef3e2d1@github.com> Message-ID: On Tue, 13 Jun 2023 15:40:34 GMT, Daniel Fuchs wrote: > The HttpClient uses `Instant.now()` to create deadlines for timeouts. This could have undesirable effects since `Instant.now()` is linked to the wall clock, which is not monotonic. This fix changes the HttpClient to use a monotonic instant source based on `System.nanoTime()` for the purpose of setting and comparing deadlines. This pull request has now been integrated. Changeset: f8f8bfbe Author: Daniel Fuchs URL: https://git.openjdk.org/jdk/commit/f8f8bfbea15de0a57415ba27ad5722b6a4add07a Stats: 442 lines in 8 files changed: 412 ins; 2 del; 28 mod 8309939: HttpClient should not use Instant.now() as Instant source for deadlines Reviewed-by: djelinski ------------- PR: https://git.openjdk.org/jdk/pull/14450 From dfuchs at openjdk.org Mon Jun 19 17:23:19 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Mon, 19 Jun 2023 17:23:19 GMT Subject: RFR: 8310330: HttpClient: debugging interestOps/readyOps could cause exceptions and smaller cleanup Message-ID: Please find here a change that makes sure that debugging interestOps/readyOps won't cause exceptions to be raised. The change also contains smaller cleanup: extracting ALPN contants to their own class, removing/adding newlines at end of files, avoiding long lines in some occasions, removing some unused imports, etc... ------------- Commit messages: - whitespaces - 8310330 Changes: https://git.openjdk.org/jdk/pull/14546/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14546&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8310330 Stats: 216 lines in 32 files changed: 150 ins; 36 del; 30 mod Patch: https://git.openjdk.org/jdk/pull/14546.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14546/head:pull/14546 PR: https://git.openjdk.org/jdk/pull/14546 From dholmes at openjdk.org Mon Jun 19 22:32:05 2023 From: dholmes at openjdk.org (David Holmes) Date: Mon, 19 Jun 2023 22:32:05 GMT Subject: RFR: 8304478: Initial nroff manpage generation for JDK 22 [v2] In-Reply-To: References: Message-ID: > Updated the version to 22-ea and year to 2024. > > The following unpublished changes will also be included in this update: > - [JDK-8290626](https://bugs.openjdk.org/browse/JDK-8290626): keytool manpage contains a special character > - [JDK-8303928](https://bugs.openjdk.org/browse/JDK-8303928): Update jarsigner man page after [JDK-8303410](https://bugs.openjdk.org/browse/JDK-8303410) > - [JDK-8301207](https://bugs.openjdk.org/browse/JDK-8301207): (jdeps) Deprecate jdeps -profile option > > The following changes, to `javac.1`, were never applied to the closed sources and are "lost" by this update. These changes will need to be re-applied directly in JDK 21 and JDK 22: > - [JDK-8296656](https://bugs.openjdk.org/browse/JDK-8296656): java.lang.NoClassDefFoundError exception on running fully legitimate code > - [JDK-8015831](https://bugs.openjdk.org/browse/JDK-8015831): Add lint check for calling overridable methods from a constructor > > Thanks. David Holmes has updated the pull request incrementally with one additional commit since the last revision: Pick up javac and jshell changes ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14462/files - new: https://git.openjdk.org/jdk/pull/14462/files/3efc518f..e8ff96d1 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14462&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14462&range=00-01 Stats: 74 lines in 2 files changed: 71 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/14462.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14462/head:pull/14462 PR: https://git.openjdk.org/jdk/pull/14462 From dholmes at openjdk.org Mon Jun 19 22:32:07 2023 From: dholmes at openjdk.org (David Holmes) Date: Mon, 19 Jun 2023 22:32:07 GMT Subject: RFR: 8304478: Initial nroff manpage generation for JDK 22 In-Reply-To: References: Message-ID: On Wed, 14 Jun 2023 04:53:58 GMT, David Holmes wrote: > Updated the version to 22-ea and year to 2024. > > The following unpublished changes will also be included in this update: > - [JDK-8290626](https://bugs.openjdk.org/browse/JDK-8290626): keytool manpage contains a special character > - [JDK-8303928](https://bugs.openjdk.org/browse/JDK-8303928): Update jarsigner man page after [JDK-8303410](https://bugs.openjdk.org/browse/JDK-8303410) > - [JDK-8301207](https://bugs.openjdk.org/browse/JDK-8301207): (jdeps) Deprecate jdeps -profile option > > The following changes, to `javac.1`, were never applied to the closed sources and are "lost" by this update. These changes will need to be re-applied directly in JDK 21 and JDK 22: > - [JDK-8296656](https://bugs.openjdk.org/browse/JDK-8296656): java.lang.NoClassDefFoundError exception on running fully legitimate code > - [JDK-8015831](https://bugs.openjdk.org/browse/JDK-8015831): Add lint check for calling overridable methods from a constructor > > Thanks. The javac changes have been restored so I am merging them into this PR - the only difference should be minor formatting changes. This has also now picked up the jshell changes from JDK-8308988. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14462#issuecomment-1597836257 From dholmes at openjdk.org Mon Jun 19 22:34:29 2023 From: dholmes at openjdk.org (David Holmes) Date: Mon, 19 Jun 2023 22:34:29 GMT Subject: Integrated: 8304478: Initial nroff manpage generation for JDK 22 In-Reply-To: References: Message-ID: On Wed, 14 Jun 2023 04:53:58 GMT, David Holmes wrote: > Updated the version to 22-ea and year to 2024. > > The following unpublished changes will also be included in this update: > - [JDK-8290626](https://bugs.openjdk.org/browse/JDK-8290626): keytool manpage contains a special character > - [JDK-8303928](https://bugs.openjdk.org/browse/JDK-8303928): Update jarsigner man page after [JDK-8303410](https://bugs.openjdk.org/browse/JDK-8303410) > - [JDK-8301207](https://bugs.openjdk.org/browse/JDK-8301207): (jdeps) Deprecate jdeps -profile option > > The following changes, to `javac.1`, were never applied to the closed sources and are "lost" by this update. These changes will need to be re-applied directly in JDK 21 and JDK 22: > - [JDK-8296656](https://bugs.openjdk.org/browse/JDK-8296656): java.lang.NoClassDefFoundError exception on running fully legitimate code > - [JDK-8015831](https://bugs.openjdk.org/browse/JDK-8015831): Add lint check for calling overridable methods from a constructor > > Thanks. This pull request has now been integrated. Changeset: b2e86aef Author: David Holmes URL: https://git.openjdk.org/jdk/commit/b2e86aef65f4d579896b6db83aaad408b6c580d4 Stats: 129 lines in 28 files changed: 24 ins; 57 del; 48 mod 8304478: Initial nroff manpage generation for JDK 22 Reviewed-by: alanb, sspitsyn, mchung, lancea ------------- PR: https://git.openjdk.org/jdk/pull/14462 From dholmes at openjdk.org Mon Jun 19 22:34:28 2023 From: dholmes at openjdk.org (David Holmes) Date: Mon, 19 Jun 2023 22:34:28 GMT Subject: RFR: 8304478: Initial nroff manpage generation for JDK 22 In-Reply-To: References: Message-ID: On Wed, 14 Jun 2023 04:53:58 GMT, David Holmes wrote: > Updated the version to 22-ea and year to 2024. > > The following unpublished changes will also be included in this update: > - [JDK-8290626](https://bugs.openjdk.org/browse/JDK-8290626): keytool manpage contains a special character > - [JDK-8303928](https://bugs.openjdk.org/browse/JDK-8303928): Update jarsigner man page after [JDK-8303410](https://bugs.openjdk.org/browse/JDK-8303410) > - [JDK-8301207](https://bugs.openjdk.org/browse/JDK-8301207): (jdeps) Deprecate jdeps -profile option > > The following changes, to `javac.1`, were never applied to the closed sources and are "lost" by this update. These changes will need to be re-applied directly in JDK 21 and JDK 22: > - [JDK-8296656](https://bugs.openjdk.org/browse/JDK-8296656): java.lang.NoClassDefFoundError exception on running fully legitimate code > - [JDK-8015831](https://bugs.openjdk.org/browse/JDK-8015831): Add lint check for calling overridable methods from a constructor > > Thanks. The javac update has also now pulled in JDK-8308456 ------------- PR Comment: https://git.openjdk.org/jdk/pull/14462#issuecomment-1597839767 From djelinski at openjdk.org Tue Jun 20 06:47:03 2023 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Tue, 20 Jun 2023 06:47:03 GMT Subject: RFR: 8310330: HttpClient: debugging interestOps/readyOps could cause exceptions and smaller cleanup In-Reply-To: References: Message-ID: <3hl_GjE1vg7SMCmCEnyG1USgNSr-ntGW-AQWGduHgJU=.a74385d6-68e3-41e3-9d93-3b55e5482172@github.com> On Mon, 19 Jun 2023 16:34:10 GMT, Daniel Fuchs wrote: > Please find here a change that makes sure that debugging interestOps/readyOps won't cause exceptions to be raised. > The change also contains smaller cleanup: extracting ALPN contants to their own class, removing/adding newlines at end of files, avoiding long lines in some occasions, removing some unused imports, etc... LGTM. 2 minor issues reported in line. Please update copyright before integrating. src/java.net.http/share/classes/jdk/internal/net/http/HttpConnection.java line 294: > 292: String[] alpn = null; > 293: if (version == HTTP_2 && hasRequiredHTTP2TLSVersion(client)) { > 294: alpn = new String[] {Alpns.H2, Alpns.HTTP_1_1 }; Suggestion: alpn = new String[] { Alpns.H2, Alpns.HTTP_1_1 }; src/java.net.http/share/classes/jdk/internal/net/http/common/DebugLogger.java line 282: > 280: && logger.isLoggable(level)) { > 281: logger.log(level, unused, > 282: format(new StringBuilder(), msg, null).toString(), `getFormat` is no longer used, can you remove it? ------------- Marked as reviewed by djelinski (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14546#pullrequestreview-1486842723 PR Review Comment: https://git.openjdk.org/jdk/pull/14546#discussion_r1234422071 PR Review Comment: https://git.openjdk.org/jdk/pull/14546#discussion_r1234802376 From dfuchs at openjdk.org Tue Jun 20 11:29:38 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Tue, 20 Jun 2023 11:29:38 GMT Subject: RFR: 8310330: HttpClient: debugging interestOps/readyOps could cause exceptions and smaller cleanup [v2] In-Reply-To: References: Message-ID: > Please find here a change that makes sure that debugging interestOps/readyOps won't cause exceptions to be raised. > The change also contains smaller cleanup: extracting ALPN contants to their own class, removing/adding newlines at end of files, avoiding long lines in some occasions, removing some unused imports, etc... Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: Update src/java.net.http/share/classes/jdk/internal/net/http/HttpConnection.java Co-authored-by: Daniel Jelinski ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14546/files - new: https://git.openjdk.org/jdk/pull/14546/files/c55af569..a46fe48b Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14546&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14546&range=00-01 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/14546.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14546/head:pull/14546 PR: https://git.openjdk.org/jdk/pull/14546 From dfuchs at openjdk.org Tue Jun 20 11:32:25 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Tue, 20 Jun 2023 11:32:25 GMT Subject: RFR: 8310330: HttpClient: debugging interestOps/readyOps could cause exceptions and smaller cleanup [v3] In-Reply-To: <3hl_GjE1vg7SMCmCEnyG1USgNSr-ntGW-AQWGduHgJU=.a74385d6-68e3-41e3-9d93-3b55e5482172@github.com> References: <3hl_GjE1vg7SMCmCEnyG1USgNSr-ntGW-AQWGduHgJU=.a74385d6-68e3-41e3-9d93-3b55e5482172@github.com> Message-ID: On Tue, 20 Jun 2023 06:38:21 GMT, Daniel Jeli?ski wrote: >> Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: >> >> Removed unused getFormat > > src/java.net.http/share/classes/jdk/internal/net/http/common/DebugLogger.java line 282: > >> 280: && logger.isLoggable(level)) { >> 281: logger.log(level, unused, >> 282: format(new StringBuilder(), msg, null).toString(), > > `getFormat` is no longer used, can you remove it? Oh - that's an oversight indeed. Thanks for spotting it. Done. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14546#discussion_r1235127205 From dfuchs at openjdk.org Tue Jun 20 11:32:22 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Tue, 20 Jun 2023 11:32:22 GMT Subject: RFR: 8310330: HttpClient: debugging interestOps/readyOps could cause exceptions and smaller cleanup [v3] In-Reply-To: References: Message-ID: > Please find here a change that makes sure that debugging interestOps/readyOps won't cause exceptions to be raised. > The change also contains smaller cleanup: extracting ALPN contants to their own class, removing/adding newlines at end of files, avoiding long lines in some occasions, removing some unused imports, etc... Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: Removed unused getFormat ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14546/files - new: https://git.openjdk.org/jdk/pull/14546/files/a46fe48b..0f39f297 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14546&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14546&range=01-02 Stats: 16 lines in 1 file changed: 0 ins; 16 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/14546.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14546/head:pull/14546 PR: https://git.openjdk.org/jdk/pull/14546 From dfuchs at openjdk.org Tue Jun 20 11:45:46 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Tue, 20 Jun 2023 11:45:46 GMT Subject: RFR: 8310330: HttpClient: debugging interestOps/readyOps could cause exceptions and smaller cleanup [v4] In-Reply-To: References: Message-ID: > Please find here a change that makes sure that debugging interestOps/readyOps won't cause exceptions to be raised. > The change also contains smaller cleanup: extracting ALPN contants to their own class, removing/adding newlines at end of files, avoiding long lines in some occasions, removing some unused imports, etc... Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: Update Copyright years ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14546/files - new: https://git.openjdk.org/jdk/pull/14546/files/0f39f297..81c4e29f Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14546&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14546&range=02-03 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/14546.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14546/head:pull/14546 PR: https://git.openjdk.org/jdk/pull/14546 From djelinski at openjdk.org Tue Jun 20 12:04:11 2023 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Tue, 20 Jun 2023 12:04:11 GMT Subject: RFR: 8310330: HttpClient: debugging interestOps/readyOps could cause exceptions and smaller cleanup [v4] In-Reply-To: References: Message-ID: On Tue, 20 Jun 2023 11:45:46 GMT, Daniel Fuchs wrote: >> Please find here a change that makes sure that debugging interestOps/readyOps won't cause exceptions to be raised. >> The change also contains smaller cleanup: extracting ALPN contants to their own class, removing/adding newlines at end of files, avoiding long lines in some occasions, removing some unused imports, etc... > > Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: > > Update Copyright years Marked as reviewed by djelinski (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14546#pullrequestreview-1487985017 From dfuchs at openjdk.org Tue Jun 20 15:54:57 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Tue, 20 Jun 2023 15:54:57 GMT Subject: Integrated: 8310330: HttpClient: debugging interestOps/readyOps could cause exceptions and smaller cleanup In-Reply-To: References: Message-ID: On Mon, 19 Jun 2023 16:34:10 GMT, Daniel Fuchs wrote: > Please find here a change that makes sure that debugging interestOps/readyOps won't cause exceptions to be raised. > The change also contains smaller cleanup: extracting ALPN contants to their own class, removing/adding newlines at end of files, avoiding long lines in some occasions, removing some unused imports, etc... This pull request has now been integrated. Changeset: 99d2a9af Author: Daniel Fuchs URL: https://git.openjdk.org/jdk/commit/99d2a9afa95a1f1aa090316e702d8f508e094729 Stats: 221 lines in 32 files changed: 140 ins; 42 del; 39 mod 8310330: HttpClient: debugging interestOps/readyOps could cause exceptions and smaller cleanup Reviewed-by: djelinski ------------- PR: https://git.openjdk.org/jdk/pull/14546 From dclarke at openjdk.org Wed Jun 21 11:43:15 2023 From: dclarke at openjdk.org (Darragh Clarke) Date: Wed, 21 Jun 2023 11:43:15 GMT Subject: [jdk21] RFR: 8308336: Test java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java failed: java.net.BindException: Address already in use Message-ID: Hey This pull request contains a backport of commit [a48bcf36](https://github.com/openjdk/jdk/commit/a48bcf367120fc7cde88b19097dabe9c86c90bb7) I reran tests just to make sure it worked as expected ------------- Commit messages: - Backport a48bcf367120fc7cde88b19097dabe9c86c90bb7 Changes: https://git.openjdk.org/jdk21/pull/52/files Webrev: https://webrevs.openjdk.org/?repo=jdk21&pr=52&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8308336 Stats: 10 lines in 1 file changed: 7 ins; 0 del; 3 mod Patch: https://git.openjdk.org/jdk21/pull/52.diff Fetch: git fetch https://git.openjdk.org/jdk21.git pull/52/head:pull/52 PR: https://git.openjdk.org/jdk21/pull/52 From dfuchs at openjdk.org Wed Jun 21 15:05:11 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Wed, 21 Jun 2023 15:05:11 GMT Subject: [jdk21] RFR: 8308336: Test java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java failed: java.net.BindException: Address already in use In-Reply-To: References: Message-ID: <9b9MzLfHfX15hMk7TcfL0XOhi7PTjtejPA93YhvxN3I=.a0866692-0cde-469c-8943-2378443af850@github.com> On Wed, 21 Jun 2023 11:36:28 GMT, Darragh Clarke wrote: > Hey > > This pull request contains a backport of commit [a48bcf36](https://github.com/openjdk/jdk/commit/a48bcf367120fc7cde88b19097dabe9c86c90bb7) > > I reran tests just to make sure it worked as expected Marked as reviewed by dfuchs (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk21/pull/52#pullrequestreview-1491007354 From duke at openjdk.org Wed Jun 21 15:06:13 2023 From: duke at openjdk.org (Pushkar N Kulkarni) Date: Wed, 21 Jun 2023 15:06:13 GMT Subject: RFR: 8308807: [AIX] MulticastSocket and jdp test fails due to joinGroup In-Reply-To: References: <4tkYKvpBoxO7IK4HevAqpEY5KoqxXUK6rs0scqyxgJc=.69de9b21-5a2f-45ef-b05f-1bc8ad398dad@github.com> Message-ID: On Tue, 13 Jun 2023 07:01:28 GMT, Alan Bateman wrote: >>> Well, in that area we always had deviations on AIX, so definitely this rings a bell. However, since AIX was not the most important platform for us and that particular IPv6/IPv4 multicast feature didn't seem to be mission critical and wouldn't fail TCK tests, we rather resorted to excluding some tests internally, I believe. But it would be good to really resolve this compatibility/spec/documentation issue, if possible. >> >> Thanks. So yes, if some/all of the tests for multicasting were excluded then it helps explain why it didn't come up. The spec doesn't require that a DatgaramSocket or DatagramChannel to an IPv6 socket be capable of joining an IPv4 multicast group. So the tests in several areas might need updates as I don't think we've had a platform to date where it wasn't possible. > >> @AlanBateman , is it possible if there is a central place where the change could me made for fixing all of the multicast test cases? > > Your starting point is probably to exclude all of the tests that are failing. This will be tests for DatagramSocket/MulticastSocket, DatagramChannel and the tests for the JMX agent that use the discovery protocol. Once they are excluded then you can start working through the issues. > > For the JMX agent, then I would expect that if if the system property com.sun.management.jdp.address is configured then the protocol family is known so it should be possible to create the DatagramChannel to use that protocol family. It might do so already, but you can check that. > > For the networking and NIO tests then you probably should look at jdk.test.lib.NetworkConfiguration. That has a number of AIX specific comments that may be out of date. After that I think you will need to work through the tests one by one. Between NetworkConfiguration and jdk.test.lib.net.IPSupport, I would expect you have all the infrastructure needed for the tests to not attempt to join IPv4 multicast groups when IPSupport.hasIPv6() is true. > > Yes, I agree with @AlanBateman and @msheppar . Even when we try to have an IPv4 multicast socket join an IPv4 multicast group, we still fail because the delegate that is created for an IPv4 multicast socket is IPv4/IPv6 (dual stack) in nature. AIX does not allow dual stack (IPv4/IPv6) sockets to join IPv4 multicast groups. > > The "Platform dependencies" section in the java.nio.channels.MulticastChannel (implemented by DatagramChannel) makes it clear that it is implementation specific as to whether a channel to an IPv6 socket can join an IPv4 multicast group. The recommendation is to specify the protocol family when creating the channel. Legacy DatagramSocket/MulticastSocket do not define a constructor that allows the protocol family be specified at xxxSocket create time. That issue has been there since JDK 1.4 when IPv6 support was added. I'm curious why this might be coming up with AIX now. IIUC what @deepa181 is saying, it looks like the "IPv4 socket being unable to join an IPv4 multicast group" problems surfaced when we moved away from `PlainDatagramSocketImpl` in JDK 17? Probably because the `delegate` created does not factor in the `ProtocolFamily` and though we started with attempting to have an "IPv4 multicast socket join an IPv4 group", we end up trying to have an "IPv4/IPv6 dual-stack socket (the delegate) join an IPv4 group" which AIX doesn't permit. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14142#issuecomment-1601007522 From dclarke at openjdk.org Wed Jun 21 15:14:12 2023 From: dclarke at openjdk.org (Darragh Clarke) Date: Wed, 21 Jun 2023 15:14:12 GMT Subject: [jdk21] Integrated: 8308336: Test java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java failed: java.net.BindException: Address already in use In-Reply-To: References: Message-ID: On Wed, 21 Jun 2023 11:36:28 GMT, Darragh Clarke wrote: > Hey > > This pull request contains a backport of commit [a48bcf36](https://github.com/openjdk/jdk/commit/a48bcf367120fc7cde88b19097dabe9c86c90bb7) > > I reran tests just to make sure it worked as expected This pull request has now been integrated. Changeset: a4159dda Author: Darragh Clarke URL: https://git.openjdk.org/jdk21/commit/a4159ddaa2371d1826db24b6a238c816f9abdf2a Stats: 10 lines in 1 file changed: 7 ins; 0 del; 3 mod 8308336: Test java/net/HttpURLConnection/HttpURLConnectionExpectContinueTest.java failed: java.net.BindException: Address already in use Reviewed-by: dfuchs Backport-of: a48bcf367120fc7cde88b19097dabe9c86c90bb7 ------------- PR: https://git.openjdk.org/jdk21/pull/52 From dfuchs at openjdk.org Wed Jun 21 15:23:10 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Wed, 21 Jun 2023 15:23:10 GMT Subject: RFR: 8308807: [AIX] MulticastSocket and jdp test fails due to joinGroup In-Reply-To: <5ai8MHV2EQmFEcuMNWYM7Rz88cUl9dVnXNQolLQ3Jp8=.af5976df-6b30-4842-9b5a-7550e2fcdd0a@github.com> References: <4tkYKvpBoxO7IK4HevAqpEY5KoqxXUK6rs0scqyxgJc=.69de9b21-5a2f-45ef-b05f-1bc8ad398dad@github.com> <5ai8MHV2EQmFEcuMNWYM7Rz88cUl9dVnXNQolLQ3Jp8=.af5976df-6b30-4842-9b5a-7550e2fcdd0a@github.com> Message-ID: On Mon, 12 Jun 2023 19:27:28 GMT, Deepa Kumari wrote: >>> Well, in that area we always had deviations on AIX, so definitely this rings a bell. However, since AIX was not the most important platform for us and that particular IPv6/IPv4 multicast feature didn't seem to be mission critical and wouldn't fail TCK tests, we rather resorted to excluding some tests internally, I believe. But it would be good to really resolve this compatibility/spec/documentation issue, if possible. >> >> Thanks. So yes, if some/all of the tests for multicasting were excluded then it helps explain why it didn't come up. The spec doesn't require that a DatgaramSocket or DatagramChannel to an IPv6 socket be capable of joining an IPv4 multicast group. So the tests in several areas might need updates as I don't think we've had a platform to date where it wasn't possible. > >> > Well, in that area we always had deviations on AIX, so definitely this rings a bell. However, since AIX was not the most important platform for us and that particular IPv6/IPv4 multicast feature didn't seem to be mission critical and wouldn't fail TCK tests, we rather resorted to excluding some tests internally, I believe. But it would be good to really resolve this compatibility/spec/documentation issue, if possible. >> >> Thanks. So yes, if some/all of the tests for multicasting were excluded then it helps explain why it didn't come up. The spec doesn't require that a DatgaramSocket or DatagramChannel to an IPv6 socket be capable of joining an IPv4 multicast group. So the tests in several areas might need updates as I don't think we've had a platform to date where it wasn't possible. > > @AlanBateman , is it possible if there is a central place where the change could me made for fixing all of the multicast test cases? > IIUC what @deepa181 is saying, it looks like the "IPv4 socket being unable to join an IPv4 multicast group" problems surfaced when we moved away from PlainDatagramSocketImpl in JDK 17? Probably because the delegate created does not factor in the ProtocolFamily and though we started with attempting to have an "IPv4 multicast socket join an IPv4 group", we end up trying to have an "IPv4/IPv6 dual-stack socket (the delegate) join an IPv4 group" which AIX doesn't permit. IIRC It has never been possible to create a non-dual `MulticastSocket` / `DatagramSocket` without setting the property `-Djava.net.preferIPv4Stack=true`. The possibility to select a protocol family independently of this property is only available with `DatagramChannel`. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14142#issuecomment-1601038453 From alanb at openjdk.org Wed Jun 21 15:48:09 2023 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 21 Jun 2023 15:48:09 GMT Subject: RFR: 8308807: [AIX] MulticastSocket and jdp test fails due to joinGroup In-Reply-To: References: <4tkYKvpBoxO7IK4HevAqpEY5KoqxXUK6rs0scqyxgJc=.69de9b21-5a2f-45ef-b05f-1bc8ad398dad@github.com> <5ai8MHV2EQmFEcuMNWYM7Rz88cUl9dVnXNQolLQ3Jp8=.af5976df-6b30-4842-9b5a-7550e2fcdd0a@github.com> Message-ID: <-6rjVxKJKaCis7qu8jwSTxqsqXtGtrvpd4hY-JA3TZ0=.2a9ba8ab-8c14-48eb-a35d-3b3c150740f9@github.com> On Wed, 21 Jun 2023 15:18:32 GMT, Daniel Fuchs wrote: > IIRC It has never been possible to create a non-dual `MulticastSocket` / `DatagramSocket` without setting the property `-Djava.net.preferIPv4Stack=true`. The possibility to select a protocol family independently of this property is only available with `DatagramChannel`. Right now, Net.canIPv6SocketJoinIPv4Group() returns false on AIX so it will never attempt to join an IPv4 multicast group when the socket is IPv6. The old DatagamSocketImpl didn't have an eager check, which makes me wonder what AIX supports and doesn't support, it's not clear. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14142#issuecomment-1601085660 From tprinzing at openjdk.org Wed Jun 21 22:46:20 2023 From: tprinzing at openjdk.org (Tim Prinzing) Date: Wed, 21 Jun 2023 22:46:20 GMT Subject: RFR: 8308995: Update Network IO JFR events to be static mirror events Message-ID: The socket read/write JFR events currently use instrumentation of java.base code using templates in the jdk.jfr modules. This results in some java.base code residing in the jdk.jfr module which is undesirable. JDK19 added static support for event classes. The old instrumentor classes should be replaced with mirror events using the static support. In the java.base module: Added two new events, jdk.internal.event.SocketReadEvent and jdk.internal.event.SocketWriteEvent. java.net.Socket and sun.nio.ch.SocketChannelImpl were changed to make use of the new events. In the jdk.jfr module: jdk.jfr.events.SocketReadEvent and jdk.jfr.events.SocketWriteEvent were changed to be mirror events. In the package jdk.jfr.internal.instrument, the classes SocketChannelImplInstrumentor, SocketInputStreamInstrumentor, and SocketOutputStreamInstrumentor were removed. The JDKEvents class was updated to reflect all of those changes. The existing tests in test/jdk/jdk/jfr/event/io continue to pass with the new implementation: Passed: jdk/jfr/event/io/TestSocketChannelEvents.java Passed: jdk/jfr/event/io/TestSocketEvents.java I added a micro benchmark which measures the overhead of handling the jfr socket events. test/micro/org/openjdk/bench/java/net/SocketEventOverhead.java. It needs access the jdk.internal.event package, which is done at runtime with annotations that add the extra arguments. At compile time the build arguments had to be augmented in make/test/BuildMicrobenchmark.gmk ------------- Commit messages: - some changes from review. - fix copyright date - Added micro benchmark to measure socket event overhead. - Some changes from review. - remove unnecessary cast - 8308995: Update Network IO JFR events to be static mirror events Changes: https://git.openjdk.org/jdk/pull/14342/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14342&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8308995 Stats: 896 lines in 12 files changed: 523 ins; 367 del; 6 mod Patch: https://git.openjdk.org/jdk/pull/14342.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14342/head:pull/14342 PR: https://git.openjdk.org/jdk/pull/14342 From alanb at openjdk.org Wed Jun 21 22:46:24 2023 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 21 Jun 2023 22:46:24 GMT Subject: RFR: 8308995: Update Network IO JFR events to be static mirror events In-Reply-To: References: Message-ID: On Tue, 6 Jun 2023 19:39:31 GMT, Tim Prinzing wrote: > The socket read/write JFR events currently use instrumentation of java.base code using templates in the jdk.jfr modules. This results in some java.base code residing in the jdk.jfr module which is undesirable. > > JDK19 added static support for event classes. The old instrumentor classes should be replaced with mirror events using the static support. > > In the java.base module: > Added two new events, jdk.internal.event.SocketReadEvent and jdk.internal.event.SocketWriteEvent. > java.net.Socket and sun.nio.ch.SocketChannelImpl were changed to make use of the new events. > > In the jdk.jfr module: > jdk.jfr.events.SocketReadEvent and jdk.jfr.events.SocketWriteEvent were changed to be mirror events. > In the package jdk.jfr.internal.instrument, the classes SocketChannelImplInstrumentor, SocketInputStreamInstrumentor, and SocketOutputStreamInstrumentor were removed. The JDKEvents class was updated to reflect all of those changes. > > The existing tests in test/jdk/jdk/jfr/event/io continue to pass with the new implementation: > Passed: jdk/jfr/event/io/TestSocketChannelEvents.java > Passed: jdk/jfr/event/io/TestSocketEvents.java > > I added a micro benchmark which measures the overhead of handling the jfr socket events. > test/micro/org/openjdk/bench/java/net/SocketEventOverhead.java. > It needs access the jdk.internal.event package, which is done at runtime with annotations that add the extra arguments. > At compile time the build arguments had to be augmented in make/test/BuildMicrobenchmark.gmk src/java.base/share/classes/java/net/Socket.java line 43: > 41: import java.util.Collections; > 42: > 43: import jdk.internal.event.SocketWriteEvent; You'll probably want to clean up the imports to avoid having import of jdk.internal classes in two places. src/java.base/share/classes/java/net/Socket.java line 1109: > 1107: nbytes = read0(b, off, len); > 1108: } finally { > 1109: SocketReadEvent.checkForCommit(start, nbytes, parent.getRemoteSocketAddress(), parent.getSoTimeout()); So if read throws, this will commit a jdk.SocketReadEvent with size 0, maybe this will change later to include the exception? src/java.base/share/classes/java/net/Socket.java line 1114: > 1112: } > 1113: > 1114: private int read0(byte[] b, int off, int len) throws IOException { Can you rename this to implRead? src/java.base/share/classes/java/net/Socket.java line 1215: > 1213: return; > 1214: } > 1215: int bytesWritten = 0; Is bytesWritten needed? src/java.base/share/classes/java/net/Socket.java line 1226: > 1224: } > 1225: > 1226: public void write0(byte[] b, int off, int len) throws IOException { Can you change this to be private and rename to implWrite? src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java line 421: > 419: } > 420: > 421: private int read0(ByteBuffer buf) throws IOException { Can you rename this to implRead too? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14342#discussion_r1236731407 PR Review Comment: https://git.openjdk.org/jdk/pull/14342#discussion_r1237226982 PR Review Comment: https://git.openjdk.org/jdk/pull/14342#discussion_r1236719052 PR Review Comment: https://git.openjdk.org/jdk/pull/14342#discussion_r1236719603 PR Review Comment: https://git.openjdk.org/jdk/pull/14342#discussion_r1236719373 PR Review Comment: https://git.openjdk.org/jdk/pull/14342#discussion_r1237227861 From smarks at openjdk.org Wed Jun 21 22:46:25 2023 From: smarks at openjdk.org (Stuart Marks) Date: Wed, 21 Jun 2023 22:46:25 GMT Subject: RFR: 8308995: Update Network IO JFR events to be static mirror events In-Reply-To: References: Message-ID: On Wed, 21 Jun 2023 09:46:35 GMT, Alan Bateman wrote: >> The socket read/write JFR events currently use instrumentation of java.base code using templates in the jdk.jfr modules. This results in some java.base code residing in the jdk.jfr module which is undesirable. >> >> JDK19 added static support for event classes. The old instrumentor classes should be replaced with mirror events using the static support. >> >> In the java.base module: >> Added two new events, jdk.internal.event.SocketReadEvent and jdk.internal.event.SocketWriteEvent. >> java.net.Socket and sun.nio.ch.SocketChannelImpl were changed to make use of the new events. >> >> In the jdk.jfr module: >> jdk.jfr.events.SocketReadEvent and jdk.jfr.events.SocketWriteEvent were changed to be mirror events. >> In the package jdk.jfr.internal.instrument, the classes SocketChannelImplInstrumentor, SocketInputStreamInstrumentor, and SocketOutputStreamInstrumentor were removed. The JDKEvents class was updated to reflect all of those changes. >> >> The existing tests in test/jdk/jdk/jfr/event/io continue to pass with the new implementation: >> Passed: jdk/jfr/event/io/TestSocketChannelEvents.java >> Passed: jdk/jfr/event/io/TestSocketEvents.java >> >> I added a micro benchmark which measures the overhead of handling the jfr socket events. >> test/micro/org/openjdk/bench/java/net/SocketEventOverhead.java. >> It needs access the jdk.internal.event package, which is done at runtime with annotations that add the extra arguments. >> At compile time the build arguments had to be augmented in make/test/BuildMicrobenchmark.gmk > > src/java.base/share/classes/java/net/Socket.java line 1114: > >> 1112: } >> 1113: >> 1114: private int read0(byte[] b, int off, int len) throws IOException { > > Can you rename this to implRead? Are we using a convention of `implRead` or `readImpl`? Either is ok with me, but I think we had been using `readImpl` and similar elsewhere. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14342#discussion_r1237316630 From alanb at openjdk.org Wed Jun 21 22:46:25 2023 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 21 Jun 2023 22:46:25 GMT Subject: RFR: 8308995: Update Network IO JFR events to be static mirror events In-Reply-To: References: Message-ID: On Wed, 21 Jun 2023 16:59:22 GMT, Stuart Marks wrote: > Are we using a convention of `implRead` or `readImpl`? Either is ok with me, but I think we had been using `readImpl` and similar elsewhere. This code is already using implXXX so it's just be consistent. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14342#discussion_r1237319486 From serb at openjdk.org Wed Jun 21 22:48:16 2023 From: serb at openjdk.org (Sergey Bylokhov) Date: Wed, 21 Jun 2023 22:48:16 GMT Subject: [jdk21] RFR: 8304885: Reuse stale data to improve DNS resolver resiliency Message-ID: Hi all, This pull request contains a backport of commit [bdd81b31](https://github.com/openjdk/jdk/commit/bdd81b31825a9eb6a0f0883fca56a011ac2aebf8) from the [openjdk/jdk](https://git.openjdk.org/jdk) repository. The commit being backported was authored by Sergey Bylokhov on 9 Jun 2023 and was reviewed by Michael McMahon and Daniel Fuchs. CSR is approved for JDK 21: https://bugs.openjdk.org/browse/JDK-8306653 "jdk21-enhancement-yes" label is added to the JBS. Thanks! ------------- Commit messages: - Backport bdd81b31825a9eb6a0f0883fca56a011ac2aebf8 Changes: https://git.openjdk.org/jdk21/pull/53/files Webrev: https://webrevs.openjdk.org/?repo=jdk21&pr=53&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8304885 Stats: 516 lines in 16 files changed: 429 ins; 55 del; 32 mod Patch: https://git.openjdk.org/jdk21/pull/53.diff Fetch: git fetch https://git.openjdk.org/jdk21.git pull/53/head:pull/53 PR: https://git.openjdk.org/jdk21/pull/53 From egahlin at openjdk.org Thu Jun 22 07:52:08 2023 From: egahlin at openjdk.org (Erik Gahlin) Date: Thu, 22 Jun 2023 07:52:08 GMT Subject: RFR: 8308995: Update Network IO JFR events to be static mirror events In-Reply-To: References: Message-ID: On Tue, 6 Jun 2023 19:39:31 GMT, Tim Prinzing wrote: > The socket read/write JFR events currently use instrumentation of java.base code using templates in the jdk.jfr modules. This results in some java.base code residing in the jdk.jfr module which is undesirable. > > JDK19 added static support for event classes. The old instrumentor classes should be replaced with mirror events using the static support. > > In the java.base module: > Added two new events, jdk.internal.event.SocketReadEvent and jdk.internal.event.SocketWriteEvent. > java.net.Socket and sun.nio.ch.SocketChannelImpl were changed to make use of the new events. > > In the jdk.jfr module: > jdk.jfr.events.SocketReadEvent and jdk.jfr.events.SocketWriteEvent were changed to be mirror events. > In the package jdk.jfr.internal.instrument, the classes SocketChannelImplInstrumentor, SocketInputStreamInstrumentor, and SocketOutputStreamInstrumentor were removed. The JDKEvents class was updated to reflect all of those changes. > > The existing tests in test/jdk/jdk/jfr/event/io continue to pass with the new implementation: > Passed: jdk/jfr/event/io/TestSocketChannelEvents.java > Passed: jdk/jfr/event/io/TestSocketEvents.java > > I added a micro benchmark which measures the overhead of handling the jfr socket events. > test/micro/org/openjdk/bench/java/net/SocketEventOverhead.java. > It needs access the jdk.internal.event package, which is done at runtime with annotations that add the extra arguments. > At compile time the build arguments had to be augmented in make/test/BuildMicrobenchmark.gmk I believe the fields SOCKET_READ and SOCKET_WRITE in the jdk.jfr.events.EventConfigurations class can be removed. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14342#issuecomment-1602173783 From alanb at openjdk.org Thu Jun 22 10:25:09 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 22 Jun 2023 10:25:09 GMT Subject: RFR: 8308995: Update Network IO JFR events to be static mirror events In-Reply-To: References: Message-ID: <-joCOXm52wMG9vCbBdDUHnZCqNCYoUj-ruNjZgv4mwY=.70571acf-a859-4c88-972f-49af60bfed64@github.com> On Tue, 6 Jun 2023 19:39:31 GMT, Tim Prinzing wrote: > The socket read/write JFR events currently use instrumentation of java.base code using templates in the jdk.jfr modules. This results in some java.base code residing in the jdk.jfr module which is undesirable. > > JDK19 added static support for event classes. The old instrumentor classes should be replaced with mirror events using the static support. > > In the java.base module: > Added two new events, jdk.internal.event.SocketReadEvent and jdk.internal.event.SocketWriteEvent. > java.net.Socket and sun.nio.ch.SocketChannelImpl were changed to make use of the new events. > > In the jdk.jfr module: > jdk.jfr.events.SocketReadEvent and jdk.jfr.events.SocketWriteEvent were changed to be mirror events. > In the package jdk.jfr.internal.instrument, the classes SocketChannelImplInstrumentor, SocketInputStreamInstrumentor, and SocketOutputStreamInstrumentor were removed. The JDKEvents class was updated to reflect all of those changes. > > The existing tests in test/jdk/jdk/jfr/event/io continue to pass with the new implementation: > Passed: jdk/jfr/event/io/TestSocketChannelEvents.java > Passed: jdk/jfr/event/io/TestSocketEvents.java > > I added a micro benchmark which measures the overhead of handling the jfr socket events. > test/micro/org/openjdk/bench/java/net/SocketEventOverhead.java. > It needs access the jdk.internal.event package, which is done at runtime with annotations that add the extra arguments. > At compile time the build arguments had to be augmented in make/test/BuildMicrobenchmark.gmk src/java.base/share/classes/java/net/Socket.java line 1101: > 1099: @Override > 1100: public int read(byte[] b, int off, int len) throws IOException { > 1101: if (! SocketReadEvent.enabled()) { Drop the space in "! SocketReadEvent" as it is inconsistent with the existing code. src/java.base/share/classes/jdk/internal/event/SocketReadEvent.java line 119: > 117: public static void checkForCommit(long start, long nbytes, SocketAddress remote, long timeout) { > 118: long duration = timestamp() - start; > 119: if (shouldCommit(duration)) { I think you know this, but this will need to be re-examined for SocketChannel configured non-blocking. src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java line 408: > 406: @Override > 407: public int read(ByteBuffer buf) throws IOException { > 408: if (!SocketReadEvent.enabled()) { The read/write with sun.nio.ch.SocketInputStream and SocketOutputStream does not go through SC.read/write so I think SocketAdaptor read/write will need attention, maybe a future PR as there are other code paths that aren't covered in this PR. src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java line 416: > 414: nbytes = implRead(buf); > 415: } finally { > 416: SocketReadEvent.checkForCommit(start, nbytes, getRemoteAddress(), 0); This will need to be changed to use remoteAddress(), can't use getRemoteAddress() as it might throw. src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java line 466: > 464: throws IOException > 465: { > 466: if (! SocketReadEvent.enabled()) { Spurious space here too, several other places. src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java line 474: > 472: nbytes = implRead(dsts, offset, length); > 473: } finally { > 474: SocketReadEvent.checkForCommit(start, nbytes, getRemoteAddress(), 0); This has to be remoteAddress() too. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14342#discussion_r1238312001 PR Review Comment: https://git.openjdk.org/jdk/pull/14342#discussion_r1238317470 PR Review Comment: https://git.openjdk.org/jdk/pull/14342#discussion_r1238323035 PR Review Comment: https://git.openjdk.org/jdk/pull/14342#discussion_r1238318572 PR Review Comment: https://git.openjdk.org/jdk/pull/14342#discussion_r1238318875 PR Review Comment: https://git.openjdk.org/jdk/pull/14342#discussion_r1238319120 From alanb at openjdk.org Thu Jun 22 10:25:11 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 22 Jun 2023 10:25:11 GMT Subject: RFR: 8308995: Update Network IO JFR events to be static mirror events In-Reply-To: References: Message-ID: <-CBspYQOiQx_e5vmZhTtyJkmVQAyr129m3xJIlVJy3k=.f4b5bc13-35bf-4bfe-85df-a84fa8362186@github.com> On Wed, 21 Jun 2023 15:48:30 GMT, Alan Bateman wrote: >> The socket read/write JFR events currently use instrumentation of java.base code using templates in the jdk.jfr modules. This results in some java.base code residing in the jdk.jfr module which is undesirable. >> >> JDK19 added static support for event classes. The old instrumentor classes should be replaced with mirror events using the static support. >> >> In the java.base module: >> Added two new events, jdk.internal.event.SocketReadEvent and jdk.internal.event.SocketWriteEvent. >> java.net.Socket and sun.nio.ch.SocketChannelImpl were changed to make use of the new events. >> >> In the jdk.jfr module: >> jdk.jfr.events.SocketReadEvent and jdk.jfr.events.SocketWriteEvent were changed to be mirror events. >> In the package jdk.jfr.internal.instrument, the classes SocketChannelImplInstrumentor, SocketInputStreamInstrumentor, and SocketOutputStreamInstrumentor were removed. The JDKEvents class was updated to reflect all of those changes. >> >> The existing tests in test/jdk/jdk/jfr/event/io continue to pass with the new implementation: >> Passed: jdk/jfr/event/io/TestSocketChannelEvents.java >> Passed: jdk/jfr/event/io/TestSocketEvents.java >> >> I added a micro benchmark which measures the overhead of handling the jfr socket events. >> test/micro/org/openjdk/bench/java/net/SocketEventOverhead.java. >> It needs access the jdk.internal.event package, which is done at runtime with annotations that add the extra arguments. >> At compile time the build arguments had to be augmented in make/test/BuildMicrobenchmark.gmk > > src/java.base/share/classes/java/net/Socket.java line 1109: > >> 1107: nbytes = read0(b, off, len); >> 1108: } finally { >> 1109: SocketReadEvent.checkForCommit(start, nbytes, parent.getRemoteSocketAddress(), parent.getSoTimeout()); > > So if read throws, this will commit a jdk.SocketReadEvent with size 0, maybe this will change later to include the exception? The other issue to think about here is where the Socket is asynchronously closed. In t hat case, implRead will throw but we'll end up with a confusing suppressed exception due to the call to getSoTimeout. I think this will have to be replaced with a call to a helper method that returns the timeout or 0. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14342#discussion_r1238315000 From dfuchs at openjdk.org Thu Jun 22 11:57:04 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Thu, 22 Jun 2023 11:57:04 GMT Subject: RFR: 8308995: Update Network IO JFR events to be static mirror events In-Reply-To: References: Message-ID: On Tue, 6 Jun 2023 19:39:31 GMT, Tim Prinzing wrote: > The socket read/write JFR events currently use instrumentation of java.base code using templates in the jdk.jfr modules. This results in some java.base code residing in the jdk.jfr module which is undesirable. > > JDK19 added static support for event classes. The old instrumentor classes should be replaced with mirror events using the static support. > > In the java.base module: > Added two new events, jdk.internal.event.SocketReadEvent and jdk.internal.event.SocketWriteEvent. > java.net.Socket and sun.nio.ch.SocketChannelImpl were changed to make use of the new events. > > In the jdk.jfr module: > jdk.jfr.events.SocketReadEvent and jdk.jfr.events.SocketWriteEvent were changed to be mirror events. > In the package jdk.jfr.internal.instrument, the classes SocketChannelImplInstrumentor, SocketInputStreamInstrumentor, and SocketOutputStreamInstrumentor were removed. The JDKEvents class was updated to reflect all of those changes. > > The existing tests in test/jdk/jdk/jfr/event/io continue to pass with the new implementation: > Passed: jdk/jfr/event/io/TestSocketChannelEvents.java > Passed: jdk/jfr/event/io/TestSocketEvents.java > > I added a micro benchmark which measures the overhead of handling the jfr socket events. > test/micro/org/openjdk/bench/java/net/SocketEventOverhead.java. > It needs access the jdk.internal.event package, which is done at runtime with annotations that add the extra arguments. > At compile time the build arguments had to be augmented in make/test/BuildMicrobenchmark.gmk The new code seems to accurately correspond to what the various `*Instrumentor` classes were doing, so that is good. I agree with Alan that potential exception that may arise when generating the event are an issue (e.g. call to getRemoteAddress() or other getter that may make a check on the socket state) - though that was already present in the original code. Maybe that could be fixed here though. In cases where the implRead/implWrite call throws an exception, shouldn't the event contain that exception, or at least exception message? If it doesn't should it be emitted at all, or should another event be emitted instead? ------------- PR Comment: https://git.openjdk.org/jdk/pull/14342#issuecomment-1602505386 From egahlin at openjdk.org Thu Jun 22 13:43:04 2023 From: egahlin at openjdk.org (Erik Gahlin) Date: Thu, 22 Jun 2023 13:43:04 GMT Subject: RFR: 8308995: Update Network IO JFR events to be static mirror events In-Reply-To: References: Message-ID: On Thu, 22 Jun 2023 11:53:59 GMT, Daniel Fuchs wrote: > The new code seems to accurately correspond to what the various `*Instrumentor` classes were doing, so that is good. I agree with Alan that potential exception that may arise when generating the event are an issue (e.g. call to getRemoteAddress() or other getter that may make a check on the socket state) - though that was already present in the original code. Maybe that could be fixed here though. > In cases where the implRead/implWrite call throws an exception, shouldn't the event contain that exception, or at least exception message? If it doesn't should it be emitted at all, or should another event be emitted instead? An exception event will be emitted. The event is disabled by default, but there is ongoing work on a throttling mechanism, so it can be always-on. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14342#issuecomment-1602659051 From djelinski at openjdk.org Thu Jun 22 14:43:05 2023 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Thu, 22 Jun 2023 14:43:05 GMT Subject: [jdk21] RFR: 8304885: Reuse stale data to improve DNS resolver resiliency In-Reply-To: References: Message-ID: On Wed, 21 Jun 2023 14:50:21 GMT, Sergey Bylokhov wrote: > Hi all, > > This pull request contains a backport of commit [bdd81b31](https://github.com/openjdk/jdk/commit/bdd81b31825a9eb6a0f0883fca56a011ac2aebf8) from the [openjdk/jdk](https://git.openjdk.org/jdk) repository. > > The commit being backported was authored by Sergey Bylokhov on 9 Jun 2023 and was reviewed by Michael McMahon and Daniel Fuchs. > > CSR is approved for JDK 21: https://bugs.openjdk.org/browse/JDK-8306653 > "jdk21-enhancement-yes" label is added to the JBS. > > Thanks! Marked as reviewed by djelinski (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk21/pull/53#pullrequestreview-1493363727 From michaelm at openjdk.org Fri Jun 23 09:47:07 2023 From: michaelm at openjdk.org (Michael McMahon) Date: Fri, 23 Jun 2023 09:47:07 GMT Subject: [jdk21] RFR: 8304885: Reuse stale data to improve DNS resolver resiliency In-Reply-To: References: Message-ID: On Wed, 21 Jun 2023 14:50:21 GMT, Sergey Bylokhov wrote: > Hi all, > > This pull request contains a backport of commit [bdd81b31](https://github.com/openjdk/jdk/commit/bdd81b31825a9eb6a0f0883fca56a011ac2aebf8) from the [openjdk/jdk](https://git.openjdk.org/jdk) repository. > > The commit being backported was authored by Sergey Bylokhov on 9 Jun 2023 and was reviewed by Michael McMahon and Daniel Fuchs. > > CSR is approved for JDK 21: https://bugs.openjdk.org/browse/JDK-8306653 > "jdk21-enhancement-yes" label is added to the JBS. > > Thanks! Marked as reviewed by michaelm (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk21/pull/53#pullrequestreview-1494823853 From serb at openjdk.org Fri Jun 23 11:40:16 2023 From: serb at openjdk.org (Sergey Bylokhov) Date: Fri, 23 Jun 2023 11:40:16 GMT Subject: [jdk21] Integrated: 8304885: Reuse stale data to improve DNS resolver resiliency In-Reply-To: References: Message-ID: On Wed, 21 Jun 2023 14:50:21 GMT, Sergey Bylokhov wrote: > Hi all, > > This pull request contains a backport of commit [bdd81b31](https://github.com/openjdk/jdk/commit/bdd81b31825a9eb6a0f0883fca56a011ac2aebf8) from the [openjdk/jdk](https://git.openjdk.org/jdk) repository. > > The commit being backported was authored by Sergey Bylokhov on 9 Jun 2023 and was reviewed by Michael McMahon and Daniel Fuchs. > > CSR is approved for JDK 21: https://bugs.openjdk.org/browse/JDK-8306653 > "jdk21-enhancement-yes" label is added to the JBS. > > Thanks! This pull request has now been integrated. Changeset: 8b127262 Author: Sergey Bylokhov URL: https://git.openjdk.org/jdk21/commit/8b127262a3dff9c4420945e902f6a688f8d05e2e Stats: 516 lines in 16 files changed: 429 ins; 55 del; 32 mod 8304885: Reuse stale data to improve DNS resolver resiliency Reviewed-by: djelinski, michaelm Backport-of: bdd81b31825a9eb6a0f0883fca56a011ac2aebf8 ------------- PR: https://git.openjdk.org/jdk21/pull/53 From jpai at openjdk.org Fri Jun 23 12:43:17 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Fri, 23 Jun 2023 12:43:17 GMT Subject: RFR: 8310731: Configure a javax.net.ssl.SNIMatcher for the HTTP/1.1 test servers in java/net/httpclient tests Message-ID: <2B8UrxutyWOwawM4nzgg5BMthJSUWlhZBhbfujiAU8Y=.c4b5e50f-7a03-4872-908e-c98846aec538@github.com> Can I please get a review of this test-only change which addresses https://bugs.openjdk.org/browse/JDK-8310731? As noted in that issue, before the changes in this PR, the test servers that we created for HTTP/1.1 testing in `java/net/httpclient` tests weren't configured to use a `javax.net.ssl.SNIMatcher` which resulted in the SNI name extension from the client being ignored. The commit in this PR addresses that by configuring such instances with a relevant `SNIMatcher`. No new tests have been added given the nature of this change, but existing tests in `java/net/httpclient` continue to pass with this change. ------------- Commit messages: - 8310731: Configure a javax.net.ssl.SNIMatcher for the HTTP/1.1 test servers in java/net/httpclient tests Changes: https://git.openjdk.org/jdk/pull/14626/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14626&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8310731 Stats: 317 lines in 19 files changed: 264 ins; 24 del; 29 mod Patch: https://git.openjdk.org/jdk/pull/14626.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14626/head:pull/14626 PR: https://git.openjdk.org/jdk/pull/14626 From aturbanov at openjdk.org Mon Jun 26 12:13:17 2023 From: aturbanov at openjdk.org (Andrey Turbanov) Date: Mon, 26 Jun 2023 12:13:17 GMT Subject: RFR: 8277969: HttpClient SelectorManager shuts down when custom Executor rejects a task [v9] In-Reply-To: <7L4_MwD6_bF9fQTTRIKUDO2C-yU7b-wzpP4cC53h9Ew=.51758f01-82f1-4249-a70d-78038f6f0c6f@github.com> References: <7L4_MwD6_bF9fQTTRIKUDO2C-yU7b-wzpP4cC53h9Ew=.51758f01-82f1-4249-a70d-78038f6f0c6f@github.com> Message-ID: On Sat, 16 Apr 2022 11:06:21 GMT, Daniel Fuchs wrote: >> These changes make sure that pending requests are terminated if the selector manager thread exits due to exceptions. >> This includes: >> 1. completing CompletableFutures that were returned to the caller code >> 2. cancelling requests that are in flight >> 3. calling onError on BodySubscribers that may not have been completed >> Note that step 3 is necessary as certain CompletableFutures, such as those returned by `BodySubscribers.ofInputStream`, complete immediately, the operation being eventually completed when the last bite of the response is read. Completing a completable future that is already completed has no effect, this case is handled by completing the BodySubscriber too. > > Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: > > Fixed accepted exception logging in tests src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java line 1056: > 1054: abortPendingRequests(owner, t); > 1055: } > 1056: Set keys = new HashSet<>(); I'm not quite understand, what for is this `keys` are here? Nothing happens with this collection after `addAll` call ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/7196#discussion_r1242094737 From dfuchs at openjdk.org Mon Jun 26 13:06:23 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Mon, 26 Jun 2023 13:06:23 GMT Subject: RFR: 8277969: HttpClient SelectorManager shuts down when custom Executor rejects a task [v9] In-Reply-To: References: <7L4_MwD6_bF9fQTTRIKUDO2C-yU7b-wzpP4cC53h9Ew=.51758f01-82f1-4249-a70d-78038f6f0c6f@github.com> Message-ID: On Mon, 26 Jun 2023 12:10:33 GMT, Andrey Turbanov wrote: >> Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: >> >> Fixed accepted exception logging in tests > > src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java line 1056: > >> 1054: abortPendingRequests(owner, t); >> 1055: } >> 1056: Set keys = new HashSet<>(); > > I'm not quite understand, what for is this `keys` are here? > Nothing happens with this collection after `addAll` call Good observation. Probably meant to cancel the keys, but that will happen anyway when connections are closed (or the selector is closed). Maybe we should get rid of that collection. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/7196#discussion_r1242159809 From vtewari at openjdk.org Tue Jun 27 09:46:04 2023 From: vtewari at openjdk.org (Vyom Tewari) Date: Tue, 27 Jun 2023 09:46:04 GMT Subject: RFR: JDK-8309591: Socket.setOption(TCP_QUICKACK) uses wrong level Message-ID: Please review the simple fix for the issue [JDK-8309591](https://bugs.openjdk.org/browse/JDK-8309591). In this issue sys call is incorrectly setting the socket option(TCP_QUICKACK) at wrong level(SOL_TCP). After fix all the existing tests are passing. Note: I did the similar changes for AIX port as well but I don?t have AIX to test it locally. ------------- Commit messages: - JDK-8309591: Socket.setOption(TCP_QUICKACK) uses wrong level Changes: https://git.openjdk.org/jdk/pull/14671/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14671&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8309591 Stats: 7 lines in 2 files changed: 0 ins; 0 del; 7 mod Patch: https://git.openjdk.org/jdk/pull/14671.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14671/head:pull/14671 PR: https://git.openjdk.org/jdk/pull/14671 From ccleary at openjdk.org Tue Jun 27 09:55:59 2023 From: ccleary at openjdk.org (Conor Cleary) Date: Tue, 27 Jun 2023 09:55:59 GMT Subject: RFR: 8310645: CancelledResponse.java does not use HTTP/2 when testing the HttpClient Message-ID: **Issue** In CancelledResponse.java the test only checks the HttpClient against HTTP/1.1 when cancelling a BodySubscriber while receiving data. **Solution** In the interest of more coverage, a new test has been created which performs the same checks against HTTP/2 to cover the client in the case of a HTTP/2 connection. A new test was created as it makes use of HttpTestServerAdapters to create the test servers. This is different to how this is performed in the original "CancelledResponse" test. There are some minor changes to how the testing is conducted with an element of randomness added to the new test. As an open question to reviewers, the old test "CancelledResponse" and the new test "CancelledResponse2" could be merged into a single file and the HTTP/1.1 case could be updated to use more canonical testing methods as with "CancelledResponse2". Though there isn't a very pressing need for this and so it has not been included in this PR as of now. ------------- Commit messages: - 8310645: CancelledResponse.java does not use HTTP/2 when testting the HttpClient Changes: https://git.openjdk.org/jdk/pull/14625/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14625&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8310645 Stats: 258 lines in 1 file changed: 258 ins; 0 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/14625.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14625/head:pull/14625 PR: https://git.openjdk.org/jdk/pull/14625 From djelinski at openjdk.org Tue Jun 27 10:13:03 2023 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Tue, 27 Jun 2023 10:13:03 GMT Subject: RFR: JDK-8309591: Socket.setOption(TCP_QUICKACK) uses wrong level In-Reply-To: References: Message-ID: On Tue, 27 Jun 2023 09:23:49 GMT, Vyom Tewari wrote: > Please review the simple fix for the issue [JDK-8309591](https://bugs.openjdk.org/browse/JDK-8309591). In this issue sys call is incorrectly setting the socket option(TCP_QUICKACK) at wrong level(SOL_TCP). After fix all the existing tests are passing. > > Note: I did the similar changes for AIX port as well but I don?t have AIX to test it locally. LGTM ------------- Marked as reviewed by djelinski (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14671#pullrequestreview-1500471463 From dfuchs at openjdk.org Tue Jun 27 10:48:03 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Tue, 27 Jun 2023 10:48:03 GMT Subject: RFR: 8310731: Configure a javax.net.ssl.SNIMatcher for the HTTP/1.1 test servers in java/net/httpclient tests In-Reply-To: <2B8UrxutyWOwawM4nzgg5BMthJSUWlhZBhbfujiAU8Y=.c4b5e50f-7a03-4872-908e-c98846aec538@github.com> References: <2B8UrxutyWOwawM4nzgg5BMthJSUWlhZBhbfujiAU8Y=.c4b5e50f-7a03-4872-908e-c98846aec538@github.com> Message-ID: <7QEmdRJyRyAu0YUci5azYylcSan9PH-DkEp-ARt13yc=.860ca471-e2f6-4706-b94c-7d9784a57555@github.com> On Fri, 23 Jun 2023 12:36:47 GMT, Jaikiran Pai wrote: > Can I please get a review of this test-only change which addresses https://bugs.openjdk.org/browse/JDK-8310731? > > As noted in that issue, before the changes in this PR, the test servers that we created for HTTP/1.1 testing in `java/net/httpclient` tests weren't configured to use a `javax.net.ssl.SNIMatcher` which resulted in the SNI name extension from the client being ignored. The commit in this PR addresses that by configuring such instances with a relevant `SNIMatcher`. > > No new tests have been added given the nature of this change, but existing tests in `java/net/httpclient` continue to pass with this change. LGTM. Thanks for this change Jaikiran! ------------- Marked as reviewed by dfuchs (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14626#pullrequestreview-1500537954 From michaelm at openjdk.org Tue Jun 27 10:52:04 2023 From: michaelm at openjdk.org (Michael McMahon) Date: Tue, 27 Jun 2023 10:52:04 GMT Subject: RFR: JDK-8309591: Socket.setOption(TCP_QUICKACK) uses wrong level In-Reply-To: References: Message-ID: On Tue, 27 Jun 2023 09:23:49 GMT, Vyom Tewari wrote: > Please review the simple fix for the issue [JDK-8309591](https://bugs.openjdk.org/browse/JDK-8309591). In this issue sys call is incorrectly setting the socket option(TCP_QUICKACK) at wrong level(SOL_TCP). After fix all the existing tests are passing. > > Note: I did the similar changes for AIX port as well but I don?t have AIX to test it locally. Unfortunate that the original mistake was a valid option itself and we were previously setting SO_PRIORITY to a value of 1. Change looks fine anyway. ------------- Marked as reviewed by michaelm (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14671#pullrequestreview-1500546836 From jpai at openjdk.org Tue Jun 27 11:04:12 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Tue, 27 Jun 2023 11:04:12 GMT Subject: RFR: 8310731: Configure a javax.net.ssl.SNIMatcher for the HTTP/1.1 test servers in java/net/httpclient tests In-Reply-To: <2B8UrxutyWOwawM4nzgg5BMthJSUWlhZBhbfujiAU8Y=.c4b5e50f-7a03-4872-908e-c98846aec538@github.com> References: <2B8UrxutyWOwawM4nzgg5BMthJSUWlhZBhbfujiAU8Y=.c4b5e50f-7a03-4872-908e-c98846aec538@github.com> Message-ID: <1Vtn4R4FI34OT6--KzVZW1IwTgAJDk7TfPvCPEdCQzw=.ced084da-1901-4032-8d04-25374b924c20@github.com> On Fri, 23 Jun 2023 12:36:47 GMT, Jaikiran Pai wrote: > Can I please get a review of this test-only change which addresses https://bugs.openjdk.org/browse/JDK-8310731? > > As noted in that issue, before the changes in this PR, the test servers that we created for HTTP/1.1 testing in `java/net/httpclient` tests weren't configured to use a `javax.net.ssl.SNIMatcher` which resulted in the SNI name extension from the client being ignored. The commit in this PR addresses that by configuring such instances with a relevant `SNIMatcher`. > > No new tests have been added given the nature of this change, but existing tests in `java/net/httpclient` continue to pass with this change. Thank you Daniel for the review. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14626#issuecomment-1609274929 From jpai at openjdk.org Tue Jun 27 11:04:14 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Tue, 27 Jun 2023 11:04:14 GMT Subject: Integrated: 8310731: Configure a javax.net.ssl.SNIMatcher for the HTTP/1.1 test servers in java/net/httpclient tests In-Reply-To: <2B8UrxutyWOwawM4nzgg5BMthJSUWlhZBhbfujiAU8Y=.c4b5e50f-7a03-4872-908e-c98846aec538@github.com> References: <2B8UrxutyWOwawM4nzgg5BMthJSUWlhZBhbfujiAU8Y=.c4b5e50f-7a03-4872-908e-c98846aec538@github.com> Message-ID: On Fri, 23 Jun 2023 12:36:47 GMT, Jaikiran Pai wrote: > Can I please get a review of this test-only change which addresses https://bugs.openjdk.org/browse/JDK-8310731? > > As noted in that issue, before the changes in this PR, the test servers that we created for HTTP/1.1 testing in `java/net/httpclient` tests weren't configured to use a `javax.net.ssl.SNIMatcher` which resulted in the SNI name extension from the client being ignored. The commit in this PR addresses that by configuring such instances with a relevant `SNIMatcher`. > > No new tests have been added given the nature of this change, but existing tests in `java/net/httpclient` continue to pass with this change. This pull request has now been integrated. Changeset: 05e9c41e Author: Jaikiran Pai URL: https://git.openjdk.org/jdk/commit/05e9c41eddf8961d1384c88ccedf993d86822a6b Stats: 317 lines in 19 files changed: 264 ins; 24 del; 29 mod 8310731: Configure a javax.net.ssl.SNIMatcher for the HTTP/1.1 test servers in java/net/httpclient tests Reviewed-by: dfuchs ------------- PR: https://git.openjdk.org/jdk/pull/14626 From dfuchs at openjdk.org Tue Jun 27 11:06:17 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Tue, 27 Jun 2023 11:06:17 GMT Subject: RFR: 8310645: CancelledResponse.java does not use HTTP/2 when testing the HttpClient In-Reply-To: References: Message-ID: On Fri, 23 Jun 2023 12:13:47 GMT, Conor Cleary wrote: > **Issue** > In CancelledResponse.java the test only checks the HttpClient against HTTP/1.1 when cancelling a BodySubscriber while receiving data. > > **Solution** > In the interest of more coverage, a new test has been created which performs the same checks against HTTP/2 to cover the client in the case of a HTTP/2 connection. A new test was created as it makes use of HttpTestServerAdapters to create the test servers. This is different to how this is performed in the original "CancelledResponse" test. There are some minor changes to how the testing is conducted with an element of randomness added to the new test. > > As an open question to reviewers, the old test "CancelledResponse" and the new test "CancelledResponse2" could be merged into a single file and the HTTP/1.1 case could be updated to use more canonical testing methods as with "CancelledResponse2". Though there isn't a very pressing need for this and so it has not been included in this PR as of now. test/jdk/java/net/httpclient/CancelledResponse2.java line 107: > 105: } catch (Exception e) { > 106: e.printStackTrace(); > 107: assertTrue(e.getCause() instanceof IOException, "HTTP/2 should cancel with an IOException when the Subscription is cancelled."); I believe we want to check that the exception we get as the cause is the expected CancelException, or at least that it can be found somewhere while following the cause chain. Otherwise looks good! ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14625#discussion_r1243554849 From michaelm at openjdk.org Tue Jun 27 13:50:14 2023 From: michaelm at openjdk.org (Michael McMahon) Date: Tue, 27 Jun 2023 13:50:14 GMT Subject: RFR: JDK-6956385: URLConnection.getLastModified() leaks file handles for jar:file and file: URLs [v4] In-Reply-To: References: <-EBiBT8IMzEF1Of8fZwlNIx68VHqJn0qdJFmoZbNN5w=.8009a74a-455d-40cf-88a1-7c52e8eab81e@github.com> Message-ID: On Mon, 22 May 2023 16:19:40 GMT, Jesse Glick wrote: >> [JDK-6956385](https://bugs.openjdk.org/browse/JDK-6956385): `JarURLConnection` properly tracks any `InputStream` it itself opened, and correspondingly closes the `JarFile` if necessary (when caches are disabled). However if its underlying `FileURLConnection` was used to retrieve a header field, that would have caused a `FileInputStream` to be opened which never gets closed until it is garbage collected. This means that an application which calls certain methods on `jar:file:/?something.jar!/?` URLs will leak file handles, even if `URLConnection` caches are supposed to be turned off. This can delay release of system resources, and on Windows can prevent the JAR file from being deleted even after it is no longer in use (for example after `URLClassLoader.close`). >> >> [JDK-8224095](https://bugs.openjdk.org/browse/JDK-8224095) was marked as a duplicate, but I think incorrectly. It refers to `FileURLConnection`, and seems to be complaining about the confusing API design of `URLConnection` generally: that it is an object which you might expect to be `Closeable` but in fact it is its `inputStream` which must be `close`d. In JDK-6956385, even when the caller _does_ specifically call `InputStream.close`, a file handle may be leaked. >> >> I managed to build the JDK on both Linux and (Cygwin) Windows to confirm the fix via >> >> >> ./build/?-x86_64-server-release/jdk/bin/java test/jdk/sun/net/www/protocol/jar/FileURLConnectionLeak.java >> >> >> I also ran jtreg on Linux (this test and various others in nearby packages); on Windows the `make test` target just hung for some reason. >> >> I marked the test `othervm` out of caution, since it is mutating global state, and if it fails will leak a handle and prevent scratch dir cleanup on Windows. >> >> (This is my first contribution, at least after the move to GitHub, so let me know if something is missing here technically or stylistically. None of the contribution guides appear to be up to date.) > > Jesse Glick has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision: > > - Merge branch 'master' of https://github.com/openjdk/jdk into FileURLConnectionLeak-JDK-6956385 > - `URLConnection.getLastModified` reproduces the bug the same as `getContentEncoding` but better matches the bug title (suggested by @ecki https://github.com/openjdk/jdk/pull/12871#discussion_r1200716271) > - Leaving `FileURLConnection.is` non-null, and claiming `connected`, even after `closeInputStream` https://github.com/openjdk/jdk/pull/12871#discussion_r1199085883 > - Encapsulate logic as `FileURLConnection.closeInputStream` as suggested by @dfuch https://github.com/openjdk/jdk/pull/12871#discussion_r1198859517 > - Merge branch 'master' of https://github.com/openjdk/jdk into FileURLConnectionLeak-JDK-6956385 > - Simplified `instanceof` form > > Co-authored-by: ExE Boss <3889017+ExE-Boss at users.noreply.github.com> > - 6956385: `JarURLConnection` may fail to close its underlying `FileURLConnection` The change looks fine to me. I had a slight concern about closing the underlying stream and then maybe trying to obtain header information from the JAR url connection itself. But, it looks like FileURLConnection captures whatever information is available at connect() time. ------------- Marked as reviewed by michaelm (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/12871#pullrequestreview-1500924759 From alanb at openjdk.org Tue Jun 27 15:54:04 2023 From: alanb at openjdk.org (Alan Bateman) Date: Tue, 27 Jun 2023 15:54:04 GMT Subject: RFR: JDK-8309591: Socket.setOption(TCP_QUICKACK) uses wrong level In-Reply-To: References: Message-ID: On Tue, 27 Jun 2023 09:23:49 GMT, Vyom Tewari wrote: > Please review the simple fix for the issue [JDK-8309591](https://bugs.openjdk.org/browse/JDK-8309591). In this issue sys call is incorrectly setting the socket option(TCP_QUICKACK) at wrong level(SOL_TCP). After fix all the existing tests are passing. > > Note: I did the similar changes for AIX port as well but I don?t have AIX to test it locally. Marked as reviewed by alanb (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14671#pullrequestreview-1501310249 From tprinzing at openjdk.org Tue Jun 27 18:32:05 2023 From: tprinzing at openjdk.org (Tim Prinzing) Date: Tue, 27 Jun 2023 18:32:05 GMT Subject: RFR: 8308995: Update Network IO JFR events to be static mirror events In-Reply-To: <-joCOXm52wMG9vCbBdDUHnZCqNCYoUj-ruNjZgv4mwY=.70571acf-a859-4c88-972f-49af60bfed64@github.com> References: <-joCOXm52wMG9vCbBdDUHnZCqNCYoUj-ruNjZgv4mwY=.70571acf-a859-4c88-972f-49af60bfed64@github.com> Message-ID: On Thu, 22 Jun 2023 10:21:46 GMT, Alan Bateman wrote: >> The socket read/write JFR events currently use instrumentation of java.base code using templates in the jdk.jfr modules. This results in some java.base code residing in the jdk.jfr module which is undesirable. >> >> JDK19 added static support for event classes. The old instrumentor classes should be replaced with mirror events using the static support. >> >> In the java.base module: >> Added two new events, jdk.internal.event.SocketReadEvent and jdk.internal.event.SocketWriteEvent. >> java.net.Socket and sun.nio.ch.SocketChannelImpl were changed to make use of the new events. >> >> In the jdk.jfr module: >> jdk.jfr.events.SocketReadEvent and jdk.jfr.events.SocketWriteEvent were changed to be mirror events. >> In the package jdk.jfr.internal.instrument, the classes SocketChannelImplInstrumentor, SocketInputStreamInstrumentor, and SocketOutputStreamInstrumentor were removed. The JDKEvents class was updated to reflect all of those changes. >> >> The existing tests in test/jdk/jdk/jfr/event/io continue to pass with the new implementation: >> Passed: jdk/jfr/event/io/TestSocketChannelEvents.java >> Passed: jdk/jfr/event/io/TestSocketEvents.java >> >> I added a micro benchmark which measures the overhead of handling the jfr socket events. >> test/micro/org/openjdk/bench/java/net/SocketEventOverhead.java. >> It needs access the jdk.internal.event package, which is done at runtime with annotations that add the extra arguments. >> At compile time the build arguments had to be augmented in make/test/BuildMicrobenchmark.gmk > > src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java line 408: > >> 406: @Override >> 407: public int read(ByteBuffer buf) throws IOException { >> 408: if (!SocketReadEvent.enabled()) { > > The read/write with sun.nio.ch.SocketInputStream and SocketOutputStream does not go through SC.read/write so I think SocketAdaptor read/write will need attention, maybe a future PR as there are other code paths that aren't covered in this PR. I've created https://bugs.openjdk.org/browse/JDK-8310978 to drive the future PR to support the missing code paths ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14342#discussion_r1244182424 From tprinzing at openjdk.org Tue Jun 27 18:45:04 2023 From: tprinzing at openjdk.org (Tim Prinzing) Date: Tue, 27 Jun 2023 18:45:04 GMT Subject: RFR: 8308995: Update Network IO JFR events to be static mirror events In-Reply-To: References: Message-ID: On Thu, 22 Jun 2023 13:39:51 GMT, Erik Gahlin wrote: > In cases where the implRead/implWrite call throws an exception, shouldn't the event contain that exception, or at least exception message? If it doesn't should it be emitted at all, or should another event be emitted instead? Added issue https://bugs.openjdk.org/browse/JDK-8310979 to add a field to SocketReadEvent and SocketWriteEvent in a separate PR ------------- PR Comment: https://git.openjdk.org/jdk/pull/14342#issuecomment-1610037645 From tprinzing at openjdk.org Tue Jun 27 21:06:54 2023 From: tprinzing at openjdk.org (Tim Prinzing) Date: Tue, 27 Jun 2023 21:06:54 GMT Subject: RFR: 8308995: Update Network IO JFR events to be static mirror events [v2] In-Reply-To: References: Message-ID: > The socket read/write JFR events currently use instrumentation of java.base code using templates in the jdk.jfr modules. This results in some java.base code residing in the jdk.jfr module which is undesirable. > > JDK19 added static support for event classes. The old instrumentor classes should be replaced with mirror events using the static support. > > In the java.base module: > Added two new events, jdk.internal.event.SocketReadEvent and jdk.internal.event.SocketWriteEvent. > java.net.Socket and sun.nio.ch.SocketChannelImpl were changed to make use of the new events. > > In the jdk.jfr module: > jdk.jfr.events.SocketReadEvent and jdk.jfr.events.SocketWriteEvent were changed to be mirror events. > In the package jdk.jfr.internal.instrument, the classes SocketChannelImplInstrumentor, SocketInputStreamInstrumentor, and SocketOutputStreamInstrumentor were removed. The JDKEvents class was updated to reflect all of those changes. > > The existing tests in test/jdk/jdk/jfr/event/io continue to pass with the new implementation: > Passed: jdk/jfr/event/io/TestSocketChannelEvents.java > Passed: jdk/jfr/event/io/TestSocketEvents.java > > I added a micro benchmark which measures the overhead of handling the jfr socket events. > test/micro/org/openjdk/bench/java/net/SocketEventOverhead.java. > It needs access the jdk.internal.event package, which is done at runtime with annotations that add the extra arguments. > At compile time the build arguments had to be augmented in make/test/BuildMicrobenchmark.gmk Tim Prinzing has updated the pull request incrementally with one additional commit since the last revision: Avoid exceptions getting address/timeout for jfr event. Remove unused EventConiguration fields SOCKET_READ and SOCKET_WRITE. Remove spurious whitespace. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14342/files - new: https://git.openjdk.org/jdk/pull/14342/files/5faeb300..518adf8e Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14342&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14342&range=00-01 Stats: 21 lines in 3 files changed: 10 ins; 2 del; 9 mod Patch: https://git.openjdk.org/jdk/pull/14342.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14342/head:pull/14342 PR: https://git.openjdk.org/jdk/pull/14342 From tprinzing at openjdk.org Tue Jun 27 21:52:08 2023 From: tprinzing at openjdk.org (Tim Prinzing) Date: Tue, 27 Jun 2023 21:52:08 GMT Subject: RFR: 8308995: Update Network IO JFR events to be static mirror events [v3] In-Reply-To: References: Message-ID: > The socket read/write JFR events currently use instrumentation of java.base code using templates in the jdk.jfr modules. This results in some java.base code residing in the jdk.jfr module which is undesirable. > > JDK19 added static support for event classes. The old instrumentor classes should be replaced with mirror events using the static support. > > In the java.base module: > Added two new events, jdk.internal.event.SocketReadEvent and jdk.internal.event.SocketWriteEvent. > java.net.Socket and sun.nio.ch.SocketChannelImpl were changed to make use of the new events. > > In the jdk.jfr module: > jdk.jfr.events.SocketReadEvent and jdk.jfr.events.SocketWriteEvent were changed to be mirror events. > In the package jdk.jfr.internal.instrument, the classes SocketChannelImplInstrumentor, SocketInputStreamInstrumentor, and SocketOutputStreamInstrumentor were removed. The JDKEvents class was updated to reflect all of those changes. > > The existing tests in test/jdk/jdk/jfr/event/io continue to pass with the new implementation: > Passed: jdk/jfr/event/io/TestSocketChannelEvents.java > Passed: jdk/jfr/event/io/TestSocketEvents.java > > I added a micro benchmark which measures the overhead of handling the jfr socket events. > test/micro/org/openjdk/bench/java/net/SocketEventOverhead.java. > It needs access the jdk.internal.event package, which is done at runtime with annotations that add the extra arguments. > At compile time the build arguments had to be augmented in make/test/BuildMicrobenchmark.gmk Tim Prinzing has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains ten commits: - remove unused SOCKET_READ and SOCKET_WRITE configurations. - Merge branch 'master' into JDK-8308995 # Conflicts: # src/jdk.jfr/share/classes/jdk/jfr/events/EventConfigurations.java - Avoid exceptions getting address/timeout for jfr event. Remove unused EventConiguration fields SOCKET_READ and SOCKET_WRITE. Remove spurious whitespace. - some changes from review. read0() to implRead() write0() to implWrite() trailing whitespace - fix copyright date - Added micro benchmark to measure socket event overhead. - Some changes from review. Append a 0 to method names being wrapped. Use getHostString to avoid a reverse lookup when fetching the hostname of the remote address. - remove unnecessary cast - 8308995: Update Network IO JFR events to be static mirror events ------------- Changes: https://git.openjdk.org/jdk/pull/14342/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14342&range=02 Stats: 908 lines in 13 files changed: 533 ins; 369 del; 6 mod Patch: https://git.openjdk.org/jdk/pull/14342.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14342/head:pull/14342 PR: https://git.openjdk.org/jdk/pull/14342 From vtewari at openjdk.org Wed Jun 28 02:53:13 2023 From: vtewari at openjdk.org (Vyom Tewari) Date: Wed, 28 Jun 2023 02:53:13 GMT Subject: Integrated: JDK-8309591: Socket.setOption(TCP_QUICKACK) uses wrong level In-Reply-To: References: Message-ID: On Tue, 27 Jun 2023 09:23:49 GMT, Vyom Tewari wrote: > Please review the simple fix for the issue [JDK-8309591](https://bugs.openjdk.org/browse/JDK-8309591). In this issue sys call is incorrectly setting the socket option(TCP_QUICKACK) at wrong level(SOL_TCP). After fix all the existing tests are passing. > > Note: I did the similar changes for AIX port as well but I don?t have AIX to test it locally. This pull request has now been integrated. Changeset: 56a73a6f Author: Vyom Tewari URL: https://git.openjdk.org/jdk/commit/56a73a6f0f3d38379cecea1de5eacb751febca95 Stats: 7 lines in 2 files changed: 0 ins; 0 del; 7 mod 8309591: Socket.setOption(TCP_QUICKACK) uses wrong level Reviewed-by: djelinski, michaelm, alanb ------------- PR: https://git.openjdk.org/jdk/pull/14671 From alanb at openjdk.org Wed Jun 28 06:12:12 2023 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 28 Jun 2023 06:12:12 GMT Subject: RFR: 8308995: Update Network IO JFR events to be static mirror events [v3] In-Reply-To: References: Message-ID: On Tue, 27 Jun 2023 21:52:08 GMT, Tim Prinzing wrote: >> The socket read/write JFR events currently use instrumentation of java.base code using templates in the jdk.jfr modules. This results in some java.base code residing in the jdk.jfr module which is undesirable. >> >> JDK19 added static support for event classes. The old instrumentor classes should be replaced with mirror events using the static support. >> >> In the java.base module: >> Added two new events, jdk.internal.event.SocketReadEvent and jdk.internal.event.SocketWriteEvent. >> java.net.Socket and sun.nio.ch.SocketChannelImpl were changed to make use of the new events. >> >> In the jdk.jfr module: >> jdk.jfr.events.SocketReadEvent and jdk.jfr.events.SocketWriteEvent were changed to be mirror events. >> In the package jdk.jfr.internal.instrument, the classes SocketChannelImplInstrumentor, SocketInputStreamInstrumentor, and SocketOutputStreamInstrumentor were removed. The JDKEvents class was updated to reflect all of those changes. >> >> The existing tests in test/jdk/jdk/jfr/event/io continue to pass with the new implementation: >> Passed: jdk/jfr/event/io/TestSocketChannelEvents.java >> Passed: jdk/jfr/event/io/TestSocketEvents.java >> >> I added a micro benchmark which measures the overhead of handling the jfr socket events. >> test/micro/org/openjdk/bench/java/net/SocketEventOverhead.java. >> It needs access the jdk.internal.event package, which is done at runtime with annotations that add the extra arguments. >> At compile time the build arguments had to be augmented in make/test/BuildMicrobenchmark.gmk > > Tim Prinzing has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains ten commits: > > - remove unused SOCKET_READ and SOCKET_WRITE configurations. > - Merge branch 'master' into JDK-8308995 > > # Conflicts: > # src/jdk.jfr/share/classes/jdk/jfr/events/EventConfigurations.java > - Avoid exceptions getting address/timeout for jfr event. Remove unused > EventConiguration fields SOCKET_READ and SOCKET_WRITE. Remove spurious > whitespace. > - some changes from review. > > read0() to implRead() > write0() to implWrite() > trailing whitespace > - fix copyright date > - Added micro benchmark to measure socket event overhead. > - Some changes from review. > > Append a 0 to method names being wrapped. Use getHostString to avoid > a reverse lookup when fetching the hostname of the remote address. > - remove unnecessary cast > - 8308995: Update Network IO JFR events to be static mirror events src/java.base/share/classes/java/net/Socket.java line 1133: > 1131: return parent.getSoTimeout(); > 1132: } catch (Throwable t) { > 1133: // ignored - avoiding exceptions in jfr event data gathering This should be SocketException, not Throwable. That said, I think it would be useful to know why the SocketReadEvent includes the timeout. Is this used to see If read durations are close to the timeout? I assume once this code is fixed to deal with the exceptional case that the need to include the timeout for the success case will mostly go away. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14342#discussion_r1244728684 From dfuchs at openjdk.org Wed Jun 28 08:34:07 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Wed, 28 Jun 2023 08:34:07 GMT Subject: RFR: JDK-6956385: URLConnection.getLastModified() leaks file handles for jar:file and file: URLs [v3] In-Reply-To: <2s-hmbnCj5fZDhYNxA3vdDZG5KeqruwZoDukc44isN8=.0becbfa4-c362-4fe5-9f68-9d3bf4c88ee6@github.com> References: <-EBiBT8IMzEF1Of8fZwlNIx68VHqJn0qdJFmoZbNN5w=.8009a74a-455d-40cf-88a1-7c52e8eab81e@github.com> <7SozQmhzyt-jWfREPcumfc9sIy9QUG11Fpel56IV8-s=.4d0bf074-9e22-40b1-a148-e8471bd6cf41@github.com> <2s-hmbnCj5fZDhYNxA3vdDZG5KeqruwZoDukc44isN8=.0becbfa4-c362-4fe5-9f68-9d3bf4c88ee6@github.com> Message-ID: On Fri, 19 May 2023 16:14:19 GMT, Jesse Glick wrote: >> Jesse Glick has updated the pull request incrementally with one additional commit since the last revision: >> >> Leaving `FileURLConnection.is` non-null, and claiming `connected`, even after `closeInputStream` https://github.com/openjdk/jdk/pull/12871#discussion_r1199085883 > > Ran > > > make test TEST=:jdk_net > > > on Linux. Only failures are > > > java/net/DatagramSocket/DatagramSocketExample.java Error. Program `?/jdk/build/linux-x86_64-server-release/images/jdk/bin/java' timed out (timeout set to 480000ms, elapsed time including timeout handling was 480197ms). > java/net/DatagramSocket/DatagramSocketMulticasting.java Error. Program `?/jdk/build/linux-x86_64-server-release/images/jdk/bin/java' timed out (timeout set to 480000ms, elapsed time including timeout handling was 480221ms). > java/net/MulticastSocket/Promiscuous.java Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: /[0:0:0:0:0:0:0:0]:58774: Expected message not received, Receive timed out > java/net/MulticastSocket/PromiscuousIPv6.java Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: Expected message not received, Receive timed out > java/net/MulticastSocket/SetLoopbackMode.java Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: Test failed > java/net/MulticastSocket/SetLoopbackModeIPv4.java Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: Test failed > java/net/MulticastSocket/SetOutgoingIf.java Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: java.net.SocketTimeoutException: Receive timed out > java/net/MulticastSocket/Test.java Failed. Execution failed: `main' threw exception: java.lang.Exception: Test failed - see log file for details > > > Since > > > git checkout master > make clean images test TEST=java/net/MulticastSocket/Promiscuous.java > > > fails similarly, I presume these are unrelated, perhaps something about my network configuration. > > I have no more changes planned. Hi @jglick sorry for the long time this took to review. I'm happy with the proposed change as they are. If you `/integrate` them then @Michael-Mc-Mahon or I will sponsor. ------------- PR Comment: https://git.openjdk.org/jdk/pull/12871#issuecomment-1610993125 From dclarke at openjdk.org Wed Jun 28 09:52:16 2023 From: dclarke at openjdk.org (Darragh Clarke) Date: Wed, 28 Jun 2023 09:52:16 GMT Subject: RFR: 8309302: java/net/Socket/Timeouts.java fails with AssertionError on test temporal post condition Message-ID: <5f8bCmB7VZCoHcxPakOY7A-zpmuI2cAdN6h24uUtGBw=.ac3883de-90ae-4340-a597-3fe890e93099@github.com> Bumped timeout limit to `+20_000` to deal with occasional failure and bring the test in line with other tests like [SleepWithDuration](https://github.com/openjdk/jdk/blob/c3f10e847999ec254893de5a1a5de32fd07f715a/test/jdk/java/lang/Thread/SleepWithDuration.java#L46) and [JoinWithDuration](https://github.com/openjdk/jdk/blob/c3f10e847999ec254893de5a1a5de32fd07f715a/test/jdk/java/lang/Thread/JoinWithDuration.java#L67) . I had considered making a Util class to contain `checkDuration` but decided against it because as far as I'm aware it is only these 3 classes that would share it, though I would be open to adding it if people think it adds value ------------- Commit messages: - increased timeouts from +2000 to +20_000 Changes: https://git.openjdk.org/jdk/pull/14690/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14690&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8309302 Stats: 7 lines in 1 file changed: 0 ins; 0 del; 7 mod Patch: https://git.openjdk.org/jdk/pull/14690.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14690/head:pull/14690 PR: https://git.openjdk.org/jdk/pull/14690 From sanjay.prasad at kalkitech.com Wed Jun 28 10:46:39 2023 From: sanjay.prasad at kalkitech.com (Sanjay Prasad) Date: Wed, 28 Jun 2023 16:16:39 +0530 Subject: Custom hostname verifier for HTTP client Message-ID: <1789b88b-ff64-d6e4-17a8-e109e88fe20f@kalkitech.com> Hi all, There is a bug filed on this with some reference to mails and stack overflow questions here (https://bugs.openjdk.org/browse/JDK-8213309), but nothing has been done on it yet. It looks more like the feature is treated as a testing requirement rather than a real requirement. In cases where a server presents a non DNS based certificate, a custom host name verifier is needed. This may be used for destination device validation based on the serial number embedded in the presented certificate or using LFDIs in the IEEE2030.5 case. As the device license based validation is proprietary, I will point to the IEEE2030.5 public spec overview for "device certificate" with LFDI use case. IEEE2030.5 spec overview can be found here (http://sunspec.org/wp-content/uploads/2017/08/IEEE2030.5SecurityOverview-Gordon07-24-2018.pdf). The server as well as client devices present their device certificates during TLS handshake and the certificate LFDI (derived from SHA256 hash of the certificate) is used to validate each other. The host name validation mechanism of the https url connection can be overridden to do this validation. Please note, on page 16 of the above document, the device certificate's "subject" is blank. With the new virtual threads in java, url connection seems to cause the real thread to get pinned and use of the new HTTP client is necessary to allow maximum concurrency. This implementation cannot set the host name verifier and so cannot validate the server LFDI. Please add a host name verifier as using the jdk.internal.httpclient.disableHostnameVerification to avoid validation is not an option and default hostname validation does not work for IEEE2030.5. -Regards -SP PLEASE CONSIDER OUR ENVIRONMENT BEFORE PRINTING THIS EMAIL. This e-mail (including any attachments) is confidential and may be legally privileged. If you are not an intended recipient or an authorized representative of an intended recipient, you are prohibited from using, copying or distributing the information in this e-mail or its attachments. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete all copies of this message and any attachments. Thank you. From sanjay.prasad at kalkitech.com Wed Jun 28 10:47:54 2023 From: sanjay.prasad at kalkitech.com (Sanjay Prasad) Date: Wed, 28 Jun 2023 16:17:54 +0530 Subject: Custom hostname verifier for HTTP client Message-ID: <8f77b27e-3b0a-85c9-f1c5-cc94295c6ae3@kalkitech.com> Hi all, There is a bug filed on this with some reference to mails and stack overflow questions here (https://bugs.openjdk.org/browse/JDK-8213309), but nothing has been done on it yet. It looks more like the feature is treated as a testing requirement rather than a real requirement. In cases where a server presents a non DNS based certificate, a custom host name verifier is needed. This may be used for destination device validation based on the serial number embedded in the presented certificate or using LFDIs in the IEEE2030.5 case. As the device license based validation is proprietary, I will point to the IEEE2030.5 public spec overview for "device certificate" with LFDI use case. IEEE2030.5 spec overview can be found here (http://sunspec.org/wp-content/uploads/2017/08/IEEE2030.5SecurityOverview-Gordon07-24-2018.pdf). The server as well as client devices present their device certificates during TLS handshake and the certificate LFDI (derived from SHA256 hash of the certificate) is used to validate each other. The host name validation mechanism of the https url connection can be overridden to do this validation. Please note, on page 16 of the above document, the device certificate's "subject" is blank. With the new virtual threads in java, url connection seems to cause the real thread to get pinned and use of the new HTTP client is necessary to allow maximum concurrency. This implementation cannot set the host name verifier and so cannot validate the server LFDI. Please add a host name verifier as using the jdk.internal.httpclient.disableHostnameVerification to avoid validation is not an option and default hostname validation does not work for IEEE2030.5. -Regards -SP PLEASE CONSIDER OUR ENVIRONMENT BEFORE PRINTING THIS EMAIL. This e-mail (including any attachments) is confidential and may be legally privileged. If you are not an intended recipient or an authorized representative of an intended recipient, you are prohibited from using, copying or distributing the information in this e-mail or its attachments. If you have received this e-mail in error, please notify the sender immediately by return e-mail and delete all copies of this message and any attachments. Thank you. From jpai at openjdk.org Wed Jun 28 11:22:15 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Wed, 28 Jun 2023 11:22:15 GMT Subject: RFR: 8311032: Empty value for java.protocol.handler.pkgs system property can lead to unnecessary classloading attempts of protocol handlers Message-ID: Can I please get a review for this change which proposes to address https://bugs.openjdk.org/browse/JDK-8311032? The commit in this PR skips the class lookups when the package name prefix is empty, either due to the `java.protocol.handler.pkgs` system property value being empty or due to individual parts of the `|` delimited value being empty. This avoids potentially expensive classloading attempts for a class name of the form `.foo.Handler`, which is bound to fail. No new jtreg test has been added given the nature of the change. There's already an existing test `test/jdk/java/net/URL/HandlersPkgPrefix/HandlersPkgPrefix.java` which tests different values for the `java.protocol.handler.pkgs` system property (including empty value) and that test continues to pass with this change. tier testing is currently in progress. ------------- Commit messages: - 8311032: Empty value for java.protocol.handler.pkgs system property can lead to unnecessary classloading attempts of protocol handlers Changes: https://git.openjdk.org/jdk/pull/14693/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14693&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8311032 Stats: 5 lines in 1 file changed: 3 ins; 0 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/14693.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14693/head:pull/14693 PR: https://git.openjdk.org/jdk/pull/14693 From alanb at openjdk.org Wed Jun 28 12:24:06 2023 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 28 Jun 2023 12:24:06 GMT Subject: RFR: 8311032: Empty value for java.protocol.handler.pkgs system property can lead to unnecessary classloading attempts of protocol handlers In-Reply-To: References: Message-ID: On Wed, 28 Jun 2023 11:15:53 GMT, Jaikiran Pai wrote: > Can I please get a review for this change which proposes to address https://bugs.openjdk.org/browse/JDK-8311032? > > The commit in this PR skips the class lookups when the package name prefix is empty, either due to the `java.protocol.handler.pkgs` system property value being empty or due to individual parts of the `|` delimited value being empty. > > This avoids potentially expensive classloading attempts for a class name of the form `.foo.Handler`, which is bound to fail. > > No new jtreg test has been added given the nature of the change. There's already an existing test `test/jdk/java/net/URL/HandlersPkgPrefix/HandlersPkgPrefix.java` which tests different values for the `java.protocol.handler.pkgs` system property (including empty value) and that test continues to pass with this change. > > tier testing is currently in progress. No objection to changing this but I'm curious if this is a real issue or not. Have you seen deployments with -Dava.protocol.handler.pkgs= ? Just curious. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14693#issuecomment-1611302351 From jpai at openjdk.org Wed Jun 28 13:06:03 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Wed, 28 Jun 2023 13:06:03 GMT Subject: RFR: 8311032: Empty value for java.protocol.handler.pkgs system property can lead to unnecessary classloading attempts of protocol handlers In-Reply-To: References: Message-ID: On Wed, 28 Jun 2023 11:15:53 GMT, Jaikiran Pai wrote: > Can I please get a review for this change which proposes to address https://bugs.openjdk.org/browse/JDK-8311032? > > The commit in this PR skips the class lookups when the package name prefix is empty, either due to the `java.protocol.handler.pkgs` system property value being empty or due to individual parts of the `|` delimited value being empty. > > This avoids potentially expensive classloading attempts for a class name of the form `.foo.Handler`, which is bound to fail. > > No new jtreg test has been added given the nature of the change. There's already an existing test `test/jdk/java/net/URL/HandlersPkgPrefix/HandlersPkgPrefix.java` which tests different values for the `java.protocol.handler.pkgs` system property (including empty value) and that test continues to pass with this change. > > tier testing is currently in progress. Hello Alan, this issue with empty value was noticed when trying to get past the other issue noted in https://bugs.openjdk.org/browse/JDK-8311032. The reporter of that other issue tried to workaround that StackOverflowError, by trying to conditionally set the value for this system property only when they thought it might be necessary. The workaround was of the form '-Djava.protocol.handler.pkg=${var}'. In such builds, 'var' would evaluate to empty when they didn't want to set any genuine package name. It was expected that using this workaround would prevent the StackOverflowError when large classpaths were involved. But given the way this code currently deals with empty value, it still ended up scanning the large classpath for an unnecessary class and eventually again ended up with the StackOverflowError. So this change is to prevent such cases, which in reality should be rare. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14693#issuecomment-1611362069 From alanb at openjdk.org Wed Jun 28 13:23:02 2023 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 28 Jun 2023 13:23:02 GMT Subject: RFR: 8309302: java/net/Socket/Timeouts.java fails with AssertionError on test temporal post condition In-Reply-To: <5f8bCmB7VZCoHcxPakOY7A-zpmuI2cAdN6h24uUtGBw=.ac3883de-90ae-4340-a597-3fe890e93099@github.com> References: <5f8bCmB7VZCoHcxPakOY7A-zpmuI2cAdN6h24uUtGBw=.ac3883de-90ae-4340-a597-3fe890e93099@github.com> Message-ID: On Wed, 28 Jun 2023 09:45:08 GMT, Darragh Clarke wrote: > Bumped timeout limit to `+20_000` to deal with occasional failure and bring the test in line with other tests like [SleepWithDuration](https://github.com/openjdk/jdk/blob/c3f10e847999ec254893de5a1a5de32fd07f715a/test/jdk/java/lang/Thread/SleepWithDuration.java#L46) and [JoinWithDuration](https://github.com/openjdk/jdk/blob/c3f10e847999ec254893de5a1a5de32fd07f715a/test/jdk/java/lang/Thread/JoinWithDuration.java#L67) . > > I had considered making a Util class to contain `checkDuration` but decided against it because as far as I'm aware it is only these 3 classes that would share it, though I would be open to adding it if people think it adds value This is consistent with other tests where we've done the same. ------------- Marked as reviewed by alanb (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14690#pullrequestreview-1503074368 From dfuchs at openjdk.org Wed Jun 28 13:59:04 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Wed, 28 Jun 2023 13:59:04 GMT Subject: RFR: 8311032: Empty value for java.protocol.handler.pkgs system property can lead to unnecessary classloading attempts of protocol handlers In-Reply-To: References: Message-ID: On Wed, 28 Jun 2023 11:15:53 GMT, Jaikiran Pai wrote: > Can I please get a review for this change which proposes to address https://bugs.openjdk.org/browse/JDK-8311032? > > The commit in this PR skips the class lookups when the package name prefix is empty, either due to the `java.protocol.handler.pkgs` system property value being empty or due to individual parts of the `|` delimited value being empty. > > This avoids potentially expensive classloading attempts for a class name of the form `.foo.Handler`, which is bound to fail. > > No new jtreg test has been added given the nature of the change. There's already an existing test `test/jdk/java/net/URL/HandlersPkgPrefix/HandlersPkgPrefix.java` which tests different values for the `java.protocol.handler.pkgs` system property (including empty value) and that test continues to pass with this change. > > tier testing is currently in progress. LGTM. Please double check that there's no issue with tier2. ------------- Marked as reviewed by dfuchs (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14693#pullrequestreview-1503159871 From dfuchs at openjdk.org Wed Jun 28 14:02:04 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Wed, 28 Jun 2023 14:02:04 GMT Subject: RFR: 8309302: java/net/Socket/Timeouts.java fails with AssertionError on test temporal post condition In-Reply-To: <5f8bCmB7VZCoHcxPakOY7A-zpmuI2cAdN6h24uUtGBw=.ac3883de-90ae-4340-a597-3fe890e93099@github.com> References: <5f8bCmB7VZCoHcxPakOY7A-zpmuI2cAdN6h24uUtGBw=.ac3883de-90ae-4340-a597-3fe890e93099@github.com> Message-ID: On Wed, 28 Jun 2023 09:45:08 GMT, Darragh Clarke wrote: > Bumped timeout limit to `+20_000` to deal with occasional failure and bring the test in line with other tests like [SleepWithDuration](https://github.com/openjdk/jdk/blob/c3f10e847999ec254893de5a1a5de32fd07f715a/test/jdk/java/lang/Thread/SleepWithDuration.java#L46) and [JoinWithDuration](https://github.com/openjdk/jdk/blob/c3f10e847999ec254893de5a1a5de32fd07f715a/test/jdk/java/lang/Thread/JoinWithDuration.java#L67) . > > I had considered making a Util class to contain `checkDuration` but decided against it because as far as I'm aware it is only these 3 classes that would share it, though I would be open to adding it if people think it adds value This looks reasonable to me. Please update copyright years if needed before integrating, and make sure that the modified test are stable in the CI. ------------- Marked as reviewed by dfuchs (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14690#pullrequestreview-1503171124 From duke at openjdk.org Wed Jun 28 15:16:29 2023 From: duke at openjdk.org (Jesse Glick) Date: Wed, 28 Jun 2023 15:16:29 GMT Subject: RFR: JDK-6956385: URLConnection.getLastModified() leaks file handles for jar:file and file: URLs [v4] In-Reply-To: References: <-EBiBT8IMzEF1Of8fZwlNIx68VHqJn0qdJFmoZbNN5w=.8009a74a-455d-40cf-88a1-7c52e8eab81e@github.com> Message-ID: On Mon, 22 May 2023 16:19:40 GMT, Jesse Glick wrote: >> [JDK-6956385](https://bugs.openjdk.org/browse/JDK-6956385): `JarURLConnection` properly tracks any `InputStream` it itself opened, and correspondingly closes the `JarFile` if necessary (when caches are disabled). However if its underlying `FileURLConnection` was used to retrieve a header field, that would have caused a `FileInputStream` to be opened which never gets closed until it is garbage collected. This means that an application which calls certain methods on `jar:file:/?something.jar!/?` URLs will leak file handles, even if `URLConnection` caches are supposed to be turned off. This can delay release of system resources, and on Windows can prevent the JAR file from being deleted even after it is no longer in use (for example after `URLClassLoader.close`). >> >> [JDK-8224095](https://bugs.openjdk.org/browse/JDK-8224095) was marked as a duplicate, but I think incorrectly. It refers to `FileURLConnection`, and seems to be complaining about the confusing API design of `URLConnection` generally: that it is an object which you might expect to be `Closeable` but in fact it is its `inputStream` which must be `close`d. In JDK-6956385, even when the caller _does_ specifically call `InputStream.close`, a file handle may be leaked. >> >> I managed to build the JDK on both Linux and (Cygwin) Windows to confirm the fix via >> >> >> ./build/?-x86_64-server-release/jdk/bin/java test/jdk/sun/net/www/protocol/jar/FileURLConnectionLeak.java >> >> >> I also ran jtreg on Linux (this test and various others in nearby packages); on Windows the `make test` target just hung for some reason. >> >> I marked the test `othervm` out of caution, since it is mutating global state, and if it fails will leak a handle and prevent scratch dir cleanup on Windows. >> >> (This is my first contribution, at least after the move to GitHub, so let me know if something is missing here technically or stylistically. None of the contribution guides appear to be up to date.) > > Jesse Glick has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision: > > - Merge branch 'master' of https://github.com/openjdk/jdk into FileURLConnectionLeak-JDK-6956385 > - `URLConnection.getLastModified` reproduces the bug the same as `getContentEncoding` but better matches the bug title (suggested by @ecki https://github.com/openjdk/jdk/pull/12871#discussion_r1200716271) > - Leaving `FileURLConnection.is` non-null, and claiming `connected`, even after `closeInputStream` https://github.com/openjdk/jdk/pull/12871#discussion_r1199085883 > - Encapsulate logic as `FileURLConnection.closeInputStream` as suggested by @dfuch https://github.com/openjdk/jdk/pull/12871#discussion_r1198859517 > - Merge branch 'master' of https://github.com/openjdk/jdk into FileURLConnectionLeak-JDK-6956385 > - Simplified `instanceof` form > > Co-authored-by: ExE Boss <3889017+ExE-Boss at users.noreply.github.com> > - 6956385: `JarURLConnection` may fail to close its underlying `FileURLConnection` (Trying to follow instructions in https://openjdk.org/jeps/369, if those are even still valid. https://github.com/openjdk/jdk/blob/master/CONTRIBUTING.md is not very helpful. I guess it should link to https://openjdk.org/guide/#life-of-a-pr which makes no mention of `/summary`?) ------------- PR Comment: https://git.openjdk.org/jdk/pull/12871#issuecomment-1611622666 From duke at openjdk.org Wed Jun 28 15:37:00 2023 From: duke at openjdk.org (Jesse Glick) Date: Wed, 28 Jun 2023 15:37:00 GMT Subject: Integrated: JDK-6956385: URLConnection.getLastModified() leaks file handles for jar:file and file: URLs In-Reply-To: <-EBiBT8IMzEF1Of8fZwlNIx68VHqJn0qdJFmoZbNN5w=.8009a74a-455d-40cf-88a1-7c52e8eab81e@github.com> References: <-EBiBT8IMzEF1Of8fZwlNIx68VHqJn0qdJFmoZbNN5w=.8009a74a-455d-40cf-88a1-7c52e8eab81e@github.com> Message-ID: On Sat, 4 Mar 2023 21:49:20 GMT, Jesse Glick wrote: > [JDK-6956385](https://bugs.openjdk.org/browse/JDK-6956385): `JarURLConnection` properly tracks any `InputStream` it itself opened, and correspondingly closes the `JarFile` if necessary (when caches are disabled). However if its underlying `FileURLConnection` was used to retrieve a header field, that would have caused a `FileInputStream` to be opened which never gets closed until it is garbage collected. This means that an application which calls certain methods on `jar:file:/?something.jar!/?` URLs will leak file handles, even if `URLConnection` caches are supposed to be turned off. This can delay release of system resources, and on Windows can prevent the JAR file from being deleted even after it is no longer in use (for example after `URLClassLoader.close`). > > [JDK-8224095](https://bugs.openjdk.org/browse/JDK-8224095) was marked as a duplicate, but I think incorrectly. It refers to `FileURLConnection`, and seems to be complaining about the confusing API design of `URLConnection` generally: that it is an object which you might expect to be `Closeable` but in fact it is its `inputStream` which must be `close`d. In JDK-6956385, even when the caller _does_ specifically call `InputStream.close`, a file handle may be leaked. > > I managed to build the JDK on both Linux and (Cygwin) Windows to confirm the fix via > > > ./build/?-x86_64-server-release/jdk/bin/java test/jdk/sun/net/www/protocol/jar/FileURLConnectionLeak.java > > > I also ran jtreg on Linux (this test and various others in nearby packages); on Windows the `make test` target just hung for some reason. > > I marked the test `othervm` out of caution, since it is mutating global state, and if it fails will leak a handle and prevent scratch dir cleanup on Windows. > > (This is my first contribution, at least after the move to GitHub, so let me know if something is missing here technically or stylistically. None of the contribution guides appear to be up to date.) This pull request has now been integrated. Changeset: 9f98136c Author: Jesse Glick Committer: Michael McMahon URL: https://git.openjdk.org/jdk/commit/9f98136c3a00ca24d59ffefd58308603b58110c7 Stats: 86 lines in 3 files changed: 84 ins; 0 del; 2 mod 6956385: URLConnection.getLastModified() leaks file handles for jar:file and file: URLs Define FileURLConnection.closeInputStream for use by JarURLInputStream.close. JarURLConnection properly tracks any InputStream it itself opened, and correspondingly closes the JarFile if necessary (when caches are disabled). But if its underlying FileURLConnection was used to retrieve a header field, that would have caused a FileInputStream to be opened which never gets closed until it is garbage collected. This means that an application which calls certain methods on jar:file:/?something.jar!/? URLs will leak file handles, even if URLConnection caches are supposed to be turned off. This can delay release of system resources, and on Windows can prevent the JAR file from being deleted even after it is no longer in use (for example after URLClassLoader.close). Reviewed-by: dfuchs, michaelm ------------- PR: https://git.openjdk.org/jdk/pull/12871 From lkorinth at openjdk.org Wed Jun 28 17:04:24 2023 From: lkorinth at openjdk.org (Leo Korinth) Date: Wed, 28 Jun 2023 17:04:24 GMT Subject: RFR: 8311043: Remove trailing blank lines in source files Message-ID: Remove trailing "blank" lines in source files. I like to use global-whitespace-cleanup-mode, but I can not use it if the files are "dirty" to begin with. This fix will make more files "clean". I also considered adding a check for this in jcheck for Skara, however it seems jcheck code handling hunks does not track end-of-files. Thus I will only clean the files. The fix removes trailing lines matching ^[[:space:]]*$ in - *.java - *.cpp - *.hpp - *.c - *.h I have applied the following bash script to each file: file="$1" while [[ $(tail -n 1 "$file") =~ ^[[:space:]]*$ ]]; do truncate -s -1 "$file" done `git diff --ignore-space-change --ignore-blank-lines master` displays no changes `git diff --ignore-blank-lines master` displays one change ------------- Commit messages: - h - c - hpp - cpp - 8311043: Remove trailing blank lines in source files Changes: https://git.openjdk.org/jdk/pull/14698/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14698&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8311043 Stats: 4529 lines in 4382 files changed: 0 ins; 4529 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/14698.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14698/head:pull/14698 PR: https://git.openjdk.org/jdk/pull/14698 From tprinzing at openjdk.org Wed Jun 28 18:53:12 2023 From: tprinzing at openjdk.org (Tim Prinzing) Date: Wed, 28 Jun 2023 18:53:12 GMT Subject: RFR: 8308995: Update Network IO JFR events to be static mirror events [v4] In-Reply-To: References: Message-ID: > The socket read/write JFR events currently use instrumentation of java.base code using templates in the jdk.jfr modules. This results in some java.base code residing in the jdk.jfr module which is undesirable. > > JDK19 added static support for event classes. The old instrumentor classes should be replaced with mirror events using the static support. > > In the java.base module: > Added two new events, jdk.internal.event.SocketReadEvent and jdk.internal.event.SocketWriteEvent. > java.net.Socket and sun.nio.ch.SocketChannelImpl were changed to make use of the new events. > > In the jdk.jfr module: > jdk.jfr.events.SocketReadEvent and jdk.jfr.events.SocketWriteEvent were changed to be mirror events. > In the package jdk.jfr.internal.instrument, the classes SocketChannelImplInstrumentor, SocketInputStreamInstrumentor, and SocketOutputStreamInstrumentor were removed. The JDKEvents class was updated to reflect all of those changes. > > The existing tests in test/jdk/jdk/jfr/event/io continue to pass with the new implementation: > Passed: jdk/jfr/event/io/TestSocketChannelEvents.java > Passed: jdk/jfr/event/io/TestSocketEvents.java > > I added a micro benchmark which measures the overhead of handling the jfr socket events. > test/micro/org/openjdk/bench/java/net/SocketEventOverhead.java. > It needs access the jdk.internal.event package, which is done at runtime with annotations that add the extra arguments. > At compile time the build arguments had to be augmented in make/test/BuildMicrobenchmark.gmk Tim Prinzing has updated the pull request incrementally with one additional commit since the last revision: less exception filtering when fetching socket read timeout ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14342/files - new: https://git.openjdk.org/jdk/pull/14342/files/27a766c7..d6f7df72 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14342&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14342&range=02-03 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/14342.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14342/head:pull/14342 PR: https://git.openjdk.org/jdk/pull/14342 From jpai at openjdk.org Thu Jun 29 01:34:13 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Thu, 29 Jun 2023 01:34:13 GMT Subject: RFR: 8311032: Empty value for java.protocol.handler.pkgs system property can lead to unnecessary classloading attempts of protocol handlers In-Reply-To: References: Message-ID: <_sGJJuNU3rF92lTPgpvz_wWcyChwyD6YgU_gSOiG3gk=.c0076bc3-aef6-47a3-91e0-fff61e20379c@github.com> On Wed, 28 Jun 2023 11:15:53 GMT, Jaikiran Pai wrote: > Can I please get a review for this change which proposes to address https://bugs.openjdk.org/browse/JDK-8311032? > > The commit in this PR skips the class lookups when the package name prefix is empty, either due to the `java.protocol.handler.pkgs` system property value being empty or due to individual parts of the `|` delimited value being empty. > > This avoids potentially expensive classloading attempts for a class name of the form `.foo.Handler`, which is bound to fail. > > No new jtreg test has been added given the nature of the change. There's already an existing test `test/jdk/java/net/URL/HandlersPkgPrefix/HandlersPkgPrefix.java` which tests different values for the `java.protocol.handler.pkgs` system property (including empty value) and that test continues to pass with this change. > > tier testing is currently in progress. Thank you Alan and Daniel for reviewing this change. tier1, tier2 and tier3 testing with this change came back without any failures. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14693#issuecomment-1612304943 From jpai at openjdk.org Thu Jun 29 01:34:14 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Thu, 29 Jun 2023 01:34:14 GMT Subject: Integrated: 8311032: Empty value for java.protocol.handler.pkgs system property can lead to unnecessary classloading attempts of protocol handlers In-Reply-To: References: Message-ID: <7eBVEYKZ3Iu7jUZuuzSeVBSVuLTbAXynxxK5sor5au0=.5f8e8962-1401-4074-b1ac-4ef89632097d@github.com> On Wed, 28 Jun 2023 11:15:53 GMT, Jaikiran Pai wrote: > Can I please get a review for this change which proposes to address https://bugs.openjdk.org/browse/JDK-8311032? > > The commit in this PR skips the class lookups when the package name prefix is empty, either due to the `java.protocol.handler.pkgs` system property value being empty or due to individual parts of the `|` delimited value being empty. > > This avoids potentially expensive classloading attempts for a class name of the form `.foo.Handler`, which is bound to fail. > > No new jtreg test has been added given the nature of the change. There's already an existing test `test/jdk/java/net/URL/HandlersPkgPrefix/HandlersPkgPrefix.java` which tests different values for the `java.protocol.handler.pkgs` system property (including empty value) and that test continues to pass with this change. > > tier testing is currently in progress. This pull request has now been integrated. Changeset: 8f5a3848 Author: Jaikiran Pai URL: https://git.openjdk.org/jdk/commit/8f5a38488c354b21f1033e1cbdfa0a400f2622fc Stats: 5 lines in 1 file changed: 3 ins; 0 del; 2 mod 8311032: Empty value for java.protocol.handler.pkgs system property can lead to unnecessary classloading attempts of protocol handlers Reviewed-by: dfuchs ------------- PR: https://git.openjdk.org/jdk/pull/14693 From jpai at openjdk.org Thu Jun 29 01:42:12 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Thu, 29 Jun 2023 01:42:12 GMT Subject: RFR: JDK-6956385: URLConnection.getLastModified() leaks file handles for jar:file and file: URLs [v4] In-Reply-To: References: <-EBiBT8IMzEF1Of8fZwlNIx68VHqJn0qdJFmoZbNN5w=.8009a74a-455d-40cf-88a1-7c52e8eab81e@github.com> Message-ID: <3XwQmv9p44UnSYyN46ZLRJpF3RHPga5e3GOZBXUxwNQ=.5c8bb2ac-6e83-4ec0-9d6a-3e7e78866082@github.com> On Mon, 22 May 2023 16:19:40 GMT, Jesse Glick wrote: >> [JDK-6956385](https://bugs.openjdk.org/browse/JDK-6956385): `JarURLConnection` properly tracks any `InputStream` it itself opened, and correspondingly closes the `JarFile` if necessary (when caches are disabled). However if its underlying `FileURLConnection` was used to retrieve a header field, that would have caused a `FileInputStream` to be opened which never gets closed until it is garbage collected. This means that an application which calls certain methods on `jar:file:/?something.jar!/?` URLs will leak file handles, even if `URLConnection` caches are supposed to be turned off. This can delay release of system resources, and on Windows can prevent the JAR file from being deleted even after it is no longer in use (for example after `URLClassLoader.close`). >> >> [JDK-8224095](https://bugs.openjdk.org/browse/JDK-8224095) was marked as a duplicate, but I think incorrectly. It refers to `FileURLConnection`, and seems to be complaining about the confusing API design of `URLConnection` generally: that it is an object which you might expect to be `Closeable` but in fact it is its `inputStream` which must be `close`d. In JDK-6956385, even when the caller _does_ specifically call `InputStream.close`, a file handle may be leaked. >> >> I managed to build the JDK on both Linux and (Cygwin) Windows to confirm the fix via >> >> >> ./build/?-x86_64-server-release/jdk/bin/java test/jdk/sun/net/www/protocol/jar/FileURLConnectionLeak.java >> >> >> I also ran jtreg on Linux (this test and various others in nearby packages); on Windows the `make test` target just hung for some reason. >> >> I marked the test `othervm` out of caution, since it is mutating global state, and if it fails will leak a handle and prevent scratch dir cleanup on Windows. >> >> (This is my first contribution, at least after the move to GitHub, so let me know if something is missing here technically or stylistically. None of the contribution guides appear to be up to date.) > > Jesse Glick has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision: > > - Merge branch 'master' of https://github.com/openjdk/jdk into FileURLConnectionLeak-JDK-6956385 > - `URLConnection.getLastModified` reproduces the bug the same as `getContentEncoding` but better matches the bug title (suggested by @ecki https://github.com/openjdk/jdk/pull/12871#discussion_r1200716271) > - Leaving `FileURLConnection.is` non-null, and claiming `connected`, even after `closeInputStream` https://github.com/openjdk/jdk/pull/12871#discussion_r1199085883 > - Encapsulate logic as `FileURLConnection.closeInputStream` as suggested by @dfuch https://github.com/openjdk/jdk/pull/12871#discussion_r1198859517 > - Merge branch 'master' of https://github.com/openjdk/jdk into FileURLConnectionLeak-JDK-6956385 > - Simplified `instanceof` form > > Co-authored-by: ExE Boss <3889017+ExE-Boss at users.noreply.github.com> > - 6956385: `JarURLConnection` may fail to close its underlying `FileURLConnection` Hello Jesse, > (Trying to follow instructions in https://openjdk.org/jeps/369, if those are even still valid. https://github.com/openjdk/jdk/blob/master/CONTRIBUTING.md is not very helpful. I guess it should link to https://openjdk.org/guide/#life-of-a-pr which makes no mention of `/summary`?) Skara bot commands are listed in https://wiki.openjdk.org/display/SKARA/Pull+Request+Commands ------------- PR Comment: https://git.openjdk.org/jdk/pull/12871#issuecomment-1612310113 From erikj at openjdk.org Thu Jun 29 07:23:54 2023 From: erikj at openjdk.org (Erik Joelsson) Date: Thu, 29 Jun 2023 07:23:54 GMT Subject: RFR: 8311043: Remove trailing blank lines in source files In-Reply-To: References: Message-ID: On Wed, 28 Jun 2023 16:54:51 GMT, Leo Korinth wrote: > Remove trailing "blank" lines in source files. > > I like to use global-whitespace-cleanup-mode, but I can not use it if the files are "dirty" to begin with. This fix will make more files "clean". I also considered adding a check for this in jcheck for Skara, however it seems jcheck code handling hunks does not track end-of-files. Thus I will only clean the files. > > The fix removes trailing lines matching ^[[:space:]]*$ in > > - *.java > - *.cpp > - *.hpp > - *.c > - *.h > > I have applied the following bash script to each file: > > file="$1" > > while [[ $(tail -n 1 "$file") =~ ^[[:space:]]*$ ]]; do > truncate -s -1 "$file" > done > > `git diff --ignore-space-change --ignore-blank-lines master` displays no changes > `git diff --ignore-blank-lines master` displays one change Marked as reviewed by erikj (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/14698#pullrequestreview-1504702261 From dholmes at openjdk.org Thu Jun 29 07:43:58 2023 From: dholmes at openjdk.org (David Holmes) Date: Thu, 29 Jun 2023 07:43:58 GMT Subject: RFR: 8311043: Remove trailing blank lines in source files In-Reply-To: References: Message-ID: On Wed, 28 Jun 2023 16:54:51 GMT, Leo Korinth wrote: > Remove trailing "blank" lines in source files. > > I like to use global-whitespace-cleanup-mode, but I can not use it if the files are "dirty" to begin with. This fix will make more files "clean". I also considered adding a check for this in jcheck for Skara, however it seems jcheck code handling hunks does not track end-of-files. Thus I will only clean the files. > > The fix removes trailing lines matching ^[[:space:]]*$ in > > - *.java > - *.cpp > - *.hpp > - *.c > - *.h > > I have applied the following bash script to each file: > > file="$1" > > while [[ $(tail -n 1 "$file") =~ ^[[:space:]]*$ ]]; do > truncate -s -1 "$file" > done > > `git diff --ignore-space-change --ignore-blank-lines master` displays no changes > `git diff --ignore-blank-lines master` displays one change This seems to run contrary to the requirement that files end in a newline, which git will complain about if the newline is missing. It also seems far too large and disruptive. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14698#issuecomment-1612567676 From erikj at openjdk.org Thu Jun 29 08:00:58 2023 From: erikj at openjdk.org (Erik Joelsson) Date: Thu, 29 Jun 2023 08:00:58 GMT Subject: RFR: 8311043: Remove trailing blank lines in source files In-Reply-To: References: Message-ID: On Thu, 29 Jun 2023 07:41:11 GMT, David Holmes wrote: > This seems to run contrary to the requirement that files end in a newline, which git will complain about if the newline is missing. The patch is leaving exactly one newline at the end of the file. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14698#issuecomment-1612588091 From lkorinth at openjdk.org Thu Jun 29 08:58:59 2023 From: lkorinth at openjdk.org (Leo Korinth) Date: Thu, 29 Jun 2023 08:58:59 GMT Subject: RFR: 8311043: Remove trailing blank lines in source files In-Reply-To: References: Message-ID: On Thu, 29 Jun 2023 07:41:11 GMT, David Holmes wrote: > This seems to run contrary to the requirement that files end in a newline, which git will complain about if the newline is missing. > > It also seems far too large and disruptive. Do you still think it is too disruptive after Erik's explanation? I could split it in more reviews, but I thought that maybe it would just make the review harder. I was hoping the two `git diff` commands I gave in my first comment in combination with the clean script would make the change seem reviewable. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14698#issuecomment-1612660457 From coleenp at openjdk.org Thu Jun 29 12:03:56 2023 From: coleenp at openjdk.org (Coleen Phillimore) Date: Thu, 29 Jun 2023 12:03:56 GMT Subject: RFR: 8311043: Remove trailing blank lines in source files In-Reply-To: References: Message-ID: On Wed, 28 Jun 2023 16:54:51 GMT, Leo Korinth wrote: > Remove trailing "blank" lines in source files. > > I like to use global-whitespace-cleanup-mode, but I can not use it if the files are "dirty" to begin with. This fix will make more files "clean". I also considered adding a check for this in jcheck for Skara, however it seems jcheck code handling hunks does not track end-of-files. Thus I will only clean the files. > > The fix removes trailing lines matching ^[[:space:]]*$ in > > - *.java > - *.cpp > - *.hpp > - *.c > - *.h > > I have applied the following bash script to each file: > > file="$1" > > while [[ $(tail -n 1 "$file") =~ ^[[:space:]]*$ ]]; do > truncate -s -1 "$file" > done > > `git diff --ignore-space-change --ignore-blank-lines master` displays no changes > `git diff --ignore-blank-lines master` displays one change Why do we care about this? ------------- PR Comment: https://git.openjdk.org/jdk/pull/14698#issuecomment-1613018234 From dholmes at openjdk.org Thu Jun 29 12:14:55 2023 From: dholmes at openjdk.org (David Holmes) Date: Thu, 29 Jun 2023 12:14:55 GMT Subject: RFR: 8311043: Remove trailing blank lines in source files In-Reply-To: References: Message-ID: <3rq9p7Pqn9UcVlQ5E0XMltGBBgmpWeLiz0k7HDi53qE=.fa670ef1-cd6c-4e4a-9ec3-89d5a2fec0ef@github.com> On Wed, 28 Jun 2023 16:54:51 GMT, Leo Korinth wrote: > Remove trailing "blank" lines in source files. > > I like to use global-whitespace-cleanup-mode, but I can not use it if the files are "dirty" to begin with. This fix will make more files "clean". I also considered adding a check for this in jcheck for Skara, however it seems jcheck code handling hunks does not track end-of-files. Thus I will only clean the files. > > The fix removes trailing lines matching ^[[:space:]]*$ in > > - *.java > - *.cpp > - *.hpp > - *.c > - *.h > > I have applied the following bash script to each file: > > file="$1" > > while [[ $(tail -n 1 "$file") =~ ^[[:space:]]*$ ]]; do > truncate -s -1 "$file" > done > > `git diff --ignore-space-change --ignore-blank-lines master` displays no changes > `git diff --ignore-blank-lines master` displays one change Neither the PR diffs nor the webrev make it easy to see exactly what is being changed here. It appeared to me that the last empty line of each file was being deleted, leaving no newline at the end. But to me this is too disruptive with no tangible benefit. And you need buy-in from all the different areas affected by this. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14698#issuecomment-1613043398 From lkorinth at openjdk.org Thu Jun 29 12:38:57 2023 From: lkorinth at openjdk.org (Leo Korinth) Date: Thu, 29 Jun 2023 12:38:57 GMT Subject: RFR: 8311043: Remove trailing blank lines in source files In-Reply-To: References: Message-ID: On Thu, 29 Jun 2023 12:01:03 GMT, Coleen Phillimore wrote: > Why do we care about this? I care because of global-whitespace-cleanup-mode (in emacs). It helps me remove trailing whitespaces and blanklines when saving but it will not fix a file that was "dirty" when it was opened. Trailing blank lines triggers it not to clean whitespaces for me. And it does not look good. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14698#issuecomment-1613095390 From coleenp at openjdk.org Thu Jun 29 12:42:56 2023 From: coleenp at openjdk.org (Coleen Phillimore) Date: Thu, 29 Jun 2023 12:42:56 GMT Subject: RFR: 8311043: Remove trailing blank lines in source files In-Reply-To: References: Message-ID: On Wed, 28 Jun 2023 16:54:51 GMT, Leo Korinth wrote: > Remove trailing "blank" lines in source files. > > I like to use global-whitespace-cleanup-mode, but I can not use it if the files are "dirty" to begin with. This fix will make more files "clean". I also considered adding a check for this in jcheck for Skara, however it seems jcheck code handling hunks does not track end-of-files. Thus I will only clean the files. > > The fix removes trailing lines matching ^[[:space:]]*$ in > > - *.java > - *.cpp > - *.hpp > - *.c > - *.h > > I have applied the following bash script to each file: > > file="$1" > > while [[ $(tail -n 1 "$file") =~ ^[[:space:]]*$ ]]; do > truncate -s -1 "$file" > done > > `git diff --ignore-space-change --ignore-blank-lines master` displays no changes > `git diff --ignore-blank-lines master` displays one change You could fix your emacs functions. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14698#issuecomment-1613106245 From lkorinth at openjdk.org Thu Jun 29 13:08:59 2023 From: lkorinth at openjdk.org (Leo Korinth) Date: Thu, 29 Jun 2023 13:08:59 GMT Subject: RFR: 8311043: Remove trailing blank lines in source files In-Reply-To: <3rq9p7Pqn9UcVlQ5E0XMltGBBgmpWeLiz0k7HDi53qE=.fa670ef1-cd6c-4e4a-9ec3-89d5a2fec0ef@github.com> References: <3rq9p7Pqn9UcVlQ5E0XMltGBBgmpWeLiz0k7HDi53qE=.fa670ef1-cd6c-4e4a-9ec3-89d5a2fec0ef@github.com> Message-ID: On Thu, 29 Jun 2023 12:11:40 GMT, David Holmes wrote: > Neither the PR diffs nor the webrev make it easy to see exactly what is being changed here. It appeared to me that the last empty line of each file was being deleted, leaving no newline at the end. My changes look like this in the diff output } - Removal of the last newline would look like this: -} +} \ No newline at end of file (both with `git diff` and `git diff --unified`) I have not tested if this is also true for the generated webrevs, but I think that is precisely how they are created. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14698#issuecomment-1613152641 From lkorinth at openjdk.org Thu Jun 29 14:12:55 2023 From: lkorinth at openjdk.org (Leo Korinth) Date: Thu, 29 Jun 2023 14:12:55 GMT Subject: RFR: 8311043: Remove trailing blank lines in source files In-Reply-To: References: Message-ID: On Thu, 29 Jun 2023 12:40:34 GMT, Coleen Phillimore wrote: > You could fix your emacs functions. It is a *very nice* feature of global-whitespace-cleanup-mode ------------- PR Comment: https://git.openjdk.org/jdk/pull/14698#issuecomment-1613252347 From coleenp at openjdk.org Thu Jun 29 15:46:57 2023 From: coleenp at openjdk.org (Coleen Phillimore) Date: Thu, 29 Jun 2023 15:46:57 GMT Subject: RFR: 8311043: Remove trailing blank lines in source files In-Reply-To: References: Message-ID: On Wed, 28 Jun 2023 16:54:51 GMT, Leo Korinth wrote: > Remove trailing "blank" lines in source files. > > I like to use global-whitespace-cleanup-mode, but I can not use it if the files are "dirty" to begin with. This fix will make more files "clean". I also considered adding a check for this in jcheck for Skara, however it seems jcheck code handling hunks does not track end-of-files. Thus I will only clean the files. > > The fix removes trailing lines matching ^[[:space:]]*$ in > > - *.java > - *.cpp > - *.hpp > - *.c > - *.h > > I have applied the following bash script to each file: > > file="$1" > > while [[ $(tail -n 1 "$file") =~ ^[[:space:]]*$ ]]; do > truncate -s -1 "$file" > done > > `git diff --ignore-space-change --ignore-blank-lines master` displays no changes > `git diff --ignore-blank-lines master` displays one change Per had an emacs feature to remove whitespaces at the end of the line, and gave me the vim version of that. That's a nice feature. I object to this change. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14698#issuecomment-1613437709 From lkorinth at openjdk.org Thu Jun 29 16:55:05 2023 From: lkorinth at openjdk.org (Leo Korinth) Date: Thu, 29 Jun 2023 16:55:05 GMT Subject: RFR: 8311043: Remove trailing blank lines in source files In-Reply-To: References: Message-ID: On Wed, 28 Jun 2023 16:54:51 GMT, Leo Korinth wrote: > Remove trailing "blank" lines in source files. > > I like to use global-whitespace-cleanup-mode, but I can not use it if the files are "dirty" to begin with. This fix will make more files "clean". I also considered adding a check for this in jcheck for Skara, however it seems jcheck code handling hunks does not track end-of-files. Thus I will only clean the files. > > The fix removes trailing lines matching ^[[:space:]]*$ in > > - *.java > - *.cpp > - *.hpp > - *.c > - *.h > > I have applied the following bash script to each file: > > file="$1" > > while [[ $(tail -n 1 "$file") =~ ^[[:space:]]*$ ]]; do > truncate -s -1 "$file" > done > > `git diff --ignore-space-change --ignore-blank-lines master` displays no changes > `git diff --ignore-blank-lines master` displays one change This was not liked, I will close it. I will possibly do it under another PR for the GC code. Thanks for reviewing. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14698#issuecomment-1613526703 From lkorinth at openjdk.org Thu Jun 29 16:55:06 2023 From: lkorinth at openjdk.org (Leo Korinth) Date: Thu, 29 Jun 2023 16:55:06 GMT Subject: Withdrawn: 8311043: Remove trailing blank lines in source files In-Reply-To: References: Message-ID: On Wed, 28 Jun 2023 16:54:51 GMT, Leo Korinth wrote: > Remove trailing "blank" lines in source files. > > I like to use global-whitespace-cleanup-mode, but I can not use it if the files are "dirty" to begin with. This fix will make more files "clean". I also considered adding a check for this in jcheck for Skara, however it seems jcheck code handling hunks does not track end-of-files. Thus I will only clean the files. > > The fix removes trailing lines matching ^[[:space:]]*$ in > > - *.java > - *.cpp > - *.hpp > - *.c > - *.h > > I have applied the following bash script to each file: > > file="$1" > > while [[ $(tail -n 1 "$file") =~ ^[[:space:]]*$ ]]; do > truncate -s -1 "$file" > done > > `git diff --ignore-space-change --ignore-blank-lines master` displays no changes > `git diff --ignore-blank-lines master` displays one change This pull request has been closed without being integrated. ------------- PR: https://git.openjdk.org/jdk/pull/14698 From dholmes at openjdk.org Fri Jun 30 01:24:05 2023 From: dholmes at openjdk.org (David Holmes) Date: Fri, 30 Jun 2023 01:24:05 GMT Subject: RFR: 8311043: Remove trailing blank lines in source files In-Reply-To: References: <3rq9p7Pqn9UcVlQ5E0XMltGBBgmpWeLiz0k7HDi53qE=.fa670ef1-cd6c-4e4a-9ec3-89d5a2fec0ef@github.com> Message-ID: On Thu, 29 Jun 2023 13:05:58 GMT, Leo Korinth wrote: > My changes look like this in the diff output > ``` > } > - > ``` Thanks for showing this and other output. To me this looked like the final newline had been removed. I would have expected to see something that more obviously showed more than one blank line before hand and exactly one after. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14698#issuecomment-1613985636 From prappo at openjdk.org Fri Jun 30 09:31:45 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Fri, 30 Jun 2023 09:31:45 GMT Subject: RFR: 8311162: Simplify and modernize equals and hashCode for java.net Message-ID: Please review this PR to use modern APIs and language features to simplify `equals` and `hashCode` for the java.net package. Note, in NetworkInterface we could do even more and change this: for (InetAddress thisAddr : this.addrs) { boolean found = false; for (InetAddress thatAddr : that.addrs) { if (thisAddr.equals(thatAddr)) { found = true; break; } } if (!found) { return false; } } return true; to this: return Set.of(that.addrs).containsAll(Set.of(this.addrs)); But arguably, the first option is already better enough than what was there before. ------------- Commit messages: - Initial commit Changes: https://git.openjdk.org/jdk/pull/14726/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14726&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8311162 Stats: 41 lines in 3 files changed: 10 ins; 18 del; 13 mod Patch: https://git.openjdk.org/jdk/pull/14726.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14726/head:pull/14726 PR: https://git.openjdk.org/jdk/pull/14726 From dfuchs at openjdk.org Fri Jun 30 09:31:46 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Fri, 30 Jun 2023 09:31:46 GMT Subject: RFR: 8311162: Simplify and modernize equals and hashCode for java.net In-Reply-To: References: Message-ID: On Fri, 30 Jun 2023 09:17:42 GMT, Pavel Rappo wrote: > Please review this PR to use modern APIs and language features to simplify `equals` and `hashCode` for the java.net package. > > Note, in NetworkInterface we could do even more and change this: > > for (InetAddress thisAddr : this.addrs) { > boolean found = false; > for (InetAddress thatAddr : that.addrs) { > if (thisAddr.equals(thatAddr)) { > found = true; > break; > } > } > if (!found) { > return false; > } > } > return true; > > to this: > > return Set.of(that.addrs).containsAll(Set.of(this.addrs)); > > But arguably, the first option is already better enough than what was there before. LGTM - please run either `tier2` or `:jdk_net` before integrating. ------------- Marked as reviewed by dfuchs (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14726#pullrequestreview-1506850906 From dfuchs at openjdk.org Fri Jun 30 09:36:53 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Fri, 30 Jun 2023 09:36:53 GMT Subject: RFR: 8311162: Simplify and modernize equals and hashCode for java.net In-Reply-To: References: Message-ID: <9pXqbnSe_lH_5uFAyIRFcv60idfxdK7idn7XoL9y9OU=.8d021ef3-5e99-42e8-8e10-677dc52f63f0@github.com> On Fri, 30 Jun 2023 09:17:42 GMT, Pavel Rappo wrote: > ```return Set.of(that.addrs).containsAll(Set.of(this.addrs));``` Since it's been checked before that the arrays have the same length it could even be: return Set.of(that.addrs).equals(Set.of(this.addrs)); but your proposed changes are already good enough. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14726#issuecomment-1614397323 From prappo at openjdk.org Fri Jun 30 10:54:52 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Fri, 30 Jun 2023 10:54:52 GMT Subject: RFR: 8311162: Simplify and modernize equals and hashCode for java.net In-Reply-To: <9pXqbnSe_lH_5uFAyIRFcv60idfxdK7idn7XoL9y9OU=.8d021ef3-5e99-42e8-8e10-677dc52f63f0@github.com> References: <9pXqbnSe_lH_5uFAyIRFcv60idfxdK7idn7XoL9y9OU=.8d021ef3-5e99-42e8-8e10-677dc52f63f0@github.com> Message-ID: On Fri, 30 Jun 2023 09:34:26 GMT, Daniel Fuchs wrote: > > `return Set.of(that.addrs).containsAll(Set.of(this.addrs));` > > Since it's been checked before that the arrays have the same length it could even be: > > ``` > return Set.of(that.addrs).equals(Set.of(this.addrs)); > ``` While this would be clearer and likely as intended, it wouldn't be equivalent. It would only be equivalent, if we could guarantee that there are no duplicates in `this.addrs`. On the other hand, if there are duplicates in `this.addrs` then there should also be the same duplicates in `that.addrs`, or else `equals` will not be symmetric, which it is required to be, and hence will be a bug: this.addrs.equals(that.addrs) != that.addrs.equals(this.addrs) So with that it mind, do you want me to change to what you proposed and see if the tests are still okay? ------------- PR Comment: https://git.openjdk.org/jdk/pull/14726#issuecomment-1614482760 From michaelm at openjdk.org Fri Jun 30 11:40:55 2023 From: michaelm at openjdk.org (Michael McMahon) Date: Fri, 30 Jun 2023 11:40:55 GMT Subject: RFR: 8311162: Simplify and modernize equals and hashCode for java.net In-Reply-To: References: Message-ID: On Fri, 30 Jun 2023 09:17:42 GMT, Pavel Rappo wrote: > Please review this PR to use modern APIs and language features to simplify `equals` and `hashCode` for the java.net package. > > Note, in NetworkInterface we could do even more and change this: > > for (InetAddress thisAddr : this.addrs) { > boolean found = false; > for (InetAddress thatAddr : that.addrs) { > if (thisAddr.equals(thatAddr)) { > found = true; > break; > } > } > if (!found) { > return false; > } > } > return true; > > to this: > > return Set.of(that.addrs).containsAll(Set.of(this.addrs)); > > But arguably, the first option is already better enough than what was there before. The change looks good to me, per the webrev ------------- Marked as reviewed by michaelm (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14726#pullrequestreview-1507034348 From msheppar at openjdk.org Fri Jun 30 12:02:53 2023 From: msheppar at openjdk.org (Mark Sheppard) Date: Fri, 30 Jun 2023 12:02:53 GMT Subject: RFR: 8311162: Simplify and modernize equals and hashCode for java.net In-Reply-To: References: Message-ID: On Fri, 30 Jun 2023 09:17:42 GMT, Pavel Rappo wrote: > Please review this PR to use modern APIs and language features to simplify `equals` and `hashCode` for the java.net package. > > Note, in NetworkInterface we could do even more and change this: > > for (InetAddress thisAddr : this.addrs) { > boolean found = false; > for (InetAddress thatAddr : that.addrs) { > if (thisAddr.equals(thatAddr)) { > found = true; > break; > } > } > if (!found) { > return false; > } > } > return true; > > to this: > > return Set.of(that.addrs).containsAll(Set.of(this.addrs)); > > But arguably, the first option is already better enough than what was there before. For NetworkInterface the non Set version is more straight forward and clearer, Set intersection is a little arcane Not sure it is possible to assign the same IP address multiple times to an interface, maybe an IPv6 with different scope ids? but I think not. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14726#issuecomment-1614551951 From prappo at openjdk.org Fri Jun 30 13:40:53 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Fri, 30 Jun 2023 13:40:53 GMT Subject: RFR: 8311162: Simplify and modernize equals and hashCode for java.net In-Reply-To: References: Message-ID: <002xkUP5nseijGfrJZIk8udJsdG2EvxNwaZgFYHP8J4=.37343a26-2fe6-4daa-ac05-6cb75c7b6a28@github.com> On Fri, 30 Jun 2023 12:00:03 GMT, Mark Sheppard wrote: > For NetworkInterface the non Set version is more straight forward and clearer, Set intersection is a little arcane > Not sure it is possible to assign the same IP address multiple times to an interface, maybe an IPv6 with different scope ids? but I think not. After eliminating indexes from the loops, they certainly look cleaner: prior to this change, the loops might have given an impression that there was some sort of element matching (correlating by index), which there wasn't. My personal rule of thumb is this: avoid indexing if it's only used to access the *next* element in the iteration. That said, I'm a bit surprised that you find set equality (not a subset test, but an equality test, as we discussed with @dfuch in this PR) to be more arcane than nested loops. Anyway, the testing has shown no issues, so unless there is anything else, I'll integrate it shortly. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14726#issuecomment-1614665912 From msheppar at openjdk.org Fri Jun 30 15:09:53 2023 From: msheppar at openjdk.org (Mark Sheppard) Date: Fri, 30 Jun 2023 15:09:53 GMT Subject: RFR: 8311162: Simplify and modernize equals and hashCode for java.net In-Reply-To: References: Message-ID: <9KePtgwhuJ9lQP128LHl_aiUkXhNyMRO4nmTeM4fCxc=.c200c9e3-a32b-4ab5-b2db-6b935da0a232@github.com> On Fri, 30 Jun 2023 09:17:42 GMT, Pavel Rappo wrote: > Please review this PR to use modern APIs and language features to simplify `equals` and `hashCode` for the java.net package. > > Note, in NetworkInterface we could do even more and change this: > > for (InetAddress thisAddr : this.addrs) { > boolean found = false; > for (InetAddress thatAddr : that.addrs) { > if (thisAddr.equals(thatAddr)) { > found = true; > break; > } > } > if (!found) { > return false; > } > } > return true; > > to this: > > return Set.of(that.addrs).containsAll(Set.of(this.addrs)); > > But arguably, the first option is already better enough than what was there before. right so, well that aside, one could consider the overhead in instantiating the Sets !! What also stands out wrt NetworkInterface::equals is a perceived anomaly that when available the MAC address is not considered part of the "equation" ------------- PR Comment: https://git.openjdk.org/jdk/pull/14726#issuecomment-1614792282 From msheppar at openjdk.org Fri Jun 30 15:16:54 2023 From: msheppar at openjdk.org (Mark Sheppard) Date: Fri, 30 Jun 2023 15:16:54 GMT Subject: RFR: 8311162: Simplify and modernize equals and hashCode for java.net In-Reply-To: References: Message-ID: On Fri, 30 Jun 2023 09:17:42 GMT, Pavel Rappo wrote: > Please review this PR to use modern APIs and language features to simplify `equals` and `hashCode` for the java.net package. > > Note, in NetworkInterface we could do even more and change this: > > for (InetAddress thisAddr : this.addrs) { > boolean found = false; > for (InetAddress thatAddr : that.addrs) { > if (thisAddr.equals(thatAddr)) { > found = true; > break; > } > } > if (!found) { > return false; > } > } > return true; > > to this: > > return Set.of(that.addrs).containsAll(Set.of(this.addrs)); > > But arguably, the first option is already better enough than what was there before. good job! ------------- Marked as reviewed by msheppar (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/14726#pullrequestreview-1507390128 From prappo at openjdk.org Fri Jun 30 15:21:06 2023 From: prappo at openjdk.org (Pavel Rappo) Date: Fri, 30 Jun 2023 15:21:06 GMT Subject: Integrated: 8311162: Simplify and modernize equals and hashCode for java.net In-Reply-To: References: Message-ID: On Fri, 30 Jun 2023 09:17:42 GMT, Pavel Rappo wrote: > Please review this PR to use modern APIs and language features to simplify `equals` and `hashCode` for the java.net package. > > Note, in NetworkInterface we could do even more and change this: > > for (InetAddress thisAddr : this.addrs) { > boolean found = false; > for (InetAddress thatAddr : that.addrs) { > if (thisAddr.equals(thatAddr)) { > found = true; > break; > } > } > if (!found) { > return false; > } > } > return true; > > to this: > > return Set.of(that.addrs).containsAll(Set.of(this.addrs)); > > But arguably, the first option is already better enough than what was there before. This pull request has now been integrated. Changeset: e3a7e020 Author: Pavel Rappo URL: https://git.openjdk.org/jdk/commit/e3a7e020d2d92e4eafe79b3ecebf31ec058bc48f Stats: 41 lines in 3 files changed: 10 ins; 18 del; 13 mod 8311162: Simplify and modernize equals and hashCode for java.net Reviewed-by: dfuchs, michaelm, msheppar ------------- PR: https://git.openjdk.org/jdk/pull/14726 From dcubed at openjdk.org Fri Jun 30 15:21:10 2023 From: dcubed at openjdk.org (Daniel D. Daugherty) Date: Fri, 30 Jun 2023 15:21:10 GMT Subject: RFR: 8311043: Remove trailing blank lines in source files In-Reply-To: References: Message-ID: <1HPsLLkrre-aTNkUCrJ2Os1Ba20NZW-s3bYL1nJU17Q=.47ea0d5b-f382-48a5-ba1b-957a003277d6@github.com> On Wed, 28 Jun 2023 16:54:51 GMT, Leo Korinth wrote: > Remove trailing "blank" lines in source files. > > I like to use global-whitespace-cleanup-mode, but I can not use it if the files are "dirty" to begin with. This fix will make more files "clean". I also considered adding a check for this in jcheck for Skara, however it seems jcheck code handling hunks does not track end-of-files. Thus I will only clean the files. > > The fix removes trailing lines matching ^[[:space:]]*$ in > > - *.java > - *.cpp > - *.hpp > - *.c > - *.h > > I have applied the following bash script to each file: > > file="$1" > > while [[ $(tail -n 1 "$file") =~ ^[[:space:]]*$ ]]; do > truncate -s -1 "$file" > done > > `git diff --ignore-space-change --ignore-blank-lines master` displays no changes > `git diff --ignore-blank-lines master` displays one change Ending the file with a blank line? I would not have expected that at all. I expect a single EOL at the end of the file; from a visual POV, the last line of non-blank text ends with an EOL. No more, no less. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14698#issuecomment-1614806396