From djelinski at openjdk.org Mon Oct 2 12:41:18 2023 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Mon, 2 Oct 2023 12:41:18 GMT Subject: RFR: 8317295: ResponseSubscribers.SubscriberAdapter should call the finisher function asynchronously [v3] In-Reply-To: <_YioCiyxOfObMfR8ZiRyQpiNrBL8Fw7T-y0jrsjVS6o=.d9626b36-f8bd-415b-80f5-0019c6bce7be@github.com> References: <_YioCiyxOfObMfR8ZiRyQpiNrBL8Fw7T-y0jrsjVS6o=.d9626b36-f8bd-415b-80f5-0019c6bce7be@github.com> Message-ID: On Fri, 29 Sep 2023 11:07:06 GMT, Daniel Fuchs wrote: >> The finisher function supplied to `BodySubscribers.fromSubscriber` is specified to be called when `onComplete()` is called on the `BodySubscriber`. However, this function contains application code that may involve blocking operations. Though this is technically a user error to block in any function supplied to the HttpClient API, the `ResponseSubscribers.SubscriberAdapter` should protect itself against this by calling the finisher asynchronously, in the fork join pool. > > Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: > > Update @bug LGTM. ------------- Marked as reviewed by djelinski (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/15981#pullrequestreview-1652656256 From dfuchs at openjdk.org Mon Oct 2 13:09:30 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Mon, 2 Oct 2023 13:09:30 GMT Subject: Integrated: 8317295: ResponseSubscribers.SubscriberAdapter should call the finisher function asynchronously In-Reply-To: References: Message-ID: <6pfN9abZbIzSuPwIBB3xAs7AnClIB3Xmk_Z1tUpzmWY=.f7112970-bd8c-47b6-934d-84e913f59063@github.com> On Fri, 29 Sep 2023 09:47:07 GMT, Daniel Fuchs wrote: > The finisher function supplied to `BodySubscribers.fromSubscriber` is specified to be called when `onComplete()` is called on the `BodySubscriber`. However, this function contains application code that may involve blocking operations. Though this is technically a user error to block in any function supplied to the HttpClient API, the `ResponseSubscribers.SubscriberAdapter` should protect itself against this by calling the finisher asynchronously, in the fork join pool. This pull request has now been integrated. Changeset: 8093563b Author: Daniel Fuchs URL: https://git.openjdk.org/jdk/commit/8093563bce03b2a7dcea175f1e71cfd67de1c235 Stats: 73 lines in 2 files changed: 61 ins; 0 del; 12 mod 8317295: ResponseSubscribers.SubscriberAdapter should call the finisher function asynchronously Reviewed-by: djelinski ------------- PR: https://git.openjdk.org/jdk/pull/15981 From dfuchs at openjdk.org Mon Oct 2 13:22:18 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Mon, 2 Oct 2023 13:22:18 GMT Subject: RFR: 8314978: Multiple server call from connection failing with expect100 in getOutputStream [v3] In-Reply-To: <021eKsRhWPLE9W-Sz8LLraBhnXE0iZ_QVm5p53iIOtU=.d7553b04-3b35-43eb-a39d-5bc53ca6e41e@github.com> References: <021eKsRhWPLE9W-Sz8LLraBhnXE0iZ_QVm5p53iIOtU=.d7553b04-3b35-43eb-a39d-5bc53ca6e41e@github.com> Message-ID: On Wed, 27 Sep 2023 10:55:46 GMT, Vyom Tewari wrote: >> With the current implementation of HttpURLConnection if server rejects the ?Expect 100-continue? then there will be ?java.net.ProtocolException? will be thrown from 'expect100Continue()' method. >> >> After the exception thrown, If we call any other method on the same instance (ex getHeaderField(), or getHeaderFields()). They will internally call getOuputStream() which invokes writeRequests(), which make the actual server call. >> >> The code change will sets the existing variable ?rememberedException? when there is exception and getOutputStream0() will re-throw ?rememberedException? if the ?rememberedException? is not null. >> >> Note: getOutputStream0() also call?s ?expect100Continue()? if ?expectContinue? is true. > > Vyom Tewari has updated the pull request incrementally with one additional commit since the last revision: > > Incorporated the review comments Changes requested by dfuchs (Reviewer). test/jdk/java/net/HttpURLConnection/HttpURLConnectionExpect100Test.java line 81: > 79: //send expect continue > 80: conn.setRequestProperty("Expect", "100-continue"); > 81: sendRequest(conn); Could you call `conn.getResponseCode()` after `sendRequest` here and assert that the returned code is the expected 417? test/jdk/java/net/HttpURLConnection/HttpURLConnectionExpect100Test.java line 82: > 80: conn.setRequestProperty("Expect", "100-continue"); > 81: sendRequest(conn); > 82: getHeaderField(conn); Could you call conn.getInputStream().readAllBytes() here to verify that it doesn't throw? Also verify that you get the expected 0 length result. test/jdk/java/net/HttpURLConnection/HttpURLConnectionExpect100Test.java line 97: > 95: conn.setRequestMethod("PUT"); > 96: sendRequest(conn); > 97: getHeaderField(conn); Same here - please add a line to verify that the response code is 200, and that the returned data is the expected RESPONSE. ------------- PR Review: https://git.openjdk.org/jdk/pull/15483#pullrequestreview-1652728826 PR Review Comment: https://git.openjdk.org/jdk/pull/15483#discussion_r1342679549 PR Review Comment: https://git.openjdk.org/jdk/pull/15483#discussion_r1342682738 PR Review Comment: https://git.openjdk.org/jdk/pull/15483#discussion_r1342684206 From duke at openjdk.org Tue Oct 3 10:02:36 2023 From: duke at openjdk.org (Glavo) Date: Tue, 3 Oct 2023 10:02:36 GMT Subject: RFR: 8317246: Cleanup java.net.URLEncoder and URLDecoder use of file.encoding property In-Reply-To: References: Message-ID: On Sat, 19 Aug 2023 09:05:47 GMT, Glavo wrote: > `DEFAULT_ENCODING_NAME ` in `URLEncoder` and `URLDecoder` can be replaced with `Charset.defaultCharset()`, which removes unnecessary static fields and avoid looking up charset when calling `URLDecoder.decode(String)` and `URLEncoder.encode(String)`. > > This PR is trivial, since `Charset.defaultCharset()` is also initialized with `StaticProperty.fileEncoding()`, this causes no change in behavior. > > Moreover, the javadoc of `URLDecoder.decode(String)` and `URLEncoder.encode(String)` say that they use the default charset, so this change is semantically consistent with the documentation. Can anyone sponsor this PR? ------------- PR Comment: https://git.openjdk.org/jdk/pull/15353#issuecomment-1744634351 From duke at openjdk.org Tue Oct 3 10:37:45 2023 From: duke at openjdk.org (Glavo) Date: Tue, 3 Oct 2023 10:37:45 GMT Subject: Integrated: 8317246: Cleanup java.net.URLEncoder and URLDecoder use of file.encoding property In-Reply-To: References: Message-ID: On Sat, 19 Aug 2023 09:05:47 GMT, Glavo wrote: > `DEFAULT_ENCODING_NAME ` in `URLEncoder` and `URLDecoder` can be replaced with `Charset.defaultCharset()`, which removes unnecessary static fields and avoid looking up charset when calling `URLDecoder.decode(String)` and `URLEncoder.encode(String)`. > > This PR is trivial, since `Charset.defaultCharset()` is also initialized with `StaticProperty.fileEncoding()`, this causes no change in behavior. > > Moreover, the javadoc of `URLDecoder.decode(String)` and `URLEncoder.encode(String)` say that they use the default charset, so this change is semantically consistent with the documentation. This pull request has now been integrated. Changeset: 3bcfac18 Author: Glavo Committer: Claes Redestad URL: https://git.openjdk.org/jdk/commit/3bcfac18c39d83bf876787e7ce422831bab0db2f Stats: 30 lines in 2 files changed: 0 ins; 27 del; 3 mod 8317246: Cleanup java.net.URLEncoder and URLDecoder use of file.encoding property Reviewed-by: rriggs, naoto ------------- PR: https://git.openjdk.org/jdk/pull/15353 From dfuchs at openjdk.org Tue Oct 3 11:22:46 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Tue, 3 Oct 2023 11:22:46 GMT Subject: RFR: 8317246: Cleanup java.net.URLEncoder and URLDecoder use of file.encoding property In-Reply-To: References: Message-ID: On Thu, 21 Sep 2023 10:09:23 GMT, Claes Redestad wrote: >> `DEFAULT_ENCODING_NAME ` in `URLEncoder` and `URLDecoder` can be replaced with `Charset.defaultCharset()`, which removes unnecessary static fields and avoid looking up charset when calling `URLDecoder.decode(String)` and `URLEncoder.encode(String)`. >> >> This PR is trivial, since `Charset.defaultCharset()` is also initialized with `StaticProperty.fileEncoding()`, this causes no change in behavior. >> >> Moreover, the javadoc of `URLDecoder.decode(String)` and `URLEncoder.encode(String)` say that they use the default charset, so this change is semantically consistent with the documentation. > > Right, this only affects deprecated methods, so it's unclear who'd benefit. A little less code and a couple of constants less is nice, I guess. I ran tests in our CI and observed no failures linked to this PR - I would have sponsored today but @cl4es beat me to it :-) ------------- PR Comment: https://git.openjdk.org/jdk/pull/15353#issuecomment-1744756279 From vtewari at openjdk.org Wed Oct 4 10:38:18 2023 From: vtewari at openjdk.org (Vyom Tewari) Date: Wed, 4 Oct 2023 10:38:18 GMT Subject: RFR: 8314978: Multiple server call from connection failing with expect100 in getOutputStream [v4] In-Reply-To: References: Message-ID: > With the current implementation of HttpURLConnection if server rejects the ?Expect 100-continue? then there will be ?java.net.ProtocolException? will be thrown from 'expect100Continue()' method. > > After the exception thrown, If we call any other method on the same instance (ex getHeaderField(), or getHeaderFields()). They will internally call getOuputStream() which invokes writeRequests(), which make the actual server call. > > The code change will sets the existing variable ?rememberedException? when there is exception and getOutputStream0() will re-throw ?rememberedException? if the ?rememberedException? is not null. > > Note: getOutputStream0() also call?s ?expect100Continue()? if ?expectContinue? is true. Vyom Tewari has updated the pull request incrementally with one additional commit since the last revision: addressed the review comment ------------- Changes: - all: https://git.openjdk.org/jdk/pull/15483/files - new: https://git.openjdk.org/jdk/pull/15483/files/5f6510aa..27280f61 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=15483&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=15483&range=02-03 Stats: 11 lines in 1 file changed: 9 ins; 2 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/15483.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/15483/head:pull/15483 PR: https://git.openjdk.org/jdk/pull/15483 From vtewari at openjdk.org Wed Oct 4 10:45:43 2023 From: vtewari at openjdk.org (Vyom Tewari) Date: Wed, 4 Oct 2023 10:45:43 GMT Subject: RFR: 8314978: Multiple server call from connection failing with expect100 in getOutputStream [v3] In-Reply-To: References: <021eKsRhWPLE9W-Sz8LLraBhnXE0iZ_QVm5p53iIOtU=.d7553b04-3b35-43eb-a39d-5bc53ca6e41e@github.com> Message-ID: On Mon, 2 Oct 2023 13:17:16 GMT, Daniel Fuchs wrote: >> Vyom Tewari has updated the pull request incrementally with one additional commit since the last revision: >> >> Incorporated the review comments > > test/jdk/java/net/HttpURLConnection/HttpURLConnectionExpect100Test.java line 82: > >> 80: conn.setRequestProperty("Expect", "100-continue"); >> 81: sendRequest(conn); >> 82: getHeaderField(conn); > > Could you call conn.getInputStream().readAllBytes() here to verify that it doesn't throw? Also verify that you get the expected 0 length result. As getInputStream calls > getInputStream0 > getOutputStream > getOutputStream0 > So if server rejected the operation then getInputStream will also throw the same exception. This behavior is same even without the fix. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15483#discussion_r1345587258 From dfuchs at openjdk.org Wed Oct 4 11:32:37 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Wed, 4 Oct 2023 11:32:37 GMT Subject: RFR: 8314978: Multiple server call from connection failing with expect100 in getOutputStream [v4] In-Reply-To: References: Message-ID: <4BAcIEPLhAmO0DZnWHdU32qJmjpWBMG06Kgw0JVNYJc=.a2dbb6a4-ab9b-4ea0-8856-587d9e7293fc@github.com> On Wed, 4 Oct 2023 10:38:18 GMT, Vyom Tewari wrote: >> With the current implementation of HttpURLConnection if server rejects the ?Expect 100-continue? then there will be ?java.net.ProtocolException? will be thrown from 'expect100Continue()' method. >> >> After the exception thrown, If we call any other method on the same instance (ex getHeaderField(), or getHeaderFields()). They will internally call getOuputStream() which invokes writeRequests(), which make the actual server call. >> >> The code change will sets the existing variable ?rememberedException? when there is exception and getOutputStream0() will re-throw ?rememberedException? if the ?rememberedException? is not null. >> >> Note: getOutputStream0() also call?s ?expect100Continue()? if ?expectContinue? is true. > > Vyom Tewari has updated the pull request incrementally with one additional commit since the last revision: > > addressed the review comment Thanks for the updates. Give me some time to test. ------------- PR Review: https://git.openjdk.org/jdk/pull/15483#pullrequestreview-1657304883 From aefimov at openjdk.org Wed Oct 4 16:56:43 2023 From: aefimov at openjdk.org (Aleksei Efimov) Date: Wed, 4 Oct 2023 16:56:43 GMT Subject: RFR: 8272215: Add InetAddress methods for parsing IP address literals [v2] In-Reply-To: References: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.e3b03591-2bca-44a1-805d-2cb1e4af30a1@github.com> Message-ID: <7QD5d3W6C1AowCi-cRVBuQnimo8nVf-atnudKTzPUK4=.9f67a3fc-629a-4085-8e98-fd556ddf226f@github.com> On Sat, 23 Sep 2023 17:28:55 GMT, Aleksei Efimov wrote: >> ### Summary >> >> The changes in this PR add new API to `java.net.InetAddress`, `java.net.Inet4Address`, and >> `java.net.Inet6Address` classes to parse IP address literals: >> ``` >> method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lang.String) >> method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) >> method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) >> ``` >> >> ### How new methods differ from existing ones >> >> These methods differ from `InetAddress.getByName` and `InetAddress.getAllByName` in the following ways: >> 1. If a string supplied is not an address literal it is not forwarded to the system-wide resolver, but IllegalArgumentException is thrown instead. The system-wide resolver is never called from these new methods. >> 2. No reverse lookup is performed to resolve a hostname for the supplied address literal - the `InetAddress[46 ]` instances returned by the new `ofLiteral` API has no hostname set. >> 3. Each `ofLiteral` static method returns addresses of its class only. It gives the ability to check if an IP address literal is of a specific address type. >> >> ### The list of noteworthy changes >> - `IPv4-mapped IPv6 address` and `IPv4-compatible IPv6 addresses` require some special handling in the new API to implement all supported IP address types. >> - All address literal parsing code has been moved from `InetAddress.getAllByName` to address type-specific `Inet4Address.parseAddressString` and `Inet6Address.parseAddressString` methods. >> - The text with scoped IPv6 addresses architecture draft IETF file has been replaced from `[draft-ietf-ipngwg-scoping-arch-04.txt]` to reference `RFC 4007: IPv6 Scoped Address Architecture`. The "RFC 4007" has been also added as `@ spec` into Inet6Address class-level Javadoc. >> >> ### Testing >> >> `jdk-tier1`, `jdk-tier2`, and `jdk-tier3` test sets show no failure with the changes. >> >> `java/net` JCK tests are failing with new methods added failure (CSR is planned for this change): >> >> Added Methods >> ------------- >> >> java.net.Inet4Address: method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) >> java.net.Inet6Address: method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) >> java.net.InetAddress: method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lan... > > Aleksei Efimov has updated the pull request incrementally with two additional commits since the last revision: > > - updates for Inet6Address.ofLiteral return type, javadoc and the regression test > - add null checks and NPE to methods javadoc To restart the conversation around the method name, I've prepared the following table with a list of method names discussed during the previous review iteration: | Name | Usage Example | Notes | |-------|--------------|-------| | `ofLiteral` | `InetAddress.ofLiteral` | Current version. Cleary conveys it takes only an IP literal. Matches its implementation. Good for IDE autocompletion. | | `parse` | `InetAddress.parse` | The fact that only IP address literals are taken as a parameter is obscured a bit. But still suggests that the InetAddress instance is constructed by parsing some text. Good for IDE.| | `parseLiteral` | `InetAddress.parseLiteral` | Method name changed to hint that an IP address literal is taken as a parameter. Good for IDE. Matches its implementation.| | `getByAddress` | `InetAddress.getByAddress` | Overrides existing method in InetAddress, but adds new method to Inet4Address and Inet6Address. Introduces new meaning of `address` term - IP address literal string. In existing API the `address` means a raw byte array.| My preference is to follow with one of the following two: `ofLiteral` or `parseLiteral`. ------------- PR Comment: https://git.openjdk.org/jdk/pull/15775#issuecomment-1747264766 From dfuchs at openjdk.org Wed Oct 4 16:57:03 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Wed, 4 Oct 2023 16:57:03 GMT Subject: RFR: 8314978: Multiple server call from connection failing with expect100 in getOutputStream [v4] In-Reply-To: References: Message-ID: On Wed, 4 Oct 2023 10:38:18 GMT, Vyom Tewari wrote: >> With the current implementation of HttpURLConnection if server rejects the ?Expect 100-continue? then there will be ?java.net.ProtocolException? will be thrown from 'expect100Continue()' method. >> >> After the exception thrown, If we call any other method on the same instance (ex getHeaderField(), or getHeaderFields()). They will internally call getOuputStream() which invokes writeRequests(), which make the actual server call. >> >> The code change will sets the existing variable ?rememberedException? when there is exception and getOutputStream0() will re-throw ?rememberedException? if the ?rememberedException? is not null. >> >> Note: getOutputStream0() also call?s ?expect100Continue()? if ?expectContinue? is true. > > Vyom Tewari has updated the pull request incrementally with one additional commit since the last revision: > > addressed the review comment Marked as reviewed by dfuchs (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/15483#pullrequestreview-1658085707 From dfuchs at openjdk.org Wed Oct 4 17:22:51 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Wed, 4 Oct 2023 17:22:51 GMT Subject: RFR: 8317522: Test logic for BODY_CF in AbstractThrowingSubscribers.java is wrong Message-ID: The `AbstractThrowingSubscribers.java` test class makes the assumption that the HttpClient will cancel a request if the body `CompletableFuture` returned by a `BodySubscriber::getBody` is completed exceptionally. This assumption is wrong. Indeed, it should be the responsibility of the custom subscriber to cancel its subscription, or not, in such a case, as whether to cancel or not depends on the semantic the subscriber assigns to such a body. The issue can be observed by modifying the test to send a longer response split in several chunks: with such a configuration, and using streaming body subscribers, such as `ofInputStream`, the test will fail waiting for the HttpClient to be garbaged collected, as the response data will not get pulled and the underlying exchange will never terminate. Though changing the HttpClient code to forcefully cancel the subscription (or the exchange) in such a case would "work", it does not seem desirable: it would introduce a change of behavior that might cause existing applications to fail, and there may be cases where a custom subscriber may legitimately want to complete its body CF exceptionally while still continuing to parse the body bytes. Whether to choose to cancel the subscription or not should solely depend on the logic of the custom subscriber. The test logic is now modified to reflect this. Commenting the line that cancels the subscription in `ThrowingBodySubscriber::getBody` would now make the test fail. The test was previously passing "by chance" because the whole response was contained in a single `DataFrame` (or `ByteBuffer` for HTTP/1.1). ------------- Commit messages: - 8317522 Changes: https://git.openjdk.org/jdk/pull/16041/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16041&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8317522 Stats: 82 lines in 1 file changed: 55 ins; 11 del; 16 mod Patch: https://git.openjdk.org/jdk/pull/16041.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/16041/head:pull/16041 PR: https://git.openjdk.org/jdk/pull/16041 From duke at openjdk.org Thu Oct 5 00:32:26 2023 From: duke at openjdk.org (=?UTF-8?B?5rip57uN6ZSm?=) Date: Thu, 5 Oct 2023 00:32:26 GMT Subject: RFR: 8316681: Rewrite URLEncoder.encode to use small reusable buffers [v6] In-Reply-To: <_s5aVyb4hZsEWAt9dhIuhPbjJHcJhq4yarhxYeiyWjY=.4ae72c48-4d1e-44f4-a30a-e6d1ba58a3cb@github.com> References: <_s5aVyb4hZsEWAt9dhIuhPbjJHcJhq4yarhxYeiyWjY=.4ae72c48-4d1e-44f4-a30a-e6d1ba58a3cb@github.com> Message-ID: On Fri, 22 Sep 2023 08:53:07 GMT, Claes Redestad wrote: >> `URLEncoder` currently appends chars that needs encoding into a `java.io.CharArrayWriter`, converts that to a `String`, uses `String::getBytes` to get the encoded bytes and then appends these bytes in a escaped manner to the output stream. This is somewhat inefficient. >> >> This PR replaces the `CharArrayWriter` with a reusable `CharBuffer` + `ByteBuffer` pair. This allows us to encode to the output `StringBuilder` in small chunks, with greatly reduced allocation as a result. >> >> The exact size of the buffers is an open question, but generally it seems that a tiny buffer wins by virtue of allocating less, and that the per chunk overheads are relatively small. > > Claes Redestad has updated the pull request incrementally with one additional commit since the last revision: > > Update src/java.base/share/classes/java/net/URLEncoder.java > > Co-authored-by: ExE Boss <3889017+ExE-Boss at users.noreply.github.com> URLEncoder#DONT_NEED_ENCODING based on BitSet is actually a lookup table. Should we consider improving it in this way? public class URLEncoder { static final long DONT_NEED_ENCODING_FLAGS_0; static final long DONT_NEED_ENCODING_FLAGS_1; static { long flag0 = 0; flag0 |= 1L << ' '; // ASCII 32 flag0 |= 1L << '*'; // ASCII 42 flag0 |= 1L << '-'; // ASCII 25 flag0 |= 1L << '.'; // ASCII 46 // ASCII 48 - 57 for (int i = '0'; i <= '9'; ++i) { flag0 |= 1L << i; } DONT_NEED_ENCODING_FLAGS_0 = flag0; long flags1 = 0; // ASCII 65 - 90 for (int i = 'A'; i <= 'Z'; ++i) { flags1 |= 1L << (i - 64); } flags1 |= 1L << ('_' - 64); // ASCII 95 // ASCII 97 - 122 for (int i = 'a'; i <= 'z'; ++i) { flags1 |= 1L << (i - 64); } DONT_NEED_ENCODING_FLAGS_1 = flags1; } private static boolean dontNeedEncoding(char c) { int prefix = c >> 6; if (prefix > 1) { return false; } long flags = prefix == 0 ? DONT_NEED_ENCODING_FLAGS_0 : DONT_NEED_ENCODING_FLAGS_1; return (flags & (1L << c)) != 0; } } ------------- PR Comment: https://git.openjdk.org/jdk/pull/15865#issuecomment-1747842588 From djelinski at openjdk.org Thu Oct 5 06:46:14 2023 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Thu, 5 Oct 2023 06:46:14 GMT Subject: RFR: 8317522: Test logic for BODY_CF in AbstractThrowingSubscribers.java is wrong In-Reply-To: References: Message-ID: <5Y9dk89w-1cwKBvtBffzS9loqUR_gSHeKT4MCISz5zY=.61a2e128-ea79-45d4-8b69-8856873a46ef@github.com> On Wed, 4 Oct 2023 17:14:01 GMT, Daniel Fuchs wrote: > The `AbstractThrowingSubscribers.java` test class makes the assumption that the HttpClient will cancel a request if the body `CompletableFuture` returned by a `BodySubscriber::getBody` is completed exceptionally. This assumption is wrong. Indeed, it should be the responsibility of the custom subscriber to cancel its subscription, or not, in such a case, as whether to cancel or not depends on the semantic the subscriber assigns to such a body. > > The issue can be observed by modifying the test to send a longer response split in several chunks: with such a configuration, and using streaming body subscribers, such as `ofInputStream`, the test will fail waiting for the HttpClient to be garbaged collected, as the response data will not get pulled and the underlying exchange will never terminate. Though changing the HttpClient code to forcefully cancel the subscription (or the exchange) in such a case would "work", it does not seem desirable: it would introduce a change of behavior that might cause existing applications to fail, and there may be cases where a custom subscriber may legitimately want to complete its body CF exceptionally while still continuing to parse the body bytes. Whether to choose to cancel the subscription or not should solely depend on the logic of the custom subscriber. > > The test logic is now modified to reflect this. Commenting the line that cancels the subscription in `ThrowingBodySubscriber::getBody` would now make the test fail. The test was previously passing "by chance" because the whole response was contained in a single `DataFrame` (or `ByteBuffer` for HTTP/1.1). LGTM. Thanks! ------------- Marked as reviewed by djelinski (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/16041#pullrequestreview-1658986061 From redestad at openjdk.org Thu Oct 5 07:50:22 2023 From: redestad at openjdk.org (Claes Redestad) Date: Thu, 5 Oct 2023 07:50:22 GMT Subject: RFR: 8316681: Rewrite URLEncoder.encode to use small reusable buffers [v6] In-Reply-To: <_s5aVyb4hZsEWAt9dhIuhPbjJHcJhq4yarhxYeiyWjY=.4ae72c48-4d1e-44f4-a30a-e6d1ba58a3cb@github.com> References: <_s5aVyb4hZsEWAt9dhIuhPbjJHcJhq4yarhxYeiyWjY=.4ae72c48-4d1e-44f4-a30a-e6d1ba58a3cb@github.com> Message-ID: On Fri, 22 Sep 2023 08:53:07 GMT, Claes Redestad wrote: >> `URLEncoder` currently appends chars that needs encoding into a `java.io.CharArrayWriter`, converts that to a `String`, uses `String::getBytes` to get the encoded bytes and then appends these bytes in a escaped manner to the output stream. This is somewhat inefficient. >> >> This PR replaces the `CharArrayWriter` with a reusable `CharBuffer` + `ByteBuffer` pair. This allows us to encode to the output `StringBuilder` in small chunks, with greatly reduced allocation as a result. >> >> The exact size of the buffers is an open question, but generally it seems that a tiny buffer wins by virtue of allocating less, and that the per chunk overheads are relatively small. > > Claes Redestad has updated the pull request incrementally with one additional commit since the last revision: > > Update src/java.base/share/classes/java/net/URLEncoder.java > > Co-authored-by: ExE Boss <3889017+ExE-Boss at users.noreply.github.com> How would this be an improvement? ------------- PR Comment: https://git.openjdk.org/jdk/pull/15865#issuecomment-1748302930 From dfuchs at openjdk.org Thu Oct 5 10:47:20 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Thu, 5 Oct 2023 10:47:20 GMT Subject: Integrated: 8317522: Test logic for BODY_CF in AbstractThrowingSubscribers.java is wrong In-Reply-To: References: Message-ID: On Wed, 4 Oct 2023 17:14:01 GMT, Daniel Fuchs wrote: > The `AbstractThrowingSubscribers.java` test class makes the assumption that the HttpClient will cancel a request if the body `CompletableFuture` returned by a `BodySubscriber::getBody` is completed exceptionally. This assumption is wrong. Indeed, it should be the responsibility of the custom subscriber to cancel its subscription, or not, in such a case, as whether to cancel or not depends on the semantic the subscriber assigns to such a body. > > The issue can be observed by modifying the test to send a longer response split in several chunks: with such a configuration, and using streaming body subscribers, such as `ofInputStream`, the test will fail waiting for the HttpClient to be garbaged collected, as the response data will not get pulled and the underlying exchange will never terminate. Though changing the HttpClient code to forcefully cancel the subscription (or the exchange) in such a case would "work", it does not seem desirable: it would introduce a change of behavior that might cause existing applications to fail, and there may be cases where a custom subscriber may legitimately want to complete its body CF exceptionally while still continuing to parse the body bytes. Whether to choose to cancel the subscription or not should solely depend on the logic of the custom subscriber. > > The test logic is now modified to reflect this. Commenting the line that cancels the subscription in `ThrowingBodySubscriber::getBody` would now make the test fail. The test was previously passing "by chance" because the whole response was contained in a single `DataFrame` (or `ByteBuffer` for HTTP/1.1). This pull request has now been integrated. Changeset: 4c5b66dc Author: Daniel Fuchs URL: https://git.openjdk.org/jdk/commit/4c5b66dceab15ce27f742c4173e14156249eb61a Stats: 82 lines in 1 file changed: 55 ins; 11 del; 16 mod 8317522: Test logic for BODY_CF in AbstractThrowingSubscribers.java is wrong Reviewed-by: djelinski ------------- PR: https://git.openjdk.org/jdk/pull/16041 From msheppar at openjdk.org Thu Oct 5 22:28:02 2023 From: msheppar at openjdk.org (Mark Sheppard) Date: Thu, 5 Oct 2023 22:28:02 GMT Subject: RFR: 8272215: Add InetAddress methods for parsing IP address literals [v2] In-Reply-To: References: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.e3b03591-2bca-44a1-805d-2cb1e4af30a1@github.com> Message-ID: <6K47JoJa4WnRfSm_G8wg8tFhD8pELEn7YwflND7JdyM=.62e64e76-fb85-43f7-8e45-909b677df873@github.com> On Sat, 23 Sep 2023 17:28:55 GMT, Aleksei Efimov wrote: >> ### Summary >> >> The changes in this PR add new API to `java.net.InetAddress`, `java.net.Inet4Address`, and >> `java.net.Inet6Address` classes to parse IP address literals: >> ``` >> method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lang.String) >> method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) >> method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) >> ``` >> >> ### How new methods differ from existing ones >> >> These methods differ from `InetAddress.getByName` and `InetAddress.getAllByName` in the following ways: >> 1. If a string supplied is not an address literal it is not forwarded to the system-wide resolver, but IllegalArgumentException is thrown instead. The system-wide resolver is never called from these new methods. >> 2. No reverse lookup is performed to resolve a hostname for the supplied address literal - the `InetAddress[46 ]` instances returned by the new `ofLiteral` API has no hostname set. >> 3. Each `ofLiteral` static method returns addresses of its class only. It gives the ability to check if an IP address literal is of a specific address type. >> >> ### The list of noteworthy changes >> - `IPv4-mapped IPv6 address` and `IPv4-compatible IPv6 addresses` require some special handling in the new API to implement all supported IP address types. >> - All address literal parsing code has been moved from `InetAddress.getAllByName` to address type-specific `Inet4Address.parseAddressString` and `Inet6Address.parseAddressString` methods. >> - The text with scoped IPv6 addresses architecture draft IETF file has been replaced from `[draft-ietf-ipngwg-scoping-arch-04.txt]` to reference `RFC 4007: IPv6 Scoped Address Architecture`. The "RFC 4007" has been also added as `@ spec` into Inet6Address class-level Javadoc. >> >> ### Testing >> >> `jdk-tier1`, `jdk-tier2`, and `jdk-tier3` test sets show no failure with the changes. >> >> `java/net` JCK tests are failing with new methods added failure (CSR is planned for this change): >> >> Added Methods >> ------------- >> >> java.net.Inet4Address: method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) >> java.net.Inet6Address: method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) >> java.net.InetAddress: method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lan... > > Aleksei Efimov has updated the pull request incrementally with two additional commits since the last revision: > > - updates for Inet6Address.ofLiteral return type, javadoc and the regression test > - add null checks and NPE to methods javadoc the most consistent (with the current API) and object oriented version is the getByAddress(String addr). It is consistent with the existing API. Logically getByAddress(byte[]) and getByAddress(String) are essentially the same. That is to say, a literal string representing an address is essentially the same as an array of bytes representing an address, as a String is an encapsulation of an array of bytes. As such it logically natural to add an overloaded method. Adding a new style of method affects the logical balance of the InetAddress class, giving a mongrel, or hybrid API appearance. Ceist agam ort: Why is it necessary that the subclasses Inet4Address and Inet6Address have an explicit public method for a getByAddress approach? Or have I misconstrued your statement: "Overrides existing method in InetAddress, but adds new method to Inet4Address and Inet6Address." ? But this is the case for the current "ofLiteral" solution presented in the PR, in that each of the derived classes Inet4Address and Inet6Address have added new static public methods. ------------- PR Comment: https://git.openjdk.org/jdk/pull/15775#issuecomment-1749739710 From aefimov at openjdk.org Fri Oct 6 11:17:48 2023 From: aefimov at openjdk.org (Aleksei Efimov) Date: Fri, 6 Oct 2023 11:17:48 GMT Subject: RFR: 8272215: Add InetAddress methods for parsing IP address literals [v2] In-Reply-To: <6K47JoJa4WnRfSm_G8wg8tFhD8pELEn7YwflND7JdyM=.62e64e76-fb85-43f7-8e45-909b677df873@github.com> References: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.e3b03591-2bca-44a1-805d-2cb1e4af30a1@github.com> <6K47JoJa4WnRfSm_G8wg8tFhD8pELEn7YwflND7JdyM=.62e64e76-fb85-43f7-8e45-909b677df873@github.com> Message-ID: On Thu, 5 Oct 2023 22:25:23 GMT, Mark Sheppard wrote: > That is to say, a literal string representing an address is essentially the same as an array of bytes representing an address A literal IP address string can specify the same address in [multiple formats](https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/net/InetAddress.html#textual-representation-of-ip-addresses-heading), a byte array supports only one - an array of bytes, with length equal to 4 for IPv4 addresses, and to 16 for IPv6 addresses. > Ceist agam ort: > Why is it necessary that the subclasses Inet4Address and Inet6Address have an explicit public method for a getByAddress approach? The idea of this change is to add three methods capable of parsing a string as an IPv4, IPv6 or any IP literal address. The explicit methods needs to be added to all three classes irrelevant to their naming. > Or have I misconstrued your statement: "Overrides existing method in InetAddress, but adds new method to Inet4Address and Inet6Address." ? > But this is the case for the current "ofLiteral" solution presented in the PR, in that each of the derived classes Inet4Address and Inet6Address have added new static public methods. You are right that the statement is a bit vague, yes. What was meant there that overloading `InetAddres` method, and adding new methods to `Inet4Address` and `Inet6Address` would introduce a bit confusing API structure. All three classes for both approaches would look like: ### ofLiteral approach // New methods InetAddress.ofLiteral(String) Inet4Address.ofLiteral(String) Inet6Address.ofLiteral(String) ### getByAddress approach // Existing methods with `address` being a byte array InetAddress.getByAddress(String, byte[]) InetAddress.getByAddress(byte[]) // New methods with `address` being a literal InetAddress.getByAddress(String) <-- overloaded method Inet4Address.getByAddress(String) <-- new and not overloaded method Inet6Address.getByAddress(String) <-- new and not overloaded method ------------- PR Comment: https://git.openjdk.org/jdk/pull/15775#issuecomment-1750435491 From duke at openjdk.org Fri Oct 6 18:45:20 2023 From: duke at openjdk.org (=?UTF-8?B?5rip57uN6ZSm?=) Date: Fri, 6 Oct 2023 18:45:20 GMT Subject: RFR: 8316681: Rewrite URLEncoder.encode to use small reusable buffers [v6] In-Reply-To: <_s5aVyb4hZsEWAt9dhIuhPbjJHcJhq4yarhxYeiyWjY=.4ae72c48-4d1e-44f4-a30a-e6d1ba58a3cb@github.com> References: <_s5aVyb4hZsEWAt9dhIuhPbjJHcJhq4yarhxYeiyWjY=.4ae72c48-4d1e-44f4-a30a-e6d1ba58a3cb@github.com> Message-ID: On Fri, 22 Sep 2023 08:53:07 GMT, Claes Redestad wrote: >> `URLEncoder` currently appends chars that needs encoding into a `java.io.CharArrayWriter`, converts that to a `String`, uses `String::getBytes` to get the encoded bytes and then appends these bytes in a escaped manner to the output stream. This is somewhat inefficient. >> >> This PR replaces the `CharArrayWriter` with a reusable `CharBuffer` + `ByteBuffer` pair. This allows us to encode to the output `StringBuilder` in small chunks, with greatly reduced allocation as a result. >> >> The exact size of the buffers is an open question, but generally it seems that a tiny buffer wins by virtue of allocating less, and that the per chunk overheads are relatively small. > > Claes Redestad has updated the pull request incrementally with one additional commit since the last revision: > > Update src/java.base/share/classes/java/net/URLEncoder.java > > Co-authored-by: ExE Boss <3889017+ExE-Boss at users.noreply.github.com> The improvement is about 3% to 13% under microbench. The baseline is based on BitSet table lookup. In real scenarios, the performance of the new version that does not use BitSet should be better. Performance numbers running on MacBook M1 Pro: -Benchmark (encodeChars) (maxLength) (unchanged) Mode Cnt Score Error Units (baseline) -URLEncodeDecode.testEncodeLatin1 6 1024 0 avgt 15 2.244 ? 0.290 ms/op -URLEncodeDecode.testEncodeLatin1 6 1024 75 avgt 15 0.956 ? 0.074 ms/op -URLEncodeDecode.testEncodeLatin1 6 1024 100 avgt 15 0.400 ? 0.006 ms/op +Benchmark (encodeChars) (maxLength) (unchanged) Mode Cnt Score Error Units (optimized) +URLEncodeDecode.testEncodeLatin1 6 1024 0 avgt 15 2.057 ? 0.016 ms/op (+9.10) +URLEncodeDecode.testEncodeLatin1 6 1024 75 avgt 15 0.842 ? 0.002 ms/op (+13.54) +URLEncodeDecode.testEncodeLatin1 6 1024 100 avgt 15 0.385 ? 0.001 ms/op (+3.90) ------------- PR Comment: https://git.openjdk.org/jdk/pull/15865#issuecomment-1751244288 From msheppar at openjdk.org Sat Oct 7 11:35:16 2023 From: msheppar at openjdk.org (Mark Sheppard) Date: Sat, 7 Oct 2023 11:35:16 GMT Subject: RFR: 8272215: Add InetAddress methods for parsing IP address literals [v2] In-Reply-To: References: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.e3b03591-2bca-44a1-805d-2cb1e4af30a1@github.com> Message-ID: On Sat, 23 Sep 2023 17:28:55 GMT, Aleksei Efimov wrote: >> ### Summary >> >> The changes in this PR add new API to `java.net.InetAddress`, `java.net.Inet4Address`, and >> `java.net.Inet6Address` classes to parse IP address literals: >> ``` >> method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lang.String) >> method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) >> method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) >> ``` >> >> ### How new methods differ from existing ones >> >> These methods differ from `InetAddress.getByName` and `InetAddress.getAllByName` in the following ways: >> 1. If a string supplied is not an address literal it is not forwarded to the system-wide resolver, but IllegalArgumentException is thrown instead. The system-wide resolver is never called from these new methods. >> 2. No reverse lookup is performed to resolve a hostname for the supplied address literal - the `InetAddress[46 ]` instances returned by the new `ofLiteral` API has no hostname set. >> 3. Each `ofLiteral` static method returns addresses of its class only. It gives the ability to check if an IP address literal is of a specific address type. >> >> ### The list of noteworthy changes >> - `IPv4-mapped IPv6 address` and `IPv4-compatible IPv6 addresses` require some special handling in the new API to implement all supported IP address types. >> - All address literal parsing code has been moved from `InetAddress.getAllByName` to address type-specific `Inet4Address.parseAddressString` and `Inet6Address.parseAddressString` methods. >> - The text with scoped IPv6 addresses architecture draft IETF file has been replaced from `[draft-ietf-ipngwg-scoping-arch-04.txt]` to reference `RFC 4007: IPv6 Scoped Address Architecture`. The "RFC 4007" has been also added as `@ spec` into Inet6Address class-level Javadoc. >> >> ### Testing >> >> `jdk-tier1`, `jdk-tier2`, and `jdk-tier3` test sets show no failure with the changes. >> >> `java/net` JCK tests are failing with new methods added failure (CSR is planned for this change): >> >> Added Methods >> ------------- >> >> java.net.Inet4Address: method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) >> java.net.Inet6Address: method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) >> java.net.InetAddress: method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lan... > > Aleksei Efimov has updated the pull request incrementally with two additional commits since the last revision: > > - updates for Inet6Address.ofLiteral return type, javadoc and the regression test > - add null checks and NPE to methods javadoc thanks for the considered response > > That is to say, a literal string representing an address is essentially the same as an array of bytes representing an address > > A literal IP address string can specify the same address in [multiple formats](https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/net/InetAddress.html#textual-representation-of-ip-addresses-heading), a byte array supports only one - an array of bytes, with length equal to 4 for IPv4 addresses, and to 16 for IPv6 addresses. I think you may have misinterpreted the point I was trying to make (or I didn't make it clearly enough), for example, a 4 byte array representing an IPv4 address is logically the same as a String representing an IPv4 address in dot notation. Thus, overloading getByAddress is a reasonable method to add and exhibits OO characteristics. > > > Ceist agam ort: > > Why is it necessary that the subclasses Inet4Address and Inet6Address have an explicit public method for a getByAddress approach? > > The idea of this change is to add three methods capable of parsing a string as an IPv4, IPv6 or any IP literal address. The explicit methods need to be added to all three classes irrelevant to their naming. > > > Or have I misconstrued your statement: "Overrides existing method in InetAddress, but adds new method to Inet4Address and Inet6Address." ? > > But this is the case for the current "ofLiteral" solution presented in the PR, in that each of the derived classes Inet4Address and Inet6Address have added new static public methods. > > You are right that the statement is a bit vague, yes. What was meant there was overloading the `InetAddress` method, and adding new methods to `Inet4Address` and `Inet6Address` would introduce a bit confusing API structure. All three classes for both approaches would look like: > ### ofLiteral approach > > ``` > // New methods > InetAddress.ofLiteral(String) > Inet4Address.ofLiteral(String) > Inet6Address.ofLiteral(String) > ``` > > ### getByAddress approach > > ``` > // Existing methods with `address` being a byte array > InetAddress.getByAddress(String, byte[]) > InetAddress.getByAddress(byte[]) > > // New methods with `address` being a literal > InetAddress.getByAddress(String) <-- overloaded method > Inet4Address.getByAddress(String) <-- new and not overloaded method > Inet6Address.getByAddress(String) <-- new and not overloaded method > ``` There's no need to add these methods, Inet4Address.getByAddress(String) <-- new and not overloaded method Inet6Address.getByAddress(String) <-- new and not overloaded method to the derived classes. The functionality can be fully provided by the overloaded (static) getByAddress in the base InetAddress class ------------- PR Comment: https://git.openjdk.org/jdk/pull/15775#issuecomment-1751688344 From alanb at openjdk.org Sat Oct 7 12:04:09 2023 From: alanb at openjdk.org (Alan Bateman) Date: Sat, 7 Oct 2023 12:04:09 GMT Subject: RFR: 8272215: Add InetAddress methods for parsing IP address literals [v2] In-Reply-To: References: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.e3b03591-2bca-44a1-805d-2cb1e4af30a1@github.com> Message-ID: On Sat, 7 Oct 2023 11:32:43 GMT, Mark Sheppard wrote: > The functionality can be fully provided by the overloaded (static) getByAddress in the base InetAddress class I don't think I agree with this. The existing 2-arg getByAddress method takes a string that is a host name or string representation of an IP address. It can be argued that it was a mistake to allow it accept IP literal addresses but it can't be changed. Same thing with the UHE thrown by both getByAddress methods but that can't be changed either. The new factory methods have a very clear purpose to create an InetAddress from the string representation of an IP literal address. The proposed name ofLiteral is readable/clear and consistent with the naming of other static factory methods added to the APIs in recent years. The goal here is to add methods to parse IP address literals. ------------- PR Comment: https://git.openjdk.org/jdk/pull/15775#issuecomment-1751693706 From msheppar at openjdk.org Sat Oct 7 13:30:17 2023 From: msheppar at openjdk.org (Mark Sheppard) Date: Sat, 7 Oct 2023 13:30:17 GMT Subject: RFR: 8272215: Add InetAddress methods for parsing IP address literals [v2] In-Reply-To: References: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.e3b03591-2bca-44a1-805d-2cb1e4af30a1@github.com> Message-ID: On Sat, 7 Oct 2023 12:01:25 GMT, Alan Bateman wrote: > > The functionality can be fully provided by the overloaded (static) getByAddress in the base InetAddress class > > I don't think I agree with this. The existing 2-arg getByAddress method takes a string that is a host name or string representation of an IP address. It can be argued that it was a mistake to allow it accept IP literal addresses but it can't be changed. Same thing with the UHE thrown by both getByAddress methods but that can't be changed either. > The sentence should have read "The functionality can be fully provided by adding an overloaded (static) getByAddress in the base InetAddress class, only." I wasn't suggesting that the current API was providing the requested functionality. you may have misinterpreted what I'm saying. The requested functionality can be provided by an overloaded getByAddress method to the InetAddress , and that is sufficient. As such, there is no need for additional method in the Inet4Address or Inet6Address > The new factory methods have a very clear purpose to create an InetAddress from the string representation of an IP literal address. The proposed name ofLiteral is readable/clear and consistent with the naming of other static factory methods added to the APIs in recent years. For me, it is not consistent with the well esatblished InetAddress API (getByName, getByAddress), in which case the ofLiteral style looks like a bit of a wart. Adding an overloaded getByAddress method is a logical OO design approach. You seem to be intent on adding this "ofXXX" style methods. So we'll just have to agree to disagree on this. ------------- PR Comment: https://git.openjdk.org/jdk/pull/15775#issuecomment-1751713257 From jkratochvil at openjdk.org Sat Oct 7 16:33:38 2023 From: jkratochvil at openjdk.org (Jan Kratochvil) Date: Sat, 7 Oct 2023 16:33:38 GMT Subject: RFR: 8317696: Fix compilation with clang-16 Message-ID: 8317696: Fix compilation with clang-16 ------------- Commit messages: - 8317696: Fix compilation with clang-16 Changes: https://git.openjdk.org/jdk/pull/16092/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16092&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8317696 Stats: 17 lines in 4 files changed: 0 ins; 0 del; 17 mod Patch: https://git.openjdk.org/jdk/pull/16092.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/16092/head:pull/16092 PR: https://git.openjdk.org/jdk/pull/16092 From jiefu at openjdk.org Sun Oct 8 01:42:37 2023 From: jiefu at openjdk.org (Jie Fu) Date: Sun, 8 Oct 2023 01:42:37 GMT Subject: RFR: 8317698: Optimization for URLEncoder In-Reply-To: References: Message-ID: On Fri, 6 Oct 2023 20:55:40 GMT, ??? wrote: > @cl4es and @Glavo have already made some very good optimizations to URLEncoder, but we can continue to improve. > > The current URLEncoder's Predicate for DONT_NEED_ENCODING is based on BitSet, which is actually a table lookup. The actual performance may not be as good as microbench. > > The character value range of DONT_NEED_ENCODING is between [45-122]. We can construct two long type constants to do the work of BitSet. This can improve performance by about 7% to 30%. JBS: https://bugs.openjdk.org/browse/JDK-8317698 ------------- PR Comment: https://git.openjdk.org/jdk/pull/16082#issuecomment-1751882784 From vtewari at openjdk.org Sun Oct 8 05:16:22 2023 From: vtewari at openjdk.org (Vyom Tewari) Date: Sun, 8 Oct 2023 05:16:22 GMT Subject: Integrated: 8314978: Multiple server call from connection failing with expect100 in getOutputStream In-Reply-To: References: Message-ID: On Wed, 30 Aug 2023 09:23:34 GMT, Vyom Tewari wrote: > With the current implementation of HttpURLConnection if server rejects the ?Expect 100-continue? then there will be ?java.net.ProtocolException? will be thrown from 'expect100Continue()' method. > > After the exception thrown, If we call any other method on the same instance (ex getHeaderField(), or getHeaderFields()). They will internally call getOuputStream() which invokes writeRequests(), which make the actual server call. > > The code change will sets the existing variable ?rememberedException? when there is exception and getOutputStream0() will re-throw ?rememberedException? if the ?rememberedException? is not null. > > Note: getOutputStream0() also call?s ?expect100Continue()? if ?expectContinue? is true. This pull request has now been integrated. Changeset: 460ebcd9 Author: Vyom Tewari URL: https://git.openjdk.org/jdk/commit/460ebcd9cb94867608e22e07092bd1cf33228700 Stats: 268 lines in 2 files changed: 268 ins; 0 del; 0 mod 8314978: Multiple server call from connection failing with expect100 in getOutputStream Reviewed-by: dfuchs ------------- PR: https://git.openjdk.org/jdk/pull/15483 From redestad at openjdk.org Sun Oct 8 20:38:13 2023 From: redestad at openjdk.org (Claes Redestad) Date: Sun, 8 Oct 2023 20:38:13 GMT Subject: RFR: 8317698: Optimization for URLEncoder In-Reply-To: References: Message-ID: On Fri, 6 Oct 2023 20:55:40 GMT, ??? wrote: > @cl4es and @Glavo have already made some very good optimizations to URLEncoder, but we can continue to improve. > > The current URLEncoder's Predicate for DONT_NEED_ENCODING is based on BitSet, which is actually a table lookup. The actual performance may not be as good as microbench. > > The character value range of DONT_NEED_ENCODING is between [45-122]. We can construct two long type constants to do the work of BitSet. This can improve performance by about 7% to 30%. I think this is a step in the wrong direction, duplicating code from a shared utility class in order to get a marginal improvement. Could you instead analyze *why* this is a win and then see if we can improve the utility class (`ImmutableBitSetPredicate`) instead? ------------- PR Comment: https://git.openjdk.org/jdk/pull/16082#issuecomment-1752155763 From redestad at openjdk.org Sun Oct 8 21:17:03 2023 From: redestad at openjdk.org (Claes Redestad) Date: Sun, 8 Oct 2023 21:17:03 GMT Subject: RFR: 8317698: Optimization for URLEncoder In-Reply-To: References: Message-ID: On Fri, 6 Oct 2023 20:55:40 GMT, ??? wrote: > @cl4es and @Glavo have already made some very good optimizations to URLEncoder, but we can continue to improve. > > The current URLEncoder's Predicate for DONT_NEED_ENCODING is based on BitSet, which is actually a table lookup. The actual performance may not be as good as microbench. > > The character value range of DONT_NEED_ENCODING is between [45-122]. We can construct two long type constants to do the work of BitSet. This can improve performance by about 7% to 30%. I drafted a PR that pulls off more or less the same optimization but does so by adding a variant to `ImmutableBitSetPredicate`. This ensures other `BitSet`-based predicates of 128 elements or less would get the similar benefit, and better contains the added complexity. ------------- PR Comment: https://git.openjdk.org/jdk/pull/16082#issuecomment-1752163233 From duke at openjdk.org Mon Oct 9 03:00:24 2023 From: duke at openjdk.org (=?UTF-8?B?5rip57uN6ZSm?=) Date: Mon, 9 Oct 2023 03:00:24 GMT Subject: RFR: 8317698: Optimization for URLEncoder In-Reply-To: References: Message-ID: On Fri, 6 Oct 2023 20:55:40 GMT, ??? wrote: > @cl4es and @Glavo have already made some very good optimizations to URLEncoder, but we can continue to improve. > > The current URLEncoder's Predicate for DONT_NEED_ENCODING is based on BitSet, which is actually a table lookup. The actual performance may not be as good as microbench. > > The character value range of DONT_NEED_ENCODING is between [45-122]. We can construct two long type constants to do the work of BitSet. This can improve performance by about 7% to 30%. My problem is that ImmutableBitSetPredicate as a jdk.internal class is only used in URLEncoder ------------- PR Comment: https://git.openjdk.org/jdk/pull/16082#issuecomment-1752280940 From alanb at openjdk.org Mon Oct 9 06:33:09 2023 From: alanb at openjdk.org (Alan Bateman) Date: Mon, 9 Oct 2023 06:33:09 GMT Subject: RFR: 8272215: Add InetAddress methods for parsing IP address literals [v2] In-Reply-To: References: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.e3b03591-2bca-44a1-805d-2cb1e4af30a1@github.com> Message-ID: On Sat, 7 Oct 2023 13:27:45 GMT, Mark Sheppard wrote: > The sentence should have read "The functionality can be fully provided by adding an overloaded (static) getByAddress in the base InetAddress class, only." > > I wasn't suggesting that the current API was providing the requested functionality. you may have misinterpreted what I'm saying. The requested functionality can be provided by an overloaded getByAddress method to the InetAddress , and that is sufficient. As such, there is no need for additional method in the Inet4Address or Inet6Address The existing naming in InetAddress comes with baggage. The getByXXX method suggests lookup, they throw UHE. The getByAddress methods take a byte[], the input is bytes. The String parameter for the 2-arg getByAddress is intended to be a host name. I don't think the new static factory methods should be burdened with all this baggage so move to a methods that are clear/obvious/readable seems a much better route. We can bikeshed over specific name but the ofXXX convention is something that many areas of the platform has adopted in recent years. ------------- PR Comment: https://git.openjdk.org/jdk/pull/15775#issuecomment-1752413273 From jpai at openjdk.org Mon Oct 9 07:03:11 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Mon, 9 Oct 2023 07:03:11 GMT Subject: RFR: 8272215: Add InetAddress methods for parsing IP address literals [v2] In-Reply-To: References: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.e3b03591-2bca-44a1-805d-2cb1e4af30a1@github.com> Message-ID: On Sat, 23 Sep 2023 17:28:55 GMT, Aleksei Efimov wrote: >> ### Summary >> >> The changes in this PR add new API to `java.net.InetAddress`, `java.net.Inet4Address`, and >> `java.net.Inet6Address` classes to parse IP address literals: >> ``` >> method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lang.String) >> method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) >> method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) >> ``` >> >> ### How new methods differ from existing ones >> >> These methods differ from `InetAddress.getByName` and `InetAddress.getAllByName` in the following ways: >> 1. If a string supplied is not an address literal it is not forwarded to the system-wide resolver, but IllegalArgumentException is thrown instead. The system-wide resolver is never called from these new methods. >> 2. No reverse lookup is performed to resolve a hostname for the supplied address literal - the `InetAddress[46 ]` instances returned by the new `ofLiteral` API has no hostname set. >> 3. Each `ofLiteral` static method returns addresses of its class only. It gives the ability to check if an IP address literal is of a specific address type. >> >> ### The list of noteworthy changes >> - `IPv4-mapped IPv6 address` and `IPv4-compatible IPv6 addresses` require some special handling in the new API to implement all supported IP address types. >> - All address literal parsing code has been moved from `InetAddress.getAllByName` to address type-specific `Inet4Address.parseAddressString` and `Inet6Address.parseAddressString` methods. >> - The text with scoped IPv6 addresses architecture draft IETF file has been replaced from `[draft-ietf-ipngwg-scoping-arch-04.txt]` to reference `RFC 4007: IPv6 Scoped Address Architecture`. The "RFC 4007" has been also added as `@ spec` into Inet6Address class-level Javadoc. >> >> ### Testing >> >> `jdk-tier1`, `jdk-tier2`, and `jdk-tier3` test sets show no failure with the changes. >> >> `java/net` JCK tests are failing with new methods added failure (CSR is planned for this change): >> >> Added Methods >> ------------- >> >> java.net.Inet4Address: method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) >> java.net.Inet6Address: method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) >> java.net.InetAddress: method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lan... > > Aleksei Efimov has updated the pull request incrementally with two additional commits since the last revision: > > - updates for Inet6Address.ofLiteral return type, javadoc and the regression test > - add null checks and NPE to methods javadoc Hello Aleksei, it's good to see the addition of these new APIs. On the naming front, I like the proposal of using either `ofLiteral` or `parseLiteral`. The new APIs are proposing to throw an `IllegalArgumentException` if the passed literal is not an IP address literal. That seems logical. However, the existing `getByAddress(byte[] ...)` API which accepts a byte form of the raw IP address, currently throws `UnknownHostException` in the case where the IP address isn't of a valid length. Should we consider throwing `UnknownHostException` from these new APIs too? I prefer `IllegalArgumentException` in these new APIs, but `UnknownHostException` might be something that would need to be considered? The proposed changes also have text which talks about "ambiguous" address literals. The term ambiguous seems new in the InetAddress (and sub-classes). The package-info.java too doesn't have previous references to it. Should we add some details on what addresses are considered ambiguous (and how/if such addresses are treated by existing APIs)? ------------- PR Comment: https://git.openjdk.org/jdk/pull/15775#issuecomment-1752441558 From jpai at openjdk.org Mon Oct 9 07:12:11 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Mon, 9 Oct 2023 07:12:11 GMT Subject: RFR: 8272215: Add InetAddress methods for parsing IP address literals [v2] In-Reply-To: References: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.e3b03591-2bca-44a1-805d-2cb1e4af30a1@github.com> Message-ID: On Sat, 23 Sep 2023 17:28:55 GMT, Aleksei Efimov wrote: >> ### Summary >> >> The changes in this PR add new API to `java.net.InetAddress`, `java.net.Inet4Address`, and >> `java.net.Inet6Address` classes to parse IP address literals: >> ``` >> method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lang.String) >> method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) >> method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) >> ``` >> >> ### How new methods differ from existing ones >> >> These methods differ from `InetAddress.getByName` and `InetAddress.getAllByName` in the following ways: >> 1. If a string supplied is not an address literal it is not forwarded to the system-wide resolver, but IllegalArgumentException is thrown instead. The system-wide resolver is never called from these new methods. >> 2. No reverse lookup is performed to resolve a hostname for the supplied address literal - the `InetAddress[46 ]` instances returned by the new `ofLiteral` API has no hostname set. >> 3. Each `ofLiteral` static method returns addresses of its class only. It gives the ability to check if an IP address literal is of a specific address type. >> >> ### The list of noteworthy changes >> - `IPv4-mapped IPv6 address` and `IPv4-compatible IPv6 addresses` require some special handling in the new API to implement all supported IP address types. >> - All address literal parsing code has been moved from `InetAddress.getAllByName` to address type-specific `Inet4Address.parseAddressString` and `Inet6Address.parseAddressString` methods. >> - The text with scoped IPv6 addresses architecture draft IETF file has been replaced from `[draft-ietf-ipngwg-scoping-arch-04.txt]` to reference `RFC 4007: IPv6 Scoped Address Architecture`. The "RFC 4007" has been also added as `@ spec` into Inet6Address class-level Javadoc. >> >> ### Testing >> >> `jdk-tier1`, `jdk-tier2`, and `jdk-tier3` test sets show no failure with the changes. >> >> `java/net` JCK tests are failing with new methods added failure (CSR is planned for this change): >> >> Added Methods >> ------------- >> >> java.net.Inet4Address: method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) >> java.net.Inet6Address: method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) >> java.net.InetAddress: method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lan... > > Aleksei Efimov has updated the pull request incrementally with two additional commits since the last revision: > > - updates for Inet6Address.ofLiteral return type, javadoc and the regression test > - add null checks and NPE to methods javadoc src/java.base/share/classes/sun/net/util/IPAddressUtil.java line 135: > 133: * to {@code false}, or is not set then validation of the address string is performed as follows: > 134: * If string can't be parsed by following IETF IPv4 address string literals > 135: * formatting style rules (default one), but can be parsed by following BSD formatting I realize that this is an existing javadoc comment in an internal utility class (which is used by public InetAddress API implementation); do you think we should add a more formal reference to the BSD formatting of IP address, like we currently do for other RFCs and such in the class level javadoc of `InetAddress`? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15775#discussion_r1349926001 From alanb at openjdk.org Mon Oct 9 07:15:09 2023 From: alanb at openjdk.org (Alan Bateman) Date: Mon, 9 Oct 2023 07:15:09 GMT Subject: RFR: 8272215: Add InetAddress methods for parsing IP address literals [v2] In-Reply-To: References: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.e3b03591-2bca-44a1-805d-2cb1e4af30a1@github.com> Message-ID: <3jfTVsFV-rv9zswqZJbE0FoPWo_W5LZ8PYv1aW7PGws=.0f52484b-060f-4a62-8b3f-c674b847a2f6@github.com> On Mon, 9 Oct 2023 07:00:08 GMT, Jaikiran Pai wrote: > The new APIs are proposing to throw an `IllegalArgumentException` if the passed literal is not an IP address literal. That seems logical. However, the existing `getByAddress(byte[] ...)` API which accepts a byte form of the raw IP address, currently throws `UnknownHostException` in the case where the IP address isn't of a valid length. Should we consider throwing `UnknownHostException` from these new APIs too? I prefer `IllegalArgumentException` in these new APIs, but `UnknownHostException` might be something that would need to be considered? UHE is an IOException so would be problematic for a number of reasons. IAE is the right exception for bad input here. ------------- PR Comment: https://git.openjdk.org/jdk/pull/15775#issuecomment-1752455199 From jpai at openjdk.org Mon Oct 9 07:15:12 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Mon, 9 Oct 2023 07:15:12 GMT Subject: RFR: 8272215: Add InetAddress methods for parsing IP address literals [v2] In-Reply-To: References: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.e3b03591-2bca-44a1-805d-2cb1e4af30a1@github.com> Message-ID: On Sat, 23 Sep 2023 17:28:55 GMT, Aleksei Efimov wrote: >> ### Summary >> >> The changes in this PR add new API to `java.net.InetAddress`, `java.net.Inet4Address`, and >> `java.net.Inet6Address` classes to parse IP address literals: >> ``` >> method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lang.String) >> method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) >> method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) >> ``` >> >> ### How new methods differ from existing ones >> >> These methods differ from `InetAddress.getByName` and `InetAddress.getAllByName` in the following ways: >> 1. If a string supplied is not an address literal it is not forwarded to the system-wide resolver, but IllegalArgumentException is thrown instead. The system-wide resolver is never called from these new methods. >> 2. No reverse lookup is performed to resolve a hostname for the supplied address literal - the `InetAddress[46 ]` instances returned by the new `ofLiteral` API has no hostname set. >> 3. Each `ofLiteral` static method returns addresses of its class only. It gives the ability to check if an IP address literal is of a specific address type. >> >> ### The list of noteworthy changes >> - `IPv4-mapped IPv6 address` and `IPv4-compatible IPv6 addresses` require some special handling in the new API to implement all supported IP address types. >> - All address literal parsing code has been moved from `InetAddress.getAllByName` to address type-specific `Inet4Address.parseAddressString` and `Inet6Address.parseAddressString` methods. >> - The text with scoped IPv6 addresses architecture draft IETF file has been replaced from `[draft-ietf-ipngwg-scoping-arch-04.txt]` to reference `RFC 4007: IPv6 Scoped Address Architecture`. The "RFC 4007" has been also added as `@ spec` into Inet6Address class-level Javadoc. >> >> ### Testing >> >> `jdk-tier1`, `jdk-tier2`, and `jdk-tier3` test sets show no failure with the changes. >> >> `java/net` JCK tests are failing with new methods added failure (CSR is planned for this change): >> >> Added Methods >> ------------- >> >> java.net.Inet4Address: method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) >> java.net.Inet6Address: method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) >> java.net.InetAddress: method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lan... > > Aleksei Efimov has updated the pull request incrementally with two additional commits since the last revision: > > - updates for Inet6Address.ofLiteral return type, javadoc and the regression test > - add null checks and NPE to methods javadoc src/java.base/share/classes/java/net/Inet4Address.java line 181: > 179: /** > 180: * Parses string with an IPv4 address literal. > 181: * If string doesn't contain a valid literal - null is returned. This sentence is a bit confusing, given the implementation details of this method. I think `null` is only returned if `throwIAE` is false? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15775#discussion_r1349928593 From jpai at openjdk.org Mon Oct 9 07:19:11 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Mon, 9 Oct 2023 07:19:11 GMT Subject: RFR: 8272215: Add InetAddress methods for parsing IP address literals [v2] In-Reply-To: References: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.e3b03591-2bca-44a1-805d-2cb1e4af30a1@github.com> Message-ID: On Sat, 23 Sep 2023 17:28:55 GMT, Aleksei Efimov wrote: >> ### Summary >> >> The changes in this PR add new API to `java.net.InetAddress`, `java.net.Inet4Address`, and >> `java.net.Inet6Address` classes to parse IP address literals: >> ``` >> method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lang.String) >> method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) >> method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) >> ``` >> >> ### How new methods differ from existing ones >> >> These methods differ from `InetAddress.getByName` and `InetAddress.getAllByName` in the following ways: >> 1. If a string supplied is not an address literal it is not forwarded to the system-wide resolver, but IllegalArgumentException is thrown instead. The system-wide resolver is never called from these new methods. >> 2. No reverse lookup is performed to resolve a hostname for the supplied address literal - the `InetAddress[46 ]` instances returned by the new `ofLiteral` API has no hostname set. >> 3. Each `ofLiteral` static method returns addresses of its class only. It gives the ability to check if an IP address literal is of a specific address type. >> >> ### The list of noteworthy changes >> - `IPv4-mapped IPv6 address` and `IPv4-compatible IPv6 addresses` require some special handling in the new API to implement all supported IP address types. >> - All address literal parsing code has been moved from `InetAddress.getAllByName` to address type-specific `Inet4Address.parseAddressString` and `Inet6Address.parseAddressString` methods. >> - The text with scoped IPv6 addresses architecture draft IETF file has been replaced from `[draft-ietf-ipngwg-scoping-arch-04.txt]` to reference `RFC 4007: IPv6 Scoped Address Architecture`. The "RFC 4007" has been also added as `@ spec` into Inet6Address class-level Javadoc. >> >> ### Testing >> >> `jdk-tier1`, `jdk-tier2`, and `jdk-tier3` test sets show no failure with the changes. >> >> `java/net` JCK tests are failing with new methods added failure (CSR is planned for this change): >> >> Added Methods >> ------------- >> >> java.net.Inet4Address: method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) >> java.net.Inet6Address: method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) >> java.net.InetAddress: method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lan... > > Aleksei Efimov has updated the pull request incrementally with two additional commits since the last revision: > > - updates for Inet6Address.ofLiteral return type, javadoc and the regression test > - add null checks and NPE to methods javadoc src/java.base/share/classes/sun/net/util/IPAddressUtil.java line 141: > 139: * @param src input string > 140: * @param throwIAE {@code "true"} - throw {@code IllegalArgumentException} when cannot be parsed as IPv4 address string; > 141: * {@code "false"} - throw {@code "IllegalArgumentException"} only when IPv4 address string is ambiguous. Are these double quotes around `true`, `false`, `null` and `IllegalArgumentException` intentional? It seems odd to have those double quotes when (rightly) using `{@code}`. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15775#discussion_r1349930995 From redestad at openjdk.org Mon Oct 9 08:05:09 2023 From: redestad at openjdk.org (Claes Redestad) Date: Mon, 9 Oct 2023 08:05:09 GMT Subject: RFR: 8317698: Optimization for URLEncoder In-Reply-To: References: Message-ID: On Fri, 6 Oct 2023 20:55:40 GMT, ??? wrote: > @cl4es and @Glavo have already made some very good optimizations to URLEncoder, but we can continue to improve. > > The current URLEncoder's Predicate for DONT_NEED_ENCODING is based on BitSet, which is actually a table lookup. The actual performance may not be as good as microbench. > > The character value range of DONT_NEED_ENCODING is between [45-122]. We can construct two long type constants to do the work of BitSet. This can improve performance by about 7% to 30%. It was recently conceived specifically to help `URLEncoder`, and it was implemented as an internal utility to give it time to mature/evolve and to make the decision to turn it into a public API independent from getting a quick win on JDK-internal code. It seems natural and logical that we keep improving this abstraction rather than manually inline the logic into `URLEncoder`. ------------- PR Comment: https://git.openjdk.org/jdk/pull/16082#issuecomment-1752517839 From duke at openjdk.org Mon Oct 9 10:02:01 2023 From: duke at openjdk.org (=?UTF-8?B?5rip57uN6ZSm?=) Date: Mon, 9 Oct 2023 10:02:01 GMT Subject: RFR: 8317698: Optimization for URLEncoder In-Reply-To: References: Message-ID: <4r2InWqpRO344uCssw5sJzEJbkCBxVsEBAxai5iz1eo=.2981f83e-0b34-4096-9046-0b18c899a139@github.com> On Fri, 6 Oct 2023 20:55:40 GMT, ??? wrote: > @cl4es and @Glavo have already made some very good optimizations to URLEncoder, but we can continue to improve. > > The current URLEncoder's Predicate for DONT_NEED_ENCODING is based on BitSet, which is actually a table lookup. The actual performance may not be as good as microbench. > > The character value range of DONT_NEED_ENCODING is between [45-122]. We can construct two long type constants to do the work of BitSet. This can improve performance by about 7% to 30%. Can we find another use case of ImmutableBitSetPredicate in java.base? ------------- PR Comment: https://git.openjdk.org/jdk/pull/16082#issuecomment-1752622026 From ccleary at openjdk.org Mon Oct 9 10:22:39 2023 From: ccleary at openjdk.org (Conor Cleary) Date: Mon, 9 Oct 2023 10:22:39 GMT Subject: RFR: 8309118: HttpClient: Add more tests for 100 ExpectContinue with HTTP/2 [v3] In-Reply-To: References: Message-ID: > ### **Issue Description** > There is missing test coverage for the implementation of partial/informational responses (status code 1xx in server response headers) for the `HttpClient`, specifically in the `HTTP/2` use case. RFC 9113 - HTTP/2, details the behavior of any client in these situations. Small changes and new test cases are needed to verify compliance with this specification. This issue primarily concerns how the client reacts to receiving a `RST_STREAM` frame at various stages of a partial/informational response from a server. > > ### **Solution Details** > Changes were made in `src/java.net.http/share/classes/jdk/internal/net/http/Stream.java` to improve the handling client's handling of receiving a `RST_STREAM`. `incoming_reset()` (L574) will now cause the client to ignore a `RST_STREAM` frame if an `END_STREAM` flag has been received _and_ the request body has completed sending. Previously it would be ignored only if an `END_STREAM` flag was seen which caused cancelled partial responses to 'hang' indefinitely should a client be transmitting data in a POST/PUT request. An overhaul of how `incoming_reset()` was done in an effore to simplify the method and make it easier to debug in the future. > > Some changes where also made to the `schedule()` method in Stream (L190) to ensure both the sending of the Request Body and receipt of a RST_STREAM at various stages of an exchange do not cause unexpected behavior. Minor changes were made to the `Http2TestServer` implementation to improve the convinience of testing edge cases involving the sending of `HTTP/2` response headers. > > Concerning the new test cases, I have listed below the specifics of each case and the expected behavior of the client in the given scenario. > > **test/jdk/java/net/httpclient/ExpectContinueTest.java** > - Client sends a POST request with the `Expect: 100-Continue` header included > - Server responds with a `HEADERS` frame including a 100 status code. Server then sends `RST_STREAM` with code `NO_ERROR` or `PROTOCOL_ERROR` set before an END_STREAM is received from the server. > - Expected/Observed Client Behavior: Client completes exceptionally in both cases. > - Client sends a POST request with the `Expect: 100-Continue` header included > - Server responds with a `HEADERS` frame including a 100 status code and reads the request body. Server then sends Response Headers with status code 200 to complete the response. Server then sends RST_STREAM with code `NO_ERROR` or `PROTOCOL_ERROR` set... Conor Cleary 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 ten additional commits since the last revision: - 8309118: Fixed error in handleReset ReentrantLock - 8309118: Updates to Stream cancelImpl - 8309118: Refactored test, updated incoming_reset - Merge branch 'master' into JDK-8309118 - 8309118: Cleanup identifiers and whitespace - 8309118: Removed unused try-with-resources - 8309118: Improve comments and annotations - 8309118: Remove local test timeout value - 8309118: Add more tests for 100 ExpectContinue with HTTP/2 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/15664/files - new: https://git.openjdk.org/jdk/pull/15664/files/a2fec5f3..909783b2 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=15664&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=15664&range=01-02 Stats: 134477 lines in 3723 files changed: 64529 ins; 26135 del; 43813 mod Patch: https://git.openjdk.org/jdk/pull/15664.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/15664/head:pull/15664 PR: https://git.openjdk.org/jdk/pull/15664 From ccleary at openjdk.org Mon Oct 9 10:22:50 2023 From: ccleary at openjdk.org (Conor Cleary) Date: Mon, 9 Oct 2023 10:22:50 GMT Subject: RFR: 8309118: HttpClient: Add more tests for 100 ExpectContinue with HTTP/2 [v2] In-Reply-To: References: Message-ID: <9DwHRpobaVOvQ72afzpTgR5mvlUFKTPIVYqoA2qTM0M=.a3d73247-ca5b-4071-b765-ce9aa13088e1@github.com> On Wed, 20 Sep 2023 09:51:30 GMT, Conor Cleary wrote: >> ### **Issue Description** >> There is missing test coverage for the implementation of partial/informational responses (status code 1xx in server response headers) for the `HttpClient`, specifically in the `HTTP/2` use case. RFC 9113 - HTTP/2, details the behavior of any client in these situations. Small changes and new test cases are needed to verify compliance with this specification. This issue primarily concerns how the client reacts to receiving a `RST_STREAM` frame at various stages of a partial/informational response from a server. >> >> ### **Solution Details** >> Changes were made in `src/java.net.http/share/classes/jdk/internal/net/http/Stream.java` to improve the handling client's handling of receiving a `RST_STREAM`. `incoming_reset()` (L574) will now cause the client to ignore a `RST_STREAM` frame if an `END_STREAM` flag has been received _and_ the request body has completed sending. Previously it would be ignored only if an `END_STREAM` flag was seen which caused cancelled partial responses to 'hang' indefinitely should a client be transmitting data in a POST/PUT request. An overhaul of how `incoming_reset()` was done in an effore to simplify the method and make it easier to debug in the future. >> >> Some changes where also made to the `schedule()` method in Stream (L190) to ensure both the sending of the Request Body and receipt of a RST_STREAM at various stages of an exchange do not cause unexpected behavior. Minor changes were made to the `Http2TestServer` implementation to improve the convinience of testing edge cases involving the sending of `HTTP/2` response headers. >> >> Concerning the new test cases, I have listed below the specifics of each case and the expected behavior of the client in the given scenario. >> >> **test/jdk/java/net/httpclient/ExpectContinueTest.java** >> - Client sends a POST request with the `Expect: 100-Continue` header included >> - Server responds with a `HEADERS` frame including a 100 status code. Server then sends `RST_STREAM` with code `NO_ERROR` or `PROTOCOL_ERROR` set before an END_STREAM is received from the server. >> - Expected/Observed Client Behavior: Client completes exceptionally in both cases. >> - Client sends a POST request with the `Expect: 100-Continue` header included >> - Server responds with a `HEADERS` frame including a 100 status code and reads the request body. Server then sends Response Headers with status code 200 to complete the response. Server then sends RST_STREAM with code `N... > > Conor Cleary has updated the pull request incrementally with one additional commit since the last revision: > > 8309118: Cleanup identifiers and whitespace This PR is now updated and ready for review again. A few fundamentals with regard to initial incorrect assumptions about the behaviour of HttpClient have been addressed. As a result the testing of these changes and the client in these RST_STREAM cases have changed quite a bit from the orignal posting. Fixes of various intermittent failures detected by running test cases included with this PR are also included. I will be updating the PR description to reflect this. Edit: PR description is updated ------------- PR Comment: https://git.openjdk.org/jdk/pull/15664#issuecomment-1752579030 From redestad at openjdk.org Mon Oct 9 10:26:54 2023 From: redestad at openjdk.org (Claes Redestad) Date: Mon, 9 Oct 2023 10:26:54 GMT Subject: RFR: 8317698: Optimization for URLEncoder In-Reply-To: References: Message-ID: On Fri, 6 Oct 2023 20:55:40 GMT, ??? wrote: > @cl4es and @Glavo have already made some very good optimizations to URLEncoder, but we can continue to improve. > > The current URLEncoder's Predicate for DONT_NEED_ENCODING is based on BitSet, which is actually a table lookup. The actual performance may not be as good as microbench. > > The character value range of DONT_NEED_ENCODING is between [45-122]. We can construct two long type constants to do the work of BitSet. This can improve performance by about 7% to 30%. I can't find any in the java.base module, but outside of java.base there are a few candidate such as `javax.management.remote.JMXServiceURL` and `com.sun.tools.javac.jvm.PoolReader`. Why? ------------- PR Comment: https://git.openjdk.org/jdk/pull/16082#issuecomment-1752713940 From duke at openjdk.org Mon Oct 9 10:26:58 2023 From: duke at openjdk.org (=?UTF-8?B?5rip57uN6ZSm?=) Date: Mon, 9 Oct 2023 10:26:58 GMT Subject: RFR: 8317698: Optimization for URLEncoder In-Reply-To: References: Message-ID: On Fri, 6 Oct 2023 20:55:40 GMT, ??? wrote: > @cl4es and @Glavo have already made some very good optimizations to URLEncoder, but we can continue to improve. > > The current URLEncoder's Predicate for DONT_NEED_ENCODING is based on BitSet, which is actually a table lookup. The actual performance may not be as good as microbench. > > The character value range of DONT_NEED_ENCODING is between [45-122]. We can construct two long type constants to do the work of BitSet. This can improve performance by about 7% to 30%. OK, I agree with you, this optimization should be handled in ImmutableBitSetPredicate, I will close this PR. ------------- PR Comment: https://git.openjdk.org/jdk/pull/16082#issuecomment-1752734662 From dfuchs at openjdk.org Mon Oct 9 13:40:18 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Mon, 9 Oct 2023 13:40:18 GMT Subject: RFR: 8309118: HttpClient: Add more tests for 100 ExpectContinue with HTTP/2 [v3] In-Reply-To: References: Message-ID: <4Pxb92hlZoaXrthV5K0bBktnr71YupMup9zopkaeJ78=.27ed1086-302f-4412-ac5e-ec40330be099@github.com> On Mon, 9 Oct 2023 10:22:39 GMT, Conor Cleary wrote: >> ### **Issue Description** >> There is missing test coverage for the implementation of partial/informational responses (status code 1xx in server response headers) for the `HttpClient`, specifically in the `HTTP/2` use case. RFC 9113 - HTTP/2, details the behavior of any client in these situations. Small changes and new test cases are needed to verify compliance with this specification. This issue primarily concerns how the client reacts to receiving a `RST_STREAM` frame at various stages of a partial/informational response from a server. >> >> ### **Solution Details** >> Changes were made in `src/java.net.http/share/classes/jdk/internal/net/http/Stream.java` to improve the handling client's handling of receiving a `RST_STREAM`. `incoming_reset()` (L574) will now cause the client to ignore a `RST_STREAM` frame if an `END_STREAM` flag has been received _and_ the request body has completed sending. Previously it would be ignored only if an `END_STREAM` flag was seen which caused cancelled partial responses to 'hang' indefinitely should a client be transmitting data in a POST/PUT request. An overhaul of how `incoming_reset()` was done in an effore to simplify the method and make it easier to debug in the future. >> >> Some changes where also made to the `schedule()` method in Stream (L190) to ensure both the sending of the Request Body and receipt of a RST_STREAM at various stages of an exchange do not cause unexpected behavior. Minor changes were made to the `Http2TestServer` implementation to improve the convinience of testing edge cases involving the sending of `HTTP/2` response headers. >> >> Concerning the new test cases, I have listed below the specifics of each case and the expected behavior of the client in the given scenario. >> >> **test/jdk/java/net/httpclient/ExpectContinueTest.java** >> - Client sends a POST request with the `Expect: 100-Continue` header included >> - Server responds with a `HEADERS` frame including a 100 status code. Server then sends `RST_STREAM` with code `NO_ERROR` or `PROTOCOL_ERROR` set before an END_STREAM is received from the server. >> - Expected/Observed Client Behavior: Client completes exceptionally in both cases. >> - Client sends a POST request with the `Expect: 100-Continue` header included >> - Server responds with a `HEADERS` frame including a 100 status code and reads the request body. Server then sends Response Headers with status code 200 to complete the response. Server then sends RST_STREAM with code `N... > > Conor Cleary 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 ten additional commits since the last revision: > > - 8309118: Fixed error in handleReset ReentrantLock > - 8309118: Updates to Stream cancelImpl > - 8309118: Refactored test, updated incoming_reset > - Merge branch 'master' into JDK-8309118 > - 8309118: Cleanup identifiers and whitespace > - 8309118: Removed unused try-with-resources > - 8309118: Improve comments and annotations > - 8309118: Remove local test timeout value > - 8309118: Add more tests for 100 ExpectContinue with HTTP/2 src/java.net.http/share/classes/jdk/internal/net/http/Http2ClientImpl.java line 234: > 232: connections.values().forEach(this::close); > 233: connections.remove(entry.getKey(), entry.getValue()); > 234: } I'd suggest to change `this::close(Http2Connection)` to return boolean (instead of void) and make it always return`true`, and then use `removeIf` instead of forEach: connections.values().removeIf(this::close); src/java.net.http/share/classes/jdk/internal/net/http/Stream.java line 193: > 191: if (frame instanceof ResetFrame rf) { > 192: inputQ.remove(); > 193: if (endStreamReceived()) { Suggestion: if (endStreamReceived() && rf.getErrorCode() == ResetFrame.NO_ERROR) { src/java.net.http/share/classes/jdk/internal/net/http/Stream.java line 195: > 193: if (endStreamReceived()) { > 194: // If END_STREAM is already received, we should not receive any new RST_STREAM frames and > 195: // close the connection gracefully by processing all remaining frames in the inputQ. Suggestion: // If END_STREAM is already received, we should we should simply // complete the requestBodyCF successfuly and stop sending any // request data. src/java.net.http/share/classes/jdk/internal/net/http/Stream.java line 484: > 482: if (debug.on()) debug.log("incoming: %s", frame); > 483: var cancelled = checkRequestCancelled() || closed; > 484: // endStreamSeen = endStreamSeen || frame.getFlag(HeaderFrame.END_STREAM); leftover to be removed? src/java.net.http/share/classes/jdk/internal/net/http/Stream.java line 584: > 582: void incoming_reset(ResetFrame frame) { > 583: Log.logTrace("Received RST_STREAM on stream {0}", streamid); > 584: Flow.Subscriber subscriber = responseSubscriber == null ? pendingResponseSubscriber : responseSubscriber; Suggestion: Flow.Subscriber subscriber = responseSubscriber; if (subscriber == null) subscriber = pendingResponseSubscriber; (avoids reading volatile twice) ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15664#discussion_r1350308126 PR Review Comment: https://git.openjdk.org/jdk/pull/15664#discussion_r1350315812 PR Review Comment: https://git.openjdk.org/jdk/pull/15664#discussion_r1350312683 PR Review Comment: https://git.openjdk.org/jdk/pull/15664#discussion_r1350316732 PR Review Comment: https://git.openjdk.org/jdk/pull/15664#discussion_r1350319468 From dfuchs at openjdk.org Mon Oct 9 13:49:19 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Mon, 9 Oct 2023 13:49:19 GMT Subject: RFR: 8309118: HttpClient: Add more tests for 100 ExpectContinue with HTTP/2 [v3] In-Reply-To: References: Message-ID: On Mon, 9 Oct 2023 10:22:39 GMT, Conor Cleary wrote: >> ### **Issue Description** >> There is missing test coverage for the implementation of partial/informational responses (status code 1xx in server response headers) for the `HttpClient`, specifically in the `HTTP/2` use case. RFC 9113 - HTTP/2, details the behavior of any client in these situations. Small changes and new test cases are needed to verify compliance with this specification. This issue primarily concerns how the client reacts to receiving a `RST_STREAM` frame at various stages of a partial/informational response from a server. >> >> ### **Solution Details** >> Changes were made in `src/java.net.http/share/classes/jdk/internal/net/http/Stream.java` to improve the handling client's handling of receiving a `RST_STREAM`. `incoming_reset()` (L574) will now cause the client to ignore a `RST_STREAM` frame if an `END_STREAM` flag has been received _and_ the request body has completed sending. Previously it would be ignored only if an `END_STREAM` flag was seen which caused cancelled partial responses to 'hang' indefinitely should a client be transmitting data in a POST/PUT request. An overhaul of how `incoming_reset()` was done in an effore to simplify the method and make it easier to debug in the future. >> >> Some changes where also made to the `schedule()` method in Stream (L190) to ensure both the sending of the Request Body and receipt of a RST_STREAM at various stages of an exchange do not cause unexpected behavior. Minor changes were made to the `Http2TestServer` implementation to improve the convinience of testing edge cases involving the sending of `HTTP/2` response headers. >> >> Concerning the new test cases, I have listed below the specifics of each case and the expected behavior of the client in the given scenario. >> >> **test/jdk/java/net/httpclient/ExpectContinueTest.java** >> - Client sends a POST request with the `Expect: 100-Continue` header included >> - Server responds with a `HEADERS` frame including a 100 status code. Server then sends `RST_STREAM` with code `NO_ERROR` or `PROTOCOL_ERROR` set before an END_STREAM is received from the server. >> - Expected/Observed Client Behavior: Client completes exceptionally in both cases. >> - Client sends a POST request with the `Expect: 100-Continue` header included >> - Server responds with a `HEADERS` frame including a 100 status code and reads the request body. Server then sends Response Headers with status code 200 to complete the response. Server then sends RST_STREAM with code `N... > > Conor Cleary 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 ten additional commits since the last revision: > > - 8309118: Fixed error in handleReset ReentrantLock > - 8309118: Updates to Stream cancelImpl > - 8309118: Refactored test, updated incoming_reset > - Merge branch 'master' into JDK-8309118 > - 8309118: Cleanup identifiers and whitespace > - 8309118: Removed unused try-with-resources > - 8309118: Improve comments and annotations > - 8309118: Remove local test timeout value > - 8309118: Add more tests for 100 ExpectContinue with HTTP/2 src/java.net.http/share/classes/jdk/internal/net/http/Stream.java line 635: > 633: closed = true; > 634: } finally { > 635: stateLock.unlock(); Ouch! I am to blame for this one. It's a regression introduced by JDK-8308310. This one needs to be backported to JDK 21. Let me see if I should prepare a PR for that. src/java.net.http/share/classes/jdk/internal/net/http/Stream.java line 648: > 646: completeResponseExceptionally(e); > 647: if (!requestBodyCF.isDone()) { > 648: if (debug.on()) debug.log("\nHERE"); remove this line? src/java.net.http/share/classes/jdk/internal/net/http/Stream.java line 652: > 650: } > 651: if (responseBodyCF != null) { > 652: if (debug.on()) debug.log("\nALSO HERE"); ... and this one? src/java.net.http/share/classes/jdk/internal/net/http/Stream.java line 1090: > 1088: } while (outgoing.peekFirst() != null); > 1089: > 1090: // TODO: Maybe throw exception here to fix intermittent error? Leftover? src/java.net.http/share/classes/jdk/internal/net/http/Stream.java line 1112: > 1110: } > 1111: > 1112: // TODO: We could put the check for END_STREAM received here? Leftover? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15664#discussion_r1350329648 PR Review Comment: https://git.openjdk.org/jdk/pull/15664#discussion_r1350330046 PR Review Comment: https://git.openjdk.org/jdk/pull/15664#discussion_r1350330398 PR Review Comment: https://git.openjdk.org/jdk/pull/15664#discussion_r1350330745 PR Review Comment: https://git.openjdk.org/jdk/pull/15664#discussion_r1350331104 From dfuchs at openjdk.org Mon Oct 9 13:56:05 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Mon, 9 Oct 2023 13:56:05 GMT Subject: RFR: 8309118: HttpClient: Add more tests for 100 ExpectContinue with HTTP/2 [v3] In-Reply-To: References: Message-ID: <-Z4KpAacLXG-eZ52pykjUc1HDl-hgoSOKRaiPdHcBkM=.1792f311-abe3-4397-850a-176d16944d57@github.com> On Mon, 9 Oct 2023 13:43:41 GMT, Daniel Fuchs wrote: >> Conor Cleary 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 ten additional commits since the last revision: >> >> - 8309118: Fixed error in handleReset ReentrantLock >> - 8309118: Updates to Stream cancelImpl >> - 8309118: Refactored test, updated incoming_reset >> - Merge branch 'master' into JDK-8309118 >> - 8309118: Cleanup identifiers and whitespace >> - 8309118: Removed unused try-with-resources >> - 8309118: Improve comments and annotations >> - 8309118: Remove local test timeout value >> - 8309118: Add more tests for 100 ExpectContinue with HTTP/2 > > src/java.net.http/share/classes/jdk/internal/net/http/Stream.java line 635: > >> 633: closed = true; >> 634: } finally { >> 635: stateLock.unlock(); > > Ouch! I am to blame for this one. It's a regression introduced by JDK-8308310. This one needs to be backported to JDK 21. Let me see if I should prepare a PR for that. https://github.com/openjdk/jdk/pull/16101 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15664#discussion_r1350342203 From dfuchs at openjdk.org Mon Oct 9 14:02:27 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Mon, 9 Oct 2023 14:02:27 GMT Subject: RFR: 8317736: Stream::handleReset locks twice Message-ID: Trivial one liner fix. The fix for [JDK-8308310](https://bugs.openjdk.org/browse/JDK-8308310) introduced a reentrant `stateLock` but also a regression. In Stream::handleReset the lock is locked twice. ------------- Commit messages: - 8317736 Changes: https://git.openjdk.org/jdk/pull/16101/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16101&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8317736 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/16101.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/16101/head:pull/16101 PR: https://git.openjdk.org/jdk/pull/16101 From ccleary at openjdk.org Mon Oct 9 14:07:17 2023 From: ccleary at openjdk.org (Conor Cleary) Date: Mon, 9 Oct 2023 14:07:17 GMT Subject: RFR: 8317736: Stream::handleReset locks twice In-Reply-To: References: Message-ID: On Mon, 9 Oct 2023 13:52:39 GMT, Daniel Fuchs wrote: > Trivial one liner fix. > > The fix for [JDK-8308310](https://bugs.openjdk.org/browse/JDK-8308310) introduced a reentrant `stateLock` but also a regression. In Stream::handleReset the lock is locked twice. LGTM. ------------- Marked as reviewed by ccleary (Committer). PR Review: https://git.openjdk.org/jdk/pull/16101#pullrequestreview-1664529328 From djelinski at openjdk.org Mon Oct 9 14:14:58 2023 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Mon, 9 Oct 2023 14:14:58 GMT Subject: RFR: 8317736: Stream::handleReset locks twice In-Reply-To: References: Message-ID: <-z432ucLBECTvfDRRZ9K-XnyCisu86SYclKbOqL5nmc=.3aa7b9d1-a27b-4429-a297-22b683194243@github.com> On Mon, 9 Oct 2023 13:52:39 GMT, Daniel Fuchs wrote: > Trivial one liner fix. > > The fix for [JDK-8308310](https://bugs.openjdk.org/browse/JDK-8308310) introduced a reentrant `stateLock` but also a regression. In Stream::handleReset the lock is locked twice. I suppose you could also mark it noreg-trivial... ------------- Marked as reviewed by djelinski (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/16101#pullrequestreview-1664545068 From jpai at openjdk.org Mon Oct 9 14:33:00 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Mon, 9 Oct 2023 14:33:00 GMT Subject: RFR: 8317736: Stream::handleReset locks twice In-Reply-To: References: Message-ID: On Mon, 9 Oct 2023 13:52:39 GMT, Daniel Fuchs wrote: > Trivial one liner fix. > > The fix for [JDK-8308310](https://bugs.openjdk.org/browse/JDK-8308310) introduced a reentrant `stateLock` but also a regression. In Stream::handleReset the lock is locked twice. Marked as reviewed by jpai (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/16101#pullrequestreview-1664591887 From redestad at openjdk.org Mon Oct 9 14:38:00 2023 From: redestad at openjdk.org (Claes Redestad) Date: Mon, 9 Oct 2023 14:38:00 GMT Subject: RFR: 8317698: Optimization for URLEncoder In-Reply-To: References: Message-ID: On Fri, 6 Oct 2023 20:55:40 GMT, ??? wrote: > @cl4es and @Glavo have already made some very good optimizations to URLEncoder, but we can continue to improve. > > The current URLEncoder's Predicate for DONT_NEED_ENCODING is based on BitSet, which is actually a table lookup. The actual performance may not be as good as microbench. > > The character value range of DONT_NEED_ENCODING is between [45-122]. We can construct two long type constants to do the work of BitSet. This can improve performance by about 7% to 30%. Ok, I've cleaned up #16094 and added some sanity tests. Ok if I repurpose the JBS bug for #16094? ------------- PR Comment: https://git.openjdk.org/jdk/pull/16082#issuecomment-1753132150 From djelinski at openjdk.org Mon Oct 9 14:43:10 2023 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Mon, 9 Oct 2023 14:43:10 GMT Subject: RFR: 8317696: Fix compilation with clang-16 In-Reply-To: References: Message-ID: On Sat, 7 Oct 2023 16:24:29 GMT, Jan Kratochvil wrote: > `--with-toolchain-type=clang` fails the compilation for me with `clang-16.0.6-3.fc38.x86_64` > > While the warnings can be disabled I find better to just fix them. The GTK prototypes in JDK reported by clang are either missing or wrong. > > > src/java.base/unix/native/libnet/DefaultProxySelector.c:378:41: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > proxies = (*g_proxy_resolver_lookup)(resolver, uri, NULL, &error); > ^ > src/java.base/unix/native/libnet/DefaultProxySelector.c:397:63: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > (*g_network_address_parse_uri)(proxies[i], 0, > ^ > src/java.base/unix/native/libnet/DefaultProxySelector.c:402:70: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > phost = (*g_network_address_get_hostname)(conn); > ^ > src/java.base/unix/native/libnet/DefaultProxySelector.c:403:66: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > pport = (*g_network_address_get_port)(conn); > ^ > src/java.base/unix/native/libnet/DefaultProxySelector.c:445:22: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > (*g_strfreev)(proxies); > ^ > src/java.base/unix/native/libnet/DefaultProxySelector.c:448:25: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > (*g_clear_error)(&error); > ^ > Compiling X11Renderer.c (for libawt_headless.so) > In file included from src/java.desktop/unix/native/common/java2d/x11/X11PMBlitLoops.c:29: > In file included from src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.h:29: > src/java.desktop/unix/native/common/aw... Changes requested by djelinski (Reviewer). src/java.base/unix/native/libnet/DefaultProxySelector.c line 96: > 94: typedef GProxyResolver* g_proxy_resolver_get_default_func(void); > 95: typedef char** g_proxy_resolver_lookup_func(GProxyResolver* resolver, char* uri, void *null, GError **error_p); > 96: typedef GSocketConnectable* g_network_address_parse_uri_func(char* proxy, int zero, GError **error_p); Suggestion: typedef GSocketConnectable* g_network_address_parse_uri_func(char* proxy, unsigned short default_port, GError **error_p); https://developer-old.gnome.org/gio/stable/GNetworkAddress.html#g-network-address-parse-uri src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c line 218: > 216: static GtkWidget* (*fp_gtk_menu_bar_new)(); > 217: static GtkWidget* (*fp_gtk_menu_item_new)(); > 218: static GtkWidget* (*fp_gtk_notebook_new)(void); This change is inconsistent with the surrounding style; I'd keep the original declaration, and only remove the NULL in function calls. ------------- PR Review: https://git.openjdk.org/jdk/pull/16092#pullrequestreview-1664342423 PR Review Comment: https://git.openjdk.org/jdk/pull/16092#discussion_r1350242526 PR Review Comment: https://git.openjdk.org/jdk/pull/16092#discussion_r1350396505 From jkratochvil at openjdk.org Mon Oct 9 14:54:14 2023 From: jkratochvil at openjdk.org (Jan Kratochvil) Date: Mon, 9 Oct 2023 14:54:14 GMT Subject: RFR: 8317696: Fix compilation with clang-16 [v2] In-Reply-To: References: Message-ID: <3qea9Ojjc6Q317U6dJHiY8_EwdMvnKweDTeSd_dqQzU=.9b5734d6-b122-4852-90a3-113df5defaaa@github.com> > `--with-toolchain-type=clang` fails the compilation for me with `clang-16.0.6-3.fc38.x86_64` > > While the warnings can be disabled I find better to just fix them. The GTK prototypes in JDK reported by clang are either missing or wrong. > > > src/java.base/unix/native/libnet/DefaultProxySelector.c:378:41: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > proxies = (*g_proxy_resolver_lookup)(resolver, uri, NULL, &error); > ^ > src/java.base/unix/native/libnet/DefaultProxySelector.c:397:63: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > (*g_network_address_parse_uri)(proxies[i], 0, > ^ > src/java.base/unix/native/libnet/DefaultProxySelector.c:402:70: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > phost = (*g_network_address_get_hostname)(conn); > ^ > src/java.base/unix/native/libnet/DefaultProxySelector.c:403:66: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > pport = (*g_network_address_get_port)(conn); > ^ > src/java.base/unix/native/libnet/DefaultProxySelector.c:445:22: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > (*g_strfreev)(proxies); > ^ > src/java.base/unix/native/libnet/DefaultProxySelector.c:448:25: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > (*g_clear_error)(&error); > ^ > Compiling X11Renderer.c (for libawt_headless.so) > In file included from src/java.desktop/unix/native/common/java2d/x11/X11PMBlitLoops.c:29: > In file included from src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.h:29: > src/java.desktop/unix/native/common/aw... Jan Kratochvil has updated the pull request incrementally with two additional commits since the last revision: - Update src/java.base/unix/native/libnet/DefaultProxySelector.c Co-authored-by: Daniel Jelinski - Update also gtk3_interface.h prototypes ------------- Changes: - all: https://git.openjdk.org/jdk/pull/16092/files - new: https://git.openjdk.org/jdk/pull/16092/files/05c4054d..6c2c2f87 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=16092&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=16092&range=00-01 Stats: 4 lines in 2 files changed: 0 ins; 0 del; 4 mod Patch: https://git.openjdk.org/jdk/pull/16092.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/16092/head:pull/16092 PR: https://git.openjdk.org/jdk/pull/16092 From jkratochvil at openjdk.org Mon Oct 9 15:01:45 2023 From: jkratochvil at openjdk.org (Jan Kratochvil) Date: Mon, 9 Oct 2023 15:01:45 GMT Subject: RFR: 8317696: Fix compilation with clang-16 [v3] In-Reply-To: References: Message-ID: <2tYOw3UPK-A_WyEI7zHIazNX5-6Ad69bZbYd799AiwQ=.770053ff-b482-4c76-9afb-48d3a36111ae@github.com> On Mon, 9 Oct 2023 14:38:27 GMT, Daniel Jeli?ski wrote: >> Jan Kratochvil has updated the pull request incrementally with one additional commit since the last revision: >> >> Remove declaration changes which are not required >> - suggested by djelinski > > src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c line 218: > >> 216: static GtkWidget* (*fp_gtk_menu_bar_new)(); >> 217: static GtkWidget* (*fp_gtk_menu_item_new)(); >> 218: static GtkWidget* (*fp_gtk_notebook_new)(void); > > This change is inconsistent with the surrounding style; I'd keep the original declaration, and only remove the NULL in function calls. I did not notice it is not required to change the prototype. OK, it works without this change. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16092#discussion_r1350418413 From jkratochvil at openjdk.org Mon Oct 9 15:01:41 2023 From: jkratochvil at openjdk.org (Jan Kratochvil) Date: Mon, 9 Oct 2023 15:01:41 GMT Subject: RFR: 8317696: Fix compilation with clang-16 [v3] In-Reply-To: References: Message-ID: > `--with-toolchain-type=clang` fails the compilation for me with `clang-16.0.6-3.fc38.x86_64` > > While the warnings can be disabled I find better to just fix them. The GTK prototypes in JDK reported by clang are either missing or wrong. > > > src/java.base/unix/native/libnet/DefaultProxySelector.c:378:41: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > proxies = (*g_proxy_resolver_lookup)(resolver, uri, NULL, &error); > ^ > src/java.base/unix/native/libnet/DefaultProxySelector.c:397:63: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > (*g_network_address_parse_uri)(proxies[i], 0, > ^ > src/java.base/unix/native/libnet/DefaultProxySelector.c:402:70: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > phost = (*g_network_address_get_hostname)(conn); > ^ > src/java.base/unix/native/libnet/DefaultProxySelector.c:403:66: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > pport = (*g_network_address_get_port)(conn); > ^ > src/java.base/unix/native/libnet/DefaultProxySelector.c:445:22: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > (*g_strfreev)(proxies); > ^ > src/java.base/unix/native/libnet/DefaultProxySelector.c:448:25: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > (*g_clear_error)(&error); > ^ > Compiling X11Renderer.c (for libawt_headless.so) > In file included from src/java.desktop/unix/native/common/java2d/x11/X11PMBlitLoops.c:29: > In file included from src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.h:29: > src/java.desktop/unix/native/common/aw... Jan Kratochvil has updated the pull request incrementally with one additional commit since the last revision: Remove declaration changes which are not required - suggested by djelinski ------------- Changes: - all: https://git.openjdk.org/jdk/pull/16092/files - new: https://git.openjdk.org/jdk/pull/16092/files/6c2c2f87..fa2c32e4 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=16092&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=16092&range=01-02 Stats: 6 lines in 2 files changed: 0 ins; 0 del; 6 mod Patch: https://git.openjdk.org/jdk/pull/16092.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/16092/head:pull/16092 PR: https://git.openjdk.org/jdk/pull/16092 From ccleary at openjdk.org Mon Oct 9 15:44:07 2023 From: ccleary at openjdk.org (Conor Cleary) Date: Mon, 9 Oct 2023 15:44:07 GMT Subject: RFR: 8309118: HttpClient: Add more tests for 100 ExpectContinue with HTTP/2 [v3] In-Reply-To: <4Pxb92hlZoaXrthV5K0bBktnr71YupMup9zopkaeJ78=.27ed1086-302f-4412-ac5e-ec40330be099@github.com> References: <4Pxb92hlZoaXrthV5K0bBktnr71YupMup9zopkaeJ78=.27ed1086-302f-4412-ac5e-ec40330be099@github.com> Message-ID: On Mon, 9 Oct 2023 13:33:03 GMT, Daniel Fuchs wrote: >> Conor Cleary 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 ten additional commits since the last revision: >> >> - 8309118: Fixed error in handleReset ReentrantLock >> - 8309118: Updates to Stream cancelImpl >> - 8309118: Refactored test, updated incoming_reset >> - Merge branch 'master' into JDK-8309118 >> - 8309118: Cleanup identifiers and whitespace >> - 8309118: Removed unused try-with-resources >> - 8309118: Improve comments and annotations >> - 8309118: Remove local test timeout value >> - 8309118: Add more tests for 100 ExpectContinue with HTTP/2 > > src/java.net.http/share/classes/jdk/internal/net/http/Stream.java line 484: > >> 482: if (debug.on()) debug.log("incoming: %s", frame); >> 483: var cancelled = checkRequestCancelled() || closed; >> 484: // endStreamSeen = endStreamSeen || frame.getFlag(HeaderFrame.END_STREAM); > > leftover to be removed? Correct, from an older iteration. Will remove ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15664#discussion_r1350471672 From ccleary at openjdk.org Mon Oct 9 15:54:07 2023 From: ccleary at openjdk.org (Conor Cleary) Date: Mon, 9 Oct 2023 15:54:07 GMT Subject: RFR: 8309118: HttpClient: Add more tests for 100 ExpectContinue with HTTP/2 [v4] In-Reply-To: References: Message-ID: <_sGKprbaziML6UKpEzAF2YGHCQ8WcddHYC9zfKuDKtc=.f89420c5-9620-4678-8fdb-7b1c74f1889e@github.com> > ### **Issue Description** > There is missing test coverage for the implementation of partial/informational responses (status code 1xx in server response headers) for the `HttpClient`, specifically in the `HTTP/2` use case. RFC 9113 - HTTP/2, details the behavior of any client in these situations. Small changes and new test cases are needed to verify compliance with this specification. This issue primarily concerns how the client reacts to receiving a `RST_STREAM` frame at various stages of a partial/informational response from a server. > > ### **Solution Details** > Changes were made in `src/java.net.http/share/classes/jdk/internal/net/http/Stream.java` to improve the handling client's handling of receiving a `RST_STREAM`. `incoming_reset()` (L574) will now cause the client to ignore a `RST_STREAM` frame if an `END_STREAM` flag has been received _and_ the request body has completed sending. Previously it would be ignored only if an `END_STREAM` flag was seen which caused cancelled partial responses to 'hang' indefinitely should a client be transmitting data in a POST/PUT request. An overhaul of how `incoming_reset()` was done in an effore to simplify the method and make it easier to debug in the future. > > Some changes where also made to the `schedule()` method in Stream (L190) to ensure both the sending of the Request Body and receipt of a RST_STREAM at various stages of an exchange do not cause unexpected behavior. Minor changes were made to the `Http2TestServer` implementation to improve the convinience of testing edge cases involving the sending of `HTTP/2` response headers. > > Concerning the new test cases, I have listed below the specifics of each case and the expected behavior of the client in the given scenario. > > **test/jdk/java/net/httpclient/ExpectContinueTest.java** > - Client sends a POST request with the `Expect: 100-Continue` header included > - Server responds with a `HEADERS` frame including a 100 status code. Server then sends `RST_STREAM` with code `NO_ERROR` or `PROTOCOL_ERROR` set before an END_STREAM is received from the server. > - Expected/Observed Client Behavior: Client completes exceptionally in both cases. > - Client sends a POST request with the `Expect: 100-Continue` header included > - Server responds with a `HEADERS` frame including a 100 status code and reads the request body. Server then sends Response Headers with status code 200 to complete the response. Server then sends RST_STREAM with code `NO_ERROR` or `PROTOCOL_ERROR` set... Conor Cleary has updated the pull request incrementally with one additional commit since the last revision: 8309118: Remove irrelevant comments and logs ------------- Changes: - all: https://git.openjdk.org/jdk/pull/15664/files - new: https://git.openjdk.org/jdk/pull/15664/files/909783b2..94e2e1d2 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=15664&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=15664&range=02-03 Stats: 5 lines in 1 file changed: 0 ins; 5 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/15664.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/15664/head:pull/15664 PR: https://git.openjdk.org/jdk/pull/15664 From ccleary at openjdk.org Mon Oct 9 15:54:14 2023 From: ccleary at openjdk.org (Conor Cleary) Date: Mon, 9 Oct 2023 15:54:14 GMT Subject: RFR: 8309118: HttpClient: Add more tests for 100 ExpectContinue with HTTP/2 [v3] In-Reply-To: References: Message-ID: On Mon, 9 Oct 2023 10:22:39 GMT, Conor Cleary wrote: >> ### **Issue Description** >> There is missing test coverage for the implementation of partial/informational responses (status code 1xx in server response headers) for the `HttpClient`, specifically in the `HTTP/2` use case. RFC 9113 - HTTP/2, details the behavior of any client in these situations. Small changes and new test cases are needed to verify compliance with this specification. This issue primarily concerns how the client reacts to receiving a `RST_STREAM` frame at various stages of a partial/informational response from a server. >> >> ### **Solution Details** >> Changes were made in `src/java.net.http/share/classes/jdk/internal/net/http/Stream.java` to improve the handling client's handling of receiving a `RST_STREAM`. `incoming_reset()` (L574) will now cause the client to ignore a `RST_STREAM` frame if an `END_STREAM` flag has been received _and_ the request body has completed sending. Previously it would be ignored only if an `END_STREAM` flag was seen which caused cancelled partial responses to 'hang' indefinitely should a client be transmitting data in a POST/PUT request. An overhaul of how `incoming_reset()` was done in an effore to simplify the method and make it easier to debug in the future. >> >> Some changes where also made to the `schedule()` method in Stream (L190) to ensure both the sending of the Request Body and receipt of a RST_STREAM at various stages of an exchange do not cause unexpected behavior. Minor changes were made to the `Http2TestServer` implementation to improve the convinience of testing edge cases involving the sending of `HTTP/2` response headers. >> >> Concerning the new test cases, I have listed below the specifics of each case and the expected behavior of the client in the given scenario. >> >> **test/jdk/java/net/httpclient/ExpectContinueTest.java** >> - Client sends a POST request with the `Expect: 100-Continue` header included >> - Server responds with a `HEADERS` frame including a 100 status code. Server then sends `RST_STREAM` with code `NO_ERROR` or `PROTOCOL_ERROR` set before an END_STREAM is received from the server. >> - Expected/Observed Client Behavior: Client completes exceptionally in both cases. >> - Client sends a POST request with the `Expect: 100-Continue` header included >> - Server responds with a `HEADERS` frame including a 100 status code and reads the request body. Server then sends Response Headers with status code 200 to complete the response. Server then sends RST_STREAM with code `N... > > Conor Cleary 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 ten additional commits since the last revision: > > - 8309118: Fixed error in handleReset ReentrantLock > - 8309118: Updates to Stream cancelImpl > - 8309118: Refactored test, updated incoming_reset > - Merge branch 'master' into JDK-8309118 > - 8309118: Cleanup identifiers and whitespace > - 8309118: Removed unused try-with-resources > - 8309118: Improve comments and annotations > - 8309118: Remove local test timeout value > - 8309118: Add more tests for 100 ExpectContinue with HTTP/2 Apologies for leaving those irrelevant comments and logs in, I tend to leave plenty of them around as I work to get a good idea of whats going on. I removed them all in the latest commit and will address the other comments you had @dfuch soon ------------- PR Comment: https://git.openjdk.org/jdk/pull/15664#issuecomment-1753258843 From vtewari at openjdk.org Mon Oct 9 16:07:55 2023 From: vtewari at openjdk.org (Vyom Tewari) Date: Mon, 9 Oct 2023 16:07:55 GMT Subject: RFR: 8317736: Stream::handleReset locks twice In-Reply-To: References: Message-ID: On Mon, 9 Oct 2023 13:52:39 GMT, Daniel Fuchs wrote: > Trivial one liner fix. > > The fix for [JDK-8308310](https://bugs.openjdk.org/browse/JDK-8308310) introduced a reentrant `stateLock` but also a regression. In Stream::handleReset the lock is locked twice. Looks OK ------------- Marked as reviewed by vtewari (Committer). PR Review: https://git.openjdk.org/jdk/pull/16101#pullrequestreview-1664874649 From dfuchs at openjdk.org Mon Oct 9 16:35:09 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Mon, 9 Oct 2023 16:35:09 GMT Subject: Integrated: 8317736: Stream::handleReset locks twice In-Reply-To: References: Message-ID: On Mon, 9 Oct 2023 13:52:39 GMT, Daniel Fuchs wrote: > Trivial one liner fix. > > The fix for [JDK-8308310](https://bugs.openjdk.org/browse/JDK-8308310) introduced a reentrant `stateLock` but also a regression. In `Stream::handleReset` the lock is locked twice. This pull request has now been integrated. Changeset: 508fa717 Author: Daniel Fuchs URL: https://git.openjdk.org/jdk/commit/508fa71753171e125cd5345490cba1a1e545eb13 Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod 8317736: Stream::handleReset locks twice Reviewed-by: ccleary, djelinski, jpai, vtewari ------------- PR: https://git.openjdk.org/jdk/pull/16101 From aivanov at openjdk.org Mon Oct 9 18:37:00 2023 From: aivanov at openjdk.org (Alexey Ivanov) Date: Mon, 9 Oct 2023 18:37:00 GMT Subject: RFR: 8317696: Fix compilation with clang-16 [v3] In-Reply-To: References: Message-ID: On Mon, 9 Oct 2023 15:01:41 GMT, Jan Kratochvil wrote: >> `--with-toolchain-type=clang` fails the compilation for me with `clang-16.0.6-3.fc38.x86_64` >> >> While the warnings can be disabled I find better to just fix them. The GTK prototypes in JDK reported by clang are either missing or wrong. >> >> >> src/java.base/unix/native/libnet/DefaultProxySelector.c:378:41: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] >> proxies = (*g_proxy_resolver_lookup)(resolver, uri, NULL, &error); >> ^ >> src/java.base/unix/native/libnet/DefaultProxySelector.c:397:63: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] >> (*g_network_address_parse_uri)(proxies[i], 0, >> ^ >> src/java.base/unix/native/libnet/DefaultProxySelector.c:402:70: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] >> phost = (*g_network_address_get_hostname)(conn); >> ^ >> src/java.base/unix/native/libnet/DefaultProxySelector.c:403:66: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] >> pport = (*g_network_address_get_port)(conn); >> ^ >> src/java.base/unix/native/libnet/DefaultProxySelector.c:445:22: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] >> (*g_strfreev)(proxies); >> ^ >> src/java.base/unix/native/libnet/DefaultProxySelector.c:448:25: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] >> (*g_clear_error)(&error); >> ^ >> Compiling X11Renderer.c (for libawt_headless.so) >> In file included from src/java.desktop/unix/native/common/java2d/x11/X11PMBlitLoops.c:29: >> In file included from src/java.desktop/unix/native/common/java2d/x11/X11Surf... > > Jan Kratochvil has updated the pull request incrementally with one additional commit since the last revision: > > Remove declaration changes which are not required > - suggested by djelinski The changes for `java.desktop` look good to me. src/java.desktop/unix/native/common/awt/awt_GraphicsEnv.h line 53: > 51: #define MITSHM_PERM_OWNER (0600) > 52: > 53: extern int XShmQueryExtension(Display* dpy); I wonder if it's even needed here: the declaration should come from `X11/extensions/XShm.h` which is included. ------------- Marked as reviewed by aivanov (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/16092#pullrequestreview-1665070667 PR Review Comment: https://git.openjdk.org/jdk/pull/16092#discussion_r1350667139 From duke at openjdk.org Mon Oct 9 18:38:10 2023 From: duke at openjdk.org (=?UTF-8?B?5rip57uN6ZSm?=) Date: Mon, 9 Oct 2023 18:38:10 GMT Subject: Withdrawn: 8317698: Optimization for URLEncoder In-Reply-To: References: Message-ID: <8z6GTLgDcMCi5d6zDba8GQNta-kuKrmKK-9_wtk4m2Y=.35165c64-1eb1-41de-a38a-37a05316a40b@github.com> On Fri, 6 Oct 2023 20:55:40 GMT, ??? wrote: > @cl4es and @Glavo have already made some very good optimizations to URLEncoder, but we can continue to improve. > > The current URLEncoder's Predicate for DONT_NEED_ENCODING is based on BitSet, which is actually a table lookup. The actual performance may not be as good as microbench. > > The character value range of DONT_NEED_ENCODING is between [45-122]. We can construct two long type constants to do the work of BitSet. This can improve performance by about 7% to 30%. This pull request has been closed without being integrated. ------------- PR: https://git.openjdk.org/jdk/pull/16082 From djelinski at openjdk.org Mon Oct 9 18:42:00 2023 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Mon, 9 Oct 2023 18:42:00 GMT Subject: RFR: 8317696: Fix compilation with clang-16 [v3] In-Reply-To: References: Message-ID: On Mon, 9 Oct 2023 15:01:41 GMT, Jan Kratochvil wrote: >> `--with-toolchain-type=clang` fails the compilation for me with `clang-16.0.6-3.fc38.x86_64` >> >> While the warnings can be disabled I find better to just fix them. The GTK prototypes in JDK reported by clang are either missing or wrong. >> >> >> src/java.base/unix/native/libnet/DefaultProxySelector.c:378:41: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] >> proxies = (*g_proxy_resolver_lookup)(resolver, uri, NULL, &error); >> ^ >> src/java.base/unix/native/libnet/DefaultProxySelector.c:397:63: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] >> (*g_network_address_parse_uri)(proxies[i], 0, >> ^ >> src/java.base/unix/native/libnet/DefaultProxySelector.c:402:70: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] >> phost = (*g_network_address_get_hostname)(conn); >> ^ >> src/java.base/unix/native/libnet/DefaultProxySelector.c:403:66: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] >> pport = (*g_network_address_get_port)(conn); >> ^ >> src/java.base/unix/native/libnet/DefaultProxySelector.c:445:22: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] >> (*g_strfreev)(proxies); >> ^ >> src/java.base/unix/native/libnet/DefaultProxySelector.c:448:25: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] >> (*g_clear_error)(&error); >> ^ >> Compiling X11Renderer.c (for libawt_headless.so) >> In file included from src/java.desktop/unix/native/common/java2d/x11/X11PMBlitLoops.c:29: >> In file included from src/java.desktop/unix/native/common/java2d/x11/X11Surf... > > Jan Kratochvil has updated the pull request incrementally with one additional commit since the last revision: > > Remove declaration changes which are not required > - suggested by djelinski Marked as reviewed by djelinski (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/16092#pullrequestreview-1665089916 From aefimov at openjdk.org Tue Oct 10 15:08:24 2023 From: aefimov at openjdk.org (Aleksei Efimov) Date: Tue, 10 Oct 2023 15:08:24 GMT Subject: RFR: 8272215: Add InetAddress methods for parsing IP address literals [v2] In-Reply-To: References: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.e3b03591-2bca-44a1-805d-2cb1e4af30a1@github.com> Message-ID: On Mon, 9 Oct 2023 07:00:08 GMT, Jaikiran Pai wrote: > Hello Aleksei, it's good to see the addition of these new APIs. On the naming front, I like the Hello Jaikiran > The proposed changes also have text which talks about "ambiguous" address literals. The term ambiguous seems new in the InetAddress (and sub-classes). The package-info.java too doesn't have previous references to it. What ambiguous IPv4 address literals mean in the code and in [the release notes](https://www.oracle.com/java/technologies/javase/18all-relnotes.html#JDK-8277608): it is a set of addresses which can't be parsed in dotted-decimal forms listed in the Inet4Address#format class-level javadoc section, but can be parsed in BSD forms (decimal, octal, or hexadecimal) defined in [`inet_addr` of IEEE Std 1003.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_addr.html). > Should we add some details on what addresses are considered ambiguous (and how/if such addresses are treated by existing APIs)? The release note states that the `InetAddress` accepts IPv4 address literals in decimal quad notation. The new `ofLiteral` API also states that only dotted-decimal forms are supported, `ambigous` term is not mentioned in any public javadoc, and given that the related system property is a jdk-specific system property I would like to avoid introducing this term as part of this PR. > do you think we should add a more formal reference to the BSD formatting of IP address I think a more formal reference to BSD forms might be needed if they are recognizable by InetAddress APIs. As of today, this is not the case. ------------- PR Comment: https://git.openjdk.org/jdk/pull/15775#issuecomment-1755647174 From aefimov at openjdk.org Tue Oct 10 15:13:20 2023 From: aefimov at openjdk.org (Aleksei Efimov) Date: Tue, 10 Oct 2023 15:13:20 GMT Subject: RFR: 8272215: Add InetAddress methods for parsing IP address literals [v2] In-Reply-To: References: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.e3b03591-2bca-44a1-805d-2cb1e4af30a1@github.com> Message-ID: On Mon, 9 Oct 2023 07:12:48 GMT, Jaikiran Pai wrote: >> Aleksei Efimov has updated the pull request incrementally with two additional commits since the last revision: >> >> - updates for Inet6Address.ofLiteral return type, javadoc and the regression test >> - add null checks and NPE to methods javadoc > > src/java.base/share/classes/java/net/Inet4Address.java line 181: > >> 179: /** >> 180: * Parses string with an IPv4 address literal. >> 181: * If string doesn't contain a valid literal - null is returned. > > This sentence is a bit confusing, given the implementation details of this method. I think `null` is only returned if `throwIAE` is false? Thank you for spotting it. I have updated the javadoc of the `parseAddressString` method to contain all three possible scenarios: * If string contains a non-parsable literal and {@code throwIAE} is set to {@code false} * - {@code null} is returned. * If string contains a non-parsable literal and {@code throwIAE} is set to {@code true} * - {@code IllegalArgumentException} is thrown. * If string contains an {@linkplain IPAddressUtil#validateNumericFormatV4(String, boolean) * ambiguous literal} - {@code IllegalArgumentException} is thrown irrelevant to * {@code throwIAE} value. > src/java.base/share/classes/sun/net/util/IPAddressUtil.java line 141: > >> 139: * @param src input string >> 140: * @param throwIAE {@code "true"} - throw {@code IllegalArgumentException} when cannot be parsed as IPv4 address string; >> 141: * {@code "false"} - throw {@code "IllegalArgumentException"} only when IPv4 address string is ambiguous. > > Are these double quotes around `true`, `false`, `null` and `IllegalArgumentException` intentional? It seems odd to have those double quotes when (rightly) using `{@code}`. Nope, there are not intentional - a leftover from the fix prototyping stage. Will remove them. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15775#discussion_r1352771068 PR Review Comment: https://git.openjdk.org/jdk/pull/15775#discussion_r1352772971 From michaelm at openjdk.org Tue Oct 10 15:44:13 2023 From: michaelm at openjdk.org (Michael McMahon) Date: Tue, 10 Oct 2023 15:44:13 GMT Subject: RFR: 8272215: Add InetAddress methods for parsing IP address literals [v2] In-Reply-To: References: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.e3b03591-2bca-44a1-805d-2cb1e4af30a1@github.com> Message-ID: On Sat, 23 Sep 2023 17:28:55 GMT, Aleksei Efimov wrote: >> ### Summary >> >> The changes in this PR add new API to `java.net.InetAddress`, `java.net.Inet4Address`, and >> `java.net.Inet6Address` classes to parse IP address literals: >> ``` >> method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lang.String) >> method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) >> method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) >> ``` >> >> ### How new methods differ from existing ones >> >> These methods differ from `InetAddress.getByName` and `InetAddress.getAllByName` in the following ways: >> 1. If a string supplied is not an address literal it is not forwarded to the system-wide resolver, but IllegalArgumentException is thrown instead. The system-wide resolver is never called from these new methods. >> 2. No reverse lookup is performed to resolve a hostname for the supplied address literal - the `InetAddress[46 ]` instances returned by the new `ofLiteral` API has no hostname set. >> 3. Each `ofLiteral` static method returns addresses of its class only. It gives the ability to check if an IP address literal is of a specific address type. >> >> ### The list of noteworthy changes >> - `IPv4-mapped IPv6 address` and `IPv4-compatible IPv6 addresses` require some special handling in the new API to implement all supported IP address types. >> - All address literal parsing code has been moved from `InetAddress.getAllByName` to address type-specific `Inet4Address.parseAddressString` and `Inet6Address.parseAddressString` methods. >> - The text with scoped IPv6 addresses architecture draft IETF file has been replaced from `[draft-ietf-ipngwg-scoping-arch-04.txt]` to reference `RFC 4007: IPv6 Scoped Address Architecture`. The "RFC 4007" has been also added as `@ spec` into Inet6Address class-level Javadoc. >> >> ### Testing >> >> `jdk-tier1`, `jdk-tier2`, and `jdk-tier3` test sets show no failure with the changes. >> >> `java/net` JCK tests are failing with new methods added failure (CSR is planned for this change): >> >> Added Methods >> ------------- >> >> java.net.Inet4Address: method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) >> java.net.Inet6Address: method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) >> java.net.InetAddress: method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lan... > > Aleksei Efimov has updated the pull request incrementally with two additional commits since the last revision: > > - updates for Inet6Address.ofLiteral return type, javadoc and the regression test > - add null checks and NPE to methods javadoc src/java.base/share/classes/java/net/Inet4Address.java line 163: > 161: * Inet4Address.ofLiteral("02130706689") ==> /127.0.1.1 > 162: * } > 163: *

If the provided address literal cannot represent a valid IPv4 address an I think this behavior is the same as existing methods, except that only the decimal format is supported? I wonder is it really necessary to describe it here, as it it would be quite an arcane usage, and the section in the class doc "Textual representation if IP addresses" already partially covers it. The snippet example with the leading zero seems to be implying that octal format is not supported, but without really saying it out loud. Maybe the apidoc for the method could just say that the decimal formats are the only ones supported, but otherwise refer to the class docs for how the different variants work ? And maybe move the snippet there as well? src/java.base/share/classes/java/net/Inet6Address.java line 525: > 523: * parsed as an IPv6 address literal. > 524: * @throws NullPointerException if the {@code ipv6AddressLiteral} is {@code null}. > 525: */ Similar comment to Inet4Address. The snippet should be incorporated into the general class docs section "Textual representation of IP addresses" and the apidoc here should limit itself to any limitations that only apply to this method imo. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15775#discussion_r1352797174 PR Review Comment: https://git.openjdk.org/jdk/pull/15775#discussion_r1352812605 From michaelm at openjdk.org Tue Oct 10 16:20:14 2023 From: michaelm at openjdk.org (Michael McMahon) Date: Tue, 10 Oct 2023 16:20:14 GMT Subject: RFR: 8272215: Add InetAddress methods for parsing IP address literals [v2] In-Reply-To: References: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.e3b03591-2bca-44a1-805d-2cb1e4af30a1@github.com> Message-ID: On Tue, 10 Oct 2023 15:40:49 GMT, Michael McMahon wrote: >> Aleksei Efimov has updated the pull request incrementally with two additional commits since the last revision: >> >> - updates for Inet6Address.ofLiteral return type, javadoc and the regression test >> - add null checks and NPE to methods javadoc > > src/java.base/share/classes/java/net/Inet6Address.java line 525: > >> 523: * parsed as an IPv6 address literal. >> 524: * @throws NullPointerException if the {@code ipv6AddressLiteral} is {@code null}. >> 525: */ > > Similar comment to Inet4Address. The snippet should be incorporated into the general class docs section "Textual representation of IP addresses" and the apidoc here should limit itself to any limitations that only apply to this method imo. My mistake, it looks like we don't support the octal or hexadecimal formats in the existing `getByName` method, which is good news! But, I think the comments above still apply in terms of moving the snippets to the class level docs, and maybe specifying there also that we only support the decimal literals ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15775#discussion_r1352862018 From aefimov at openjdk.org Tue Oct 10 16:42:14 2023 From: aefimov at openjdk.org (Aleksei Efimov) Date: Tue, 10 Oct 2023 16:42:14 GMT Subject: RFR: 8272215: Add InetAddress methods for parsing IP address literals [v3] In-Reply-To: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.e3b03591-2bca-44a1-805d-2cb1e4af30a1@github.com> References: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.e3b03591-2bca-44a1-805d-2cb1e4af30a1@github.com> Message-ID: <24cauXWCzLb4UoF8E9PmS8_KI_rFiX-LY0qPNEuvbQM=.9beef864-6af8-408d-a52f-8e472c8a64cf@github.com> > ### Summary > > The changes in this PR add new API to `java.net.InetAddress`, `java.net.Inet4Address`, and > `java.net.Inet6Address` classes to parse IP address literals: > ``` > method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lang.String) > method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) > method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) > ``` > > ### How new methods differ from existing ones > > These methods differ from `InetAddress.getByName` and `InetAddress.getAllByName` in the following ways: > 1. If a string supplied is not an address literal it is not forwarded to the system-wide resolver, but IllegalArgumentException is thrown instead. The system-wide resolver is never called from these new methods. > 2. No reverse lookup is performed to resolve a hostname for the supplied address literal - the `InetAddress[46 ]` instances returned by the new `ofLiteral` API has no hostname set. > 3. Each `ofLiteral` static method returns addresses of its class only. It gives the ability to check if an IP address literal is of a specific address type. > > ### The list of noteworthy changes > - `IPv4-mapped IPv6 address` and `IPv4-compatible IPv6 addresses` require some special handling in the new API to implement all supported IP address types. > - All address literal parsing code has been moved from `InetAddress.getAllByName` to address type-specific `Inet4Address.parseAddressString` and `Inet6Address.parseAddressString` methods. > - The text with scoped IPv6 addresses architecture draft IETF file has been replaced from `[draft-ietf-ipngwg-scoping-arch-04.txt]` to reference `RFC 4007: IPv6 Scoped Address Architecture`. The "RFC 4007" has been also added as `@ spec` into Inet6Address class-level Javadoc. > > ### Testing > > `jdk-tier1`, `jdk-tier2`, and `jdk-tier3` test sets show no failure with the changes. > > `java/net` JCK tests are failing with new methods added failure (CSR is planned for this change): > > Added Methods > ------------- > > java.net.Inet4Address: method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) > java.net.Inet6Address: method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) > java.net.InetAddress: method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lang.String) Aleksei Efimov 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: - Merge branch 'master' into JDK-8272215_API_parse_IP_literals - update javadoc of internal utility methods. - updates for Inet6Address.ofLiteral return type, javadoc and the regression test - add null checks and NPE to methods javadoc - 8272215: Add InetAddress methods for parsing IP address literals ------------- Changes: - all: https://git.openjdk.org/jdk/pull/15775/files - new: https://git.openjdk.org/jdk/pull/15775/files/e72c2c96..6b7ff713 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=15775&range=02 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=15775&range=01-02 Stats: 50909 lines in 1164 files changed: 28769 ins; 14746 del; 7394 mod Patch: https://git.openjdk.org/jdk/pull/15775.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/15775/head:pull/15775 PR: https://git.openjdk.org/jdk/pull/15775 From dfuchs at openjdk.org Tue Oct 10 17:23:18 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Tue, 10 Oct 2023 17:23:18 GMT Subject: RFR: 8272215: Add InetAddress methods for parsing IP address literals [v3] In-Reply-To: <24cauXWCzLb4UoF8E9PmS8_KI_rFiX-LY0qPNEuvbQM=.9beef864-6af8-408d-a52f-8e472c8a64cf@github.com> References: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.e3b03591-2bca-44a1-805d-2cb1e4af30a1@github.com> <24cauXWCzLb4UoF8E9PmS8_KI_rFiX-LY0qPNEuvbQM=.9beef864-6af8-408d-a52f-8e472c8a64cf@github.com> Message-ID: On Tue, 10 Oct 2023 16:42:14 GMT, Aleksei Efimov wrote: >> ### Summary >> >> The changes in this PR add new API to `java.net.InetAddress`, `java.net.Inet4Address`, and >> `java.net.Inet6Address` classes to parse IP address literals: >> ``` >> method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lang.String) >> method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) >> method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) >> ``` >> >> ### How new methods differ from existing ones >> >> These methods differ from `InetAddress.getByName` and `InetAddress.getAllByName` in the following ways: >> 1. If a string supplied is not an address literal it is not forwarded to the system-wide resolver, but IllegalArgumentException is thrown instead. The system-wide resolver is never called from these new methods. >> 2. No reverse lookup is performed to resolve a hostname for the supplied address literal - the `InetAddress[46 ]` instances returned by the new `ofLiteral` API has no hostname set. >> 3. Each `ofLiteral` static method returns addresses of its class only. It gives the ability to check if an IP address literal is of a specific address type. >> >> ### The list of noteworthy changes >> - `IPv4-mapped IPv6 address` and `IPv4-compatible IPv6 addresses` require some special handling in the new API to implement all supported IP address types. >> - All address literal parsing code has been moved from `InetAddress.getAllByName` to address type-specific `Inet4Address.parseAddressString` and `Inet6Address.parseAddressString` methods. >> - The text with scoped IPv6 addresses architecture draft IETF file has been replaced from `[draft-ietf-ipngwg-scoping-arch-04.txt]` to reference `RFC 4007: IPv6 Scoped Address Architecture`. The "RFC 4007" has been also added as `@ spec` into Inet6Address class-level Javadoc. >> >> ### Testing >> >> `jdk-tier1`, `jdk-tier2`, and `jdk-tier3` test sets show no failure with the changes. >> >> `java/net` JCK tests are failing with new methods added failure (CSR is planned for this change): >> >> Added Methods >> ------------- >> >> java.net.Inet4Address: method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) >> java.net.Inet6Address: method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) >> java.net.InetAddress: method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lan... > > Aleksei Efimov 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: > > - Merge branch 'master' into JDK-8272215_API_parse_IP_literals > - update javadoc of internal utility methods. > - updates for Inet6Address.ofLiteral return type, javadoc and the regression test > - add null checks and NPE to methods javadoc > - 8272215: Add InetAddress methods for parsing IP address literals src/java.base/share/classes/java/net/Inet4Address.java line 180: > 178: > 179: /** > 180: * Parses string as an IPv4 address literal. Suggestion: * Parses the given string as an IPv4 address literal. src/java.base/share/classes/java/net/Inet4Address.java line 182: > 180: * Parses string as an IPv4 address literal. > 181: * If string contains a non-parsable literal and {@code throwIAE} is set to {@code false} > 182: * - {@code null} is returned. Suggestion: * If the given {@code addressLiteral} string cannot be parsed as an IPv4 address literal * and {@code throwIAE} is {@code false}, {@code null} is returned. src/java.base/share/classes/java/net/Inet4Address.java line 184: > 182: * - {@code null} is returned. > 183: * If string contains a non-parsable literal and {@code throwIAE} is set to {@code true} > 184: * - {@code IllegalArgumentException} is thrown. Suggestion: * If the given {@code addressLiteral} string cannot be parsed as an IPv4 address literal * and {@code throwIAE} is {@code true}, an {@code IllegalArgumentException} is thrown. src/java.base/share/classes/java/net/Inet4Address.java line 190: > 188: * @param addressLiteral IPv4 address literal to parse > 189: * @param throwIAE throw {@code IllegalArgumentException} if the > 190: * literal cannot be parsed as an IPv4 address literal. Suggestion: * @param throwIAE whether to throw {@code IllegalArgumentException} if the * given {@code addressLiteral} string cannot be parsed as * an IPv4 address literal. src/java.base/share/classes/java/net/Inet4Address.java line 195: > 193: * @throws IllegalArgumentException if ambiguous IPv4 literal is specified, > 194: * or non-parsable IPv4 literal is specified with {@code throwIAE} set to > 195: * {@code true}. * @throws IllegalArgumentException if the given {@code addressLiteral} string * cannot be parsed as an IPv4 address literal and {@code throwIAE} is {@code true}. * An {@code IllegalArgumentException} is also thrown regardless of the value of * {@code throwIAE} if the given {@code addressLiteral} string is ambiguous, that is, * it cannot be parsed as a valid IPv4 address literal using decimal notation but could be * interpreted as an IPv4 address in some other representation (octal, hexadecimal, or mixed) ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15775#discussion_r1352956961 PR Review Comment: https://git.openjdk.org/jdk/pull/15775#discussion_r1352979935 PR Review Comment: https://git.openjdk.org/jdk/pull/15775#discussion_r1352986216 PR Review Comment: https://git.openjdk.org/jdk/pull/15775#discussion_r1353001177 PR Review Comment: https://git.openjdk.org/jdk/pull/15775#discussion_r1353026855 From prr at openjdk.org Tue Oct 10 20:39:47 2023 From: prr at openjdk.org (Phil Race) Date: Tue, 10 Oct 2023 20:39:47 GMT Subject: RFR: 8317696: Fix compilation with clang-16 [v3] In-Reply-To: References: Message-ID: On Mon, 9 Oct 2023 18:29:26 GMT, Alexey Ivanov wrote: >> Jan Kratochvil has updated the pull request incrementally with one additional commit since the last revision: >> >> Remove declaration changes which are not required >> - suggested by djelinski > > src/java.desktop/unix/native/common/awt/awt_GraphicsEnv.h line 53: > >> 51: #define MITSHM_PERM_OWNER (0600) >> 52: >> 53: extern int XShmQueryExtension(Display* dpy); > > I wonder if it's even needed here: the declaration should come from `X11/extensions/XShm.h` which is included. I agree, but I wonder why it was ever added ? Near as I can tell its been there since the SHM code was added in 1.4 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16092#discussion_r1353307160 From mbaesken at openjdk.org Wed Oct 11 08:08:05 2023 From: mbaesken at openjdk.org (Matthias Baesken) Date: Wed, 11 Oct 2023 08:08:05 GMT Subject: RFR: JDK-8317866: replace NET_SocketAvailable Message-ID: When doing [JDK-8317603](https://bugs.openjdk.org/browse/JDK-8317603), it became clear that NET_SocketAvailable should be replaced. ------------- Commit messages: - JDK-8317866 Changes: https://git.openjdk.org/jdk/pull/16139/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16139&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8317866 Stats: 34 lines in 4 files changed: 4 ins; 27 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/16139.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/16139/head:pull/16139 PR: https://git.openjdk.org/jdk/pull/16139 From jkratochvil at openjdk.org Wed Oct 11 09:27:30 2023 From: jkratochvil at openjdk.org (Jan Kratochvil) Date: Wed, 11 Oct 2023 09:27:30 GMT Subject: RFR: 8317696: Fix compilation with clang-16 [v4] In-Reply-To: References: Message-ID: > `--with-toolchain-type=clang` fails the compilation for me with `clang-16.0.6-3.fc38.x86_64` > > While the warnings can be disabled I find better to just fix them. The GTK prototypes in JDK reported by clang are either missing or wrong. > > > src/java.base/unix/native/libnet/DefaultProxySelector.c:378:41: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > proxies = (*g_proxy_resolver_lookup)(resolver, uri, NULL, &error); > ^ > src/java.base/unix/native/libnet/DefaultProxySelector.c:397:63: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > (*g_network_address_parse_uri)(proxies[i], 0, > ^ > src/java.base/unix/native/libnet/DefaultProxySelector.c:402:70: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > phost = (*g_network_address_get_hostname)(conn); > ^ > src/java.base/unix/native/libnet/DefaultProxySelector.c:403:66: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > pport = (*g_network_address_get_port)(conn); > ^ > src/java.base/unix/native/libnet/DefaultProxySelector.c:445:22: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > (*g_strfreev)(proxies); > ^ > src/java.base/unix/native/libnet/DefaultProxySelector.c:448:25: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > (*g_clear_error)(&error); > ^ > Compiling X11Renderer.c (for libawt_headless.so) > In file included from src/java.desktop/unix/native/common/java2d/x11/X11PMBlitLoops.c:29: > In file included from src/java.desktop/unix/native/common/java2d/x11/X11SurfaceData.h:29: > src/java.desktop/unix/native/common/aw... Jan Kratochvil has updated the pull request incrementally with one additional commit since the last revision: Remove the XShmQueryExtension declaration completely. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/16092/files - new: https://git.openjdk.org/jdk/pull/16092/files/fa2c32e4..8e0d079c Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=16092&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=16092&range=02-03 Stats: 2 lines in 1 file changed: 0 ins; 2 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/16092.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/16092/head:pull/16092 PR: https://git.openjdk.org/jdk/pull/16092 From jkratochvil at openjdk.org Wed Oct 11 09:27:33 2023 From: jkratochvil at openjdk.org (Jan Kratochvil) Date: Wed, 11 Oct 2023 09:27:33 GMT Subject: RFR: 8317696: Fix compilation with clang-16 [v3] In-Reply-To: References: Message-ID: On Tue, 10 Oct 2023 20:37:07 GMT, Phil Race wrote: >> src/java.desktop/unix/native/common/awt/awt_GraphicsEnv.h line 53: >> >>> 51: #define MITSHM_PERM_OWNER (0600) >>> 52: >>> 53: extern int XShmQueryExtension(Display* dpy); >> >> I wonder if it's even needed here: the declaration should come from `X11/extensions/XShm.h` which is included. > > I agree, but I wonder why it was ever added ? Near as I can tell its been there since the SHM code was added in 1.4 So I have removed the declaration. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16092#discussion_r1354546381 From dfuchs at openjdk.org Wed Oct 11 10:33:50 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Wed, 11 Oct 2023 10:33:50 GMT Subject: RFR: 8317808: HTTP/2 stream cancelImpl may leave subscriber registered Message-ID: Some of the ThrowingSubscriberXxx tests (typically those that use a streaming body) have been observed failing intermittently (though rarely) in timeout. The error message printed at the end showed that some HTTP/2 stream subscribers had not been properly deregistered when an exception was thrown in GET_BODY. The issue appears to be a race condition between cancelImpl and schedule where the scheduler `sched` may get stopped before the subscriber is exceptionally completed. A simple fix is to ensure that cancelImpl will complete the subscriber, if needed. ------------- Commit messages: - 8317808 Changes: https://git.openjdk.org/jdk/pull/16144/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16144&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8317808 Stats: 36 lines in 4 files changed: 29 ins; 4 del; 3 mod Patch: https://git.openjdk.org/jdk/pull/16144.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/16144/head:pull/16144 PR: https://git.openjdk.org/jdk/pull/16144 From dfuchs at openjdk.org Wed Oct 11 10:45:10 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Wed, 11 Oct 2023 10:45:10 GMT Subject: RFR: JDK-8317866: replace NET_SocketAvailable In-Reply-To: References: Message-ID: On Wed, 11 Oct 2023 07:58:21 GMT, Matthias Baesken wrote: > When doing [JDK-8317603](https://bugs.openjdk.org/browse/JDK-8317603), it became clear that NET_SocketAvailable should be replaced. This looks reasonable. Thanks for the cleanup! Let me run some test before approving. ------------- PR Review: https://git.openjdk.org/jdk/pull/16139#pullrequestreview-1670752677 From alanb at openjdk.org Wed Oct 11 11:11:15 2023 From: alanb at openjdk.org (Alan Bateman) Date: Wed, 11 Oct 2023 11:11:15 GMT Subject: RFR: JDK-8317866: replace NET_SocketAvailable In-Reply-To: References: Message-ID: On Wed, 11 Oct 2023 07:58:21 GMT, Matthias Baesken wrote: > When doing [JDK-8317603](https://bugs.openjdk.org/browse/JDK-8317603), it became clear that NET_SocketAvailable should be replaced. Marked as reviewed by alanb (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/16139#pullrequestreview-1670860910 From dfuchs at openjdk.org Wed Oct 11 16:40:23 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Wed, 11 Oct 2023 16:40:23 GMT Subject: RFR: JDK-8317866: replace NET_SocketAvailable In-Reply-To: References: Message-ID: On Wed, 11 Oct 2023 07:58:21 GMT, Matthias Baesken wrote: > When doing [JDK-8317603](https://bugs.openjdk.org/browse/JDK-8317603), it became clear that NET_SocketAvailable should be replaced. Marked as reviewed by dfuchs (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/16139#pullrequestreview-1671817764 From mbaesken at openjdk.org Thu Oct 12 07:25:23 2023 From: mbaesken at openjdk.org (Matthias Baesken) Date: Thu, 12 Oct 2023 07:25:23 GMT Subject: RFR: JDK-8317866: replace NET_SocketAvailable In-Reply-To: References: Message-ID: <2LvAHcncM4Kz_4yLH4KfixikvW2sV087KwHsJnsSKCc=.cf19c19b-ffa0-4806-9d84-cb6f373edca5@github.com> On Wed, 11 Oct 2023 07:58:21 GMT, Matthias Baesken wrote: > When doing [JDK-8317603](https://bugs.openjdk.org/browse/JDK-8317603), it became clear that NET_SocketAvailable should be replaced. Hi Daniel and Alan, thanks for the reviews ! ------------- PR Comment: https://git.openjdk.org/jdk/pull/16139#issuecomment-1759071633 From mbaesken at openjdk.org Thu Oct 12 07:25:25 2023 From: mbaesken at openjdk.org (Matthias Baesken) Date: Thu, 12 Oct 2023 07:25:25 GMT Subject: Integrated: JDK-8317866: replace NET_SocketAvailable In-Reply-To: References: Message-ID: On Wed, 11 Oct 2023 07:58:21 GMT, Matthias Baesken wrote: > When doing [JDK-8317603](https://bugs.openjdk.org/browse/JDK-8317603), it became clear that NET_SocketAvailable should be replaced. This pull request has now been integrated. Changeset: 424de295 Author: Matthias Baesken URL: https://git.openjdk.org/jdk/commit/424de295a6ca19e9aacb7e1e1c9b5f955064cb65 Stats: 34 lines in 4 files changed: 4 ins; 27 del; 3 mod 8317866: replace NET_SocketAvailable Reviewed-by: dfuchs, alanb ------------- PR: https://git.openjdk.org/jdk/pull/16139 From alanb at openjdk.org Thu Oct 12 13:07:48 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 12 Oct 2023 13:07:48 GMT Subject: RFR: 8316927: JFR: Move shouldCommit check earlier for socket events In-Reply-To: References: Message-ID: On Mon, 25 Sep 2023 16:57:46 GMT, Erik Gahlin wrote: > Hi, > > The events for socket read and socket write retrieves the remote address even in cases where the event didn't exceed the threshold. By moving the shouldCommit check earlier, it can be avoided. > > Testing: jdk/jdk/jfr > > Thanks > Erik Changes in this area only require one reviewer so it's okay to integrate if you want. ------------- PR Comment: https://git.openjdk.org/jdk/pull/15908#issuecomment-1759495468 From dfuchs at openjdk.org Thu Oct 12 14:02:04 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Thu, 12 Oct 2023 14:02:04 GMT Subject: RFR: 8316927: JFR: Move shouldCommit check earlier for socket events In-Reply-To: References: Message-ID: On Mon, 25 Sep 2023 16:57:46 GMT, Erik Gahlin wrote: > Hi, > > The events for socket read and socket write retrieves the remote address even in cases where the event didn't exceed the threshold. By moving the shouldCommit check earlier, it can be avoided. > > Testing: jdk/jdk/jfr > > Thanks > Erik LGTM - I was expecting @tprinzing to review too, but yes you can integrate if you want. ------------- Marked as reviewed by dfuchs (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/15908#pullrequestreview-1674252334 From mbaesken at openjdk.org Thu Oct 12 14:10:25 2023 From: mbaesken at openjdk.org (Matthias Baesken) Date: Thu, 12 Oct 2023 14:10:25 GMT Subject: RFR: JDK-8318006: remove unused net related coding Message-ID: [JDK-8253119](https://bugs.openjdk.org/browse/JDK-8253119) removed the old socket implementation code but it did leave some unused code behind, it would be good to remove these unused functions. ------------- Commit messages: - JDK-8318006 Changes: https://git.openjdk.org/jdk/pull/16164/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16164&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8318006 Stats: 141 lines in 3 files changed: 0 ins; 141 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/16164.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/16164/head:pull/16164 PR: https://git.openjdk.org/jdk/pull/16164 From alanb at openjdk.org Thu Oct 12 14:26:41 2023 From: alanb at openjdk.org (Alan Bateman) Date: Thu, 12 Oct 2023 14:26:41 GMT Subject: RFR: JDK-8318006: remove unused net related coding In-Reply-To: References: Message-ID: On Thu, 12 Oct 2023 13:14:31 GMT, Matthias Baesken wrote: > [JDK-8253119](https://bugs.openjdk.org/browse/JDK-8253119) removed the old socket implementation code but it did leave some unused code behind, it would be good to remove these unused functions. Looks okay, I wonder if the list of include files can be pruned as part of this. ------------- Marked as reviewed by alanb (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/16164#pullrequestreview-1674300699 From tprinzing at openjdk.org Thu Oct 12 14:47:38 2023 From: tprinzing at openjdk.org (Tim Prinzing) Date: Thu, 12 Oct 2023 14:47:38 GMT Subject: RFR: 8316927: JFR: Move shouldCommit check earlier for socket events In-Reply-To: References: Message-ID: On Mon, 25 Sep 2023 16:57:46 GMT, Erik Gahlin wrote: > Hi, > > The events for socket read and socket write retrieves the remote address even in cases where the event didn't exceed the threshold. By moving the shouldCommit check earlier, it can be avoided. > > Testing: jdk/jdk/jfr > > Thanks > Erik I was planning to change the convenience function to take functions as arguments. With this change there is a bunch of duplicated code. I was planning to push the change for JDK-8310978 today, but I guess that will have to wait as it's impacted by this. ------------- PR Comment: https://git.openjdk.org/jdk/pull/15908#issuecomment-1759755174 From egahlin at openjdk.org Thu Oct 12 15:51:28 2023 From: egahlin at openjdk.org (Erik Gahlin) Date: Thu, 12 Oct 2023 15:51:28 GMT Subject: RFR: 8316927: JFR: Move shouldCommit check earlier for socket events In-Reply-To: References: Message-ID: <5CpsTt095Fp76yWPbqfYuiWBqB5HoJPyTIhkNifUBP8=.73812635-fefd-4fd3-8366-484bb9e0c0c6@github.com> On Mon, 25 Sep 2023 16:57:46 GMT, Erik Gahlin wrote: > Hi, > > The events for socket read and socket write retrieves the remote address even in cases where the event didn't exceed the threshold. By moving the shouldCommit check earlier, it can be avoided. > > Testing: jdk/jdk/jfr > > Thanks > Erik > I was planning to change the convenience function to take functions as arguments. With this change there is a bunch of duplicated code. > > I was planning to push the change for JDK-8310978 today, but I guess that will have to wait as it's impacted by this. > I was planning to change the convenience function to take functions as arguments. With this change there is a bunch of duplicated code. > > I was planning to push the change for JDK-8310978 today, but I guess that will have to wait as it's impacted by this. If it's a lambda, it could be problematic. I have another change coming up, which also motivated this PR. It's still in draft, need to decide on the syntax, but it adds an annotation that can filter out stack frames, for example the emit() method. A lambda wouldn't get a proper method name. https://github.com/openjdk/jdk/pull/15867 ------------- PR Comment: https://git.openjdk.org/jdk/pull/15908#issuecomment-1759888327 From dfuchs at openjdk.org Thu Oct 12 16:47:28 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Thu, 12 Oct 2023 16:47:28 GMT Subject: RFR: 8317808: HTTP/2 stream cancelImpl may leave subscriber registered [v2] In-Reply-To: References: Message-ID: > Some of the ThrowingSubscriberXxx tests (typically those that use a streaming body) have been observed failing intermittently (though rarely) in timeout. The error message printed at the end showed that some HTTP/2 stream subscribers had not been properly deregistered when an exception was thrown in GET_BODY. > > The issue appears to be a race condition between `cancelImpl` and `schedule` where the scheduler `sched` may get stopped before the subscriber is exceptionally completed. > > A simple fix is to ensure that `cancelImpl` will complete the subscriber, if needed. Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: Simplify the fix ------------- Changes: - all: https://git.openjdk.org/jdk/pull/16144/files - new: https://git.openjdk.org/jdk/pull/16144/files/4cc23df3..a97ebe20 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=16144&range=01 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=16144&range=00-01 Stats: 9 lines in 1 file changed: 0 ins; 7 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/16144.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/16144/head:pull/16144 PR: https://git.openjdk.org/jdk/pull/16144 From aefimov at openjdk.org Fri Oct 13 01:26:26 2023 From: aefimov at openjdk.org (Aleksei Efimov) Date: Fri, 13 Oct 2023 01:26:26 GMT Subject: RFR: 8272215: Add InetAddress methods for parsing IP address literals [v4] In-Reply-To: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.e3b03591-2bca-44a1-805d-2cb1e4af30a1@github.com> References: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.e3b03591-2bca-44a1-805d-2cb1e4af30a1@github.com> Message-ID: > ### Summary > > The changes in this PR add new API to `java.net.InetAddress`, `java.net.Inet4Address`, and > `java.net.Inet6Address` classes to parse IP address literals: > ``` > method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lang.String) > method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) > method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) > ``` > > ### How new methods differ from existing ones > > These methods differ from `InetAddress.getByName` and `InetAddress.getAllByName` in the following ways: > 1. If a string supplied is not an address literal it is not forwarded to the system-wide resolver, but IllegalArgumentException is thrown instead. The system-wide resolver is never called from these new methods. > 2. No reverse lookup is performed to resolve a hostname for the supplied address literal - the `InetAddress[46 ]` instances returned by the new `ofLiteral` API has no hostname set. > 3. Each `ofLiteral` static method returns addresses of its class only. It gives the ability to check if an IP address literal is of a specific address type. > > ### The list of noteworthy changes > - `IPv4-mapped IPv6 address` and `IPv4-compatible IPv6 addresses` require some special handling in the new API to implement all supported IP address types. > - All address literal parsing code has been moved from `InetAddress.getAllByName` to address type-specific `Inet4Address.parseAddressString` and `Inet6Address.parseAddressString` methods. > - The text with scoped IPv6 addresses architecture draft IETF file has been replaced from `[draft-ietf-ipngwg-scoping-arch-04.txt]` to reference `RFC 4007: IPv6 Scoped Address Architecture`. The "RFC 4007" has been also added as `@ spec` into Inet6Address class-level Javadoc. > > ### Testing > > `jdk-tier1`, `jdk-tier2`, and `jdk-tier3` test sets show no failure with the changes. > > `java/net` JCK tests are failing with new methods added failure (CSR is planned for this change): > > Added Methods > ------------- > > java.net.Inet4Address: method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) > java.net.Inet6Address: method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) > java.net.InetAddress: method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lang.String) Aleksei Efimov has updated the pull request incrementally with three additional commits since the last revision: - test update: run IPv6-scoped address with wrong scope-id test case only with at least 2 NI - Moving snippets to class-level docs per Michael suggestion, associated doc changes - Daniel suggestions ------------- Changes: - all: https://git.openjdk.org/jdk/pull/15775/files - new: https://git.openjdk.org/jdk/pull/15775/files/6b7ff713..d65e9d20 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=15775&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=15775&range=02-03 Stats: 115 lines in 4 files changed: 44 ins; 38 del; 33 mod Patch: https://git.openjdk.org/jdk/pull/15775.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/15775/head:pull/15775 PR: https://git.openjdk.org/jdk/pull/15775 From lucy at openjdk.org Fri Oct 13 07:22:16 2023 From: lucy at openjdk.org (Lutz Schmidt) Date: Fri, 13 Oct 2023 07:22:16 GMT Subject: RFR: JDK-8318006: remove unused net related coding In-Reply-To: References: Message-ID: On Thu, 12 Oct 2023 13:14:31 GMT, Matthias Baesken wrote: > [JDK-8253119](https://bugs.openjdk.org/browse/JDK-8253119) removed the old socket implementation code but it did leave some unused code behind, it would be good to remove these unused functions. LGTM. ------------- Marked as reviewed by lucy (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/16164#pullrequestreview-1675865732 From mbaesken at openjdk.org Fri Oct 13 08:56:24 2023 From: mbaesken at openjdk.org (Matthias Baesken) Date: Fri, 13 Oct 2023 08:56:24 GMT Subject: RFR: JDK-8318006: remove unused net related coding In-Reply-To: References: Message-ID: <6V0VKYOfrBos-3_T1ar9jnwIbU6zsmXa0nq-5ailgkE=.0e302f22-0b39-48e9-b4f2-bc43ca750a6d@github.com> On Thu, 12 Oct 2023 13:14:31 GMT, Matthias Baesken wrote: > [JDK-8253119](https://bugs.openjdk.org/browse/JDK-8253119) removed the old socket implementation code but it did leave some unused code behind, it would be good to remove these unused functions. Hi Alan and Lutz , thanks for the reviews ! ------------- PR Comment: https://git.openjdk.org/jdk/pull/16164#issuecomment-1761155546 From mbaesken at openjdk.org Fri Oct 13 08:56:25 2023 From: mbaesken at openjdk.org (Matthias Baesken) Date: Fri, 13 Oct 2023 08:56:25 GMT Subject: Integrated: JDK-8318006: remove unused net related coding In-Reply-To: References: Message-ID: On Thu, 12 Oct 2023 13:14:31 GMT, Matthias Baesken wrote: > [JDK-8253119](https://bugs.openjdk.org/browse/JDK-8253119) removed the old socket implementation code but it did leave some unused code behind, it would be good to remove these unused functions. This pull request has now been integrated. Changeset: 126f2ace Author: Matthias Baesken URL: https://git.openjdk.org/jdk/commit/126f2ace5d36c72a8fced27218a66e0b6f920f85 Stats: 141 lines in 3 files changed: 0 ins; 141 del; 0 mod 8318006: remove unused net related coding Reviewed-by: alanb, lucy ------------- PR: https://git.openjdk.org/jdk/pull/16164 From dfuchs at openjdk.org Fri Oct 13 09:19:20 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Fri, 13 Oct 2023 09:19:20 GMT Subject: RFR: 8272215: Add InetAddress methods for parsing IP address literals [v4] In-Reply-To: References: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.e3b03591-2bca-44a1-805d-2cb1e4af30a1@github.com> Message-ID: On Fri, 13 Oct 2023 01:26:26 GMT, Aleksei Efimov wrote: >> ### Summary >> >> The changes in this PR add new API to `java.net.InetAddress`, `java.net.Inet4Address`, and >> `java.net.Inet6Address` classes to parse IP address literals: >> ``` >> method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lang.String) >> method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) >> method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) >> ``` >> >> ### How new methods differ from existing ones >> >> These methods differ from `InetAddress.getByName` and `InetAddress.getAllByName` in the following ways: >> 1. If a string supplied is not an address literal it is not forwarded to the system-wide resolver, but IllegalArgumentException is thrown instead. The system-wide resolver is never called from these new methods. >> 2. No reverse lookup is performed to resolve a hostname for the supplied address literal - the `InetAddress[46 ]` instances returned by the new `ofLiteral` API has no hostname set. >> 3. Each `ofLiteral` static method returns addresses of its class only. It gives the ability to check if an IP address literal is of a specific address type. >> >> ### The list of noteworthy changes >> - `IPv4-mapped IPv6 address` and `IPv4-compatible IPv6 addresses` require some special handling in the new API to implement all supported IP address types. >> - All address literal parsing code has been moved from `InetAddress.getAllByName` to address type-specific `Inet4Address.parseAddressString` and `Inet6Address.parseAddressString` methods. >> - The text with scoped IPv6 addresses architecture draft IETF file has been replaced from `[draft-ietf-ipngwg-scoping-arch-04.txt]` to reference `RFC 4007: IPv6 Scoped Address Architecture`. The "RFC 4007" has been also added as `@ spec` into Inet6Address class-level Javadoc. >> >> ### Testing >> >> `jdk-tier1`, `jdk-tier2`, and `jdk-tier3` test sets show no failure with the changes. >> >> `java/net` JCK tests are failing with new methods added failure (CSR is planned for this change): >> >> Added Methods >> ------------- >> >> java.net.Inet4Address: method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) >> java.net.Inet6Address: method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) >> java.net.InetAddress: method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lan... > > Aleksei Efimov has updated the pull request incrementally with three additional commits since the last revision: > > - test update: run IPv6-scoped address with wrong scope-id test case only with at least 2 NI > - Moving snippets to class-level docs per Michael suggestion, associated doc changes > - Daniel suggestions Sorry for the back and forth suggestions - I hadn't noticed that "ambiguous" was already introduced earlier in the method description. I'd suggest the following refactoring to make it easier to read. src/java.base/share/classes/java/net/Inet4Address.java line 189: > 187: * and {@code throwIAE} is {@code true}, an {@code IllegalArgumentException} is thrown. > 188: * If string contains an {@linkplain IPAddressUtil#validateNumericFormatV4(String, boolean) > 189: * ambiguous literal} - {@code IllegalArgumentException} is thrown irrelevant to Suggestion: * Otherwise, if it can be considered as {@linkplain IPAddressUtil#validateNumericFormatV4(String, boolean) * an ambiguous literal} - {@code IllegalArgumentException} is thrown irrelevant to src/java.base/share/classes/java/net/Inet4Address.java line 190: > 188: * If string contains an {@linkplain IPAddressUtil#validateNumericFormatV4(String, boolean) > 189: * ambiguous literal} - {@code IllegalArgumentException} is thrown irrelevant to > 190: * {@code throwIAE} value. Suggestion: * {@code throwIAE} value. * * @apiNote * The given {@code addressLiteral} string is considered ambiguous if it cannot be parsed as * a valid IPv4 address literal using decimal notation, but could be * interpreted as an IPv4 address in some other representation (octal, hexadecimal, or mixed). src/java.base/share/classes/java/net/Inet4Address.java line 202: > 200: * {@code throwIAE} if the given {@code addressLiteral} string is ambiguous, that is, > 201: * it cannot be parsed as a valid IPv4 address literal using decimal notation but could be > 202: * interpreted as an IPv4 address in some other representation (octal, hexadecimal, or mixed). Suggestion: * @throws IllegalArgumentException if the given {@code addressLiteral} string * cannot be parsed as an IPv4 address literal and {@code throwIAE} is {@code true}, * or if it is considered ambiguous, regardless of the value of the value of * {@code throwIAE}. ------------- PR Review: https://git.openjdk.org/jdk/pull/15775#pullrequestreview-1676057283 PR Review Comment: https://git.openjdk.org/jdk/pull/15775#discussion_r1358006767 PR Review Comment: https://git.openjdk.org/jdk/pull/15775#discussion_r1357992180 PR Review Comment: https://git.openjdk.org/jdk/pull/15775#discussion_r1357995298 From aefimov at openjdk.org Fri Oct 13 12:19:11 2023 From: aefimov at openjdk.org (Aleksei Efimov) Date: Fri, 13 Oct 2023 12:19:11 GMT Subject: RFR: 8272215: Add InetAddress methods for parsing IP address literals [v5] In-Reply-To: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.e3b03591-2bca-44a1-805d-2cb1e4af30a1@github.com> References: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.e3b03591-2bca-44a1-805d-2cb1e4af30a1@github.com> Message-ID: > ### Summary > > The changes in this PR add new API to `java.net.InetAddress`, `java.net.Inet4Address`, and > `java.net.Inet6Address` classes to parse IP address literals: > ``` > method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lang.String) > method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) > method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) > ``` > > ### How new methods differ from existing ones > > These methods differ from `InetAddress.getByName` and `InetAddress.getAllByName` in the following ways: > 1. If a string supplied is not an address literal it is not forwarded to the system-wide resolver, but IllegalArgumentException is thrown instead. The system-wide resolver is never called from these new methods. > 2. No reverse lookup is performed to resolve a hostname for the supplied address literal - the `InetAddress[46 ]` instances returned by the new `ofLiteral` API has no hostname set. > 3. Each `ofLiteral` static method returns addresses of its class only. It gives the ability to check if an IP address literal is of a specific address type. > > ### The list of noteworthy changes > - `IPv4-mapped IPv6 address` and `IPv4-compatible IPv6 addresses` require some special handling in the new API to implement all supported IP address types. > - All address literal parsing code has been moved from `InetAddress.getAllByName` to address type-specific `Inet4Address.parseAddressString` and `Inet6Address.parseAddressString` methods. > - The text with scoped IPv6 addresses architecture draft IETF file has been replaced from `[draft-ietf-ipngwg-scoping-arch-04.txt]` to reference `RFC 4007: IPv6 Scoped Address Architecture`. The "RFC 4007" has been also added as `@ spec` into Inet6Address class-level Javadoc. > > ### Testing > > `jdk-tier1`, `jdk-tier2`, and `jdk-tier3` test sets show no failure with the changes. > > `java/net` JCK tests are failing with new methods added failure (CSR is planned for this change): > > Added Methods > ------------- > > java.net.Inet4Address: method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) > java.net.Inet6Address: method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) > java.net.InetAddress: method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lang.String) Aleksei Efimov has updated the pull request incrementally with one additional commit since the last revision: improve the ambiguous term readability according to Daniel comments ------------- Changes: - all: https://git.openjdk.org/jdk/pull/15775/files - new: https://git.openjdk.org/jdk/pull/15775/files/d65e9d20..4bd63f29 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=15775&range=04 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=15775&range=03-04 Stats: 12 lines in 1 file changed: 5 ins; 3 del; 4 mod Patch: https://git.openjdk.org/jdk/pull/15775.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/15775/head:pull/15775 PR: https://git.openjdk.org/jdk/pull/15775 From aefimov at openjdk.org Fri Oct 13 12:19:24 2023 From: aefimov at openjdk.org (Aleksei Efimov) Date: Fri, 13 Oct 2023 12:19:24 GMT Subject: RFR: 8272215: Add InetAddress methods for parsing IP address literals [v4] In-Reply-To: References: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.e3b03591-2bca-44a1-805d-2cb1e4af30a1@github.com> Message-ID: On Fri, 13 Oct 2023 09:08:33 GMT, Daniel Fuchs wrote: >> Aleksei Efimov has updated the pull request incrementally with three additional commits since the last revision: >> >> - test update: run IPv6-scoped address with wrong scope-id test case only with at least 2 NI >> - Moving snippets to class-level docs per Michael suggestion, associated doc changes >> - Daniel suggestions > > src/java.base/share/classes/java/net/Inet4Address.java line 190: > >> 188: * If string contains an {@linkplain IPAddressUtil#validateNumericFormatV4(String, boolean) >> 189: * ambiguous literal} - {@code IllegalArgumentException} is thrown irrelevant to >> 190: * {@code throwIAE} value. > > Suggestion: > > * {@code throwIAE} value. > * > * @apiNote > * The given {@code addressLiteral} string is considered ambiguous if it cannot be parsed as > * a valid IPv4 address literal using decimal notation, but could be > * interpreted as an IPv4 address in some other representation (octal, hexadecimal, or mixed). Thanks for the suggestions Daniel. They look reasonable to me, and improve the readability. Taken them aboard in 4bd63f29386a515d63879412f80d958046e6c8c2. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15775#discussion_r1358126045 From aefimov at openjdk.org Fri Oct 13 12:19:41 2023 From: aefimov at openjdk.org (Aleksei Efimov) Date: Fri, 13 Oct 2023 12:19:41 GMT Subject: RFR: 8272215: Add InetAddress methods for parsing IP address literals [v2] In-Reply-To: References: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.e3b03591-2bca-44a1-805d-2cb1e4af30a1@github.com> Message-ID: On Tue, 10 Oct 2023 16:17:21 GMT, Michael McMahon wrote: >> src/java.base/share/classes/java/net/Inet6Address.java line 525: >> >>> 523: * parsed as an IPv6 address literal. >>> 524: * @throws NullPointerException if the {@code ipv6AddressLiteral} is {@code null}. >>> 525: */ >> >> Similar comment to Inet4Address. The snippet should be incorporated into the general class docs section "Textual representation of IP addresses" and the apidoc here should limit itself to any limitations that only apply to this method imo. > > My mistake, it looks like we don't support the octal or hexadecimal formats in the existing `getByName` method, which is good news! > > But, I think the comments above still apply in terms of moving the snippets to the class level docs, and maybe specifying there also that we only support the decimal literals That is a good point Michael. The snippets were moved to class-level javadocs, and were modified a bit to limit the number of examples, and other small changes. Pushed as [e95858e](https://github.com/openjdk/jdk/pull/15775/commits/e95858ebb6039e9b5bbbca2a4730fcbed78747ca). ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15775#discussion_r1358130204 From michaelm at openjdk.org Fri Oct 13 13:44:43 2023 From: michaelm at openjdk.org (Michael McMahon) Date: Fri, 13 Oct 2023 13:44:43 GMT Subject: RFR: 8317808: HTTP/2 stream cancelImpl may leave subscriber registered [v2] In-Reply-To: References: Message-ID: On Thu, 12 Oct 2023 16:47:28 GMT, Daniel Fuchs wrote: >> Some of the ThrowingSubscriberXxx tests (typically those that use a streaming body) have been observed failing intermittently (though rarely) in timeout. The error message printed at the end showed that some HTTP/2 stream subscribers had not been properly deregistered when an exception was thrown in GET_BODY. >> >> The issue appears to be a race condition between `cancelImpl` and `schedule` where the scheduler `sched` may get stopped before the subscriber is exceptionally completed. >> >> A simple fix is to ensure that `cancelImpl` will complete the subscriber, if needed. > > Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: > > Simplify the fix src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java line 584: > 582: } > 583: return false; > 584: } Is this change here actually part of the fix, or something else that needed to be fixed? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16144#discussion_r1358283715 From dfuchs at openjdk.org Fri Oct 13 14:03:16 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Fri, 13 Oct 2023 14:03:16 GMT Subject: RFR: 8317808: HTTP/2 stream cancelImpl may leave subscriber registered [v2] In-Reply-To: References: Message-ID: <-BvfsgVp9qfa5QRZqR-pOxxB9Io07i9IULdIgLA1ccA=.7fb4545f-d423-4099-b8c1-8f6c0e617a10@github.com> On Fri, 13 Oct 2023 13:41:10 GMT, Michael McMahon wrote: >> Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: >> >> Simplify the fix > > src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java line 584: > >> 582: } >> 583: return false; >> 584: } > > Is this change here actually part of the fix, or something else that needed to be fixed? A bit of both. I was looking at why the subscriber didn't get properly unregistered and stumbled on this small issue. Tests showed that it wasn't sufficient to fix the issue so I continued debugging. The semantics of the method is that it should return `true` only if the subscriber was added to the list, so it really should have returned `false` here, and `true` only if `subscribers.add` was called and returned `true`. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16144#discussion_r1358300558 From michaelm at openjdk.org Fri Oct 13 14:29:20 2023 From: michaelm at openjdk.org (Michael McMahon) Date: Fri, 13 Oct 2023 14:29:20 GMT Subject: RFR: 8317808: HTTP/2 stream cancelImpl may leave subscriber registered [v2] In-Reply-To: References: Message-ID: On Thu, 12 Oct 2023 16:47:28 GMT, Daniel Fuchs wrote: >> Some of the ThrowingSubscriberXxx tests (typically those that use a streaming body) have been observed failing intermittently (though rarely) in timeout. The error message printed at the end showed that some HTTP/2 stream subscribers had not been properly deregistered when an exception was thrown in GET_BODY. >> >> The issue appears to be a race condition between `cancelImpl` and `schedule` where the scheduler `sched` may get stopped before the subscriber is exceptionally completed. >> >> A simple fix is to ensure that `cancelImpl` will complete the subscriber, if needed. > > Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: > > Simplify the fix Seems straight forward. LGTM ------------- Marked as reviewed by michaelm (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/16144#pullrequestreview-1676597872 From djelinski at openjdk.org Fri Oct 13 14:29:23 2023 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Fri, 13 Oct 2023 14:29:23 GMT Subject: RFR: 8317808: HTTP/2 stream cancelImpl may leave subscriber registered [v2] In-Reply-To: References: Message-ID: On Thu, 12 Oct 2023 16:47:28 GMT, Daniel Fuchs wrote: >> Some of the ThrowingSubscriberXxx tests (typically those that use a streaming body) have been observed failing intermittently (though rarely) in timeout. The error message printed at the end showed that some HTTP/2 stream subscribers had not been properly deregistered when an exception was thrown in GET_BODY. >> >> The issue appears to be a race condition between `cancelImpl` and `schedule` where the scheduler `sched` may get stopped before the subscriber is exceptionally completed. >> >> A simple fix is to ensure that `cancelImpl` will complete the subscriber, if needed. > > Daniel Fuchs has updated the pull request incrementally with one additional commit since the last revision: > > Simplify the fix Marked as reviewed by djelinski (Reviewer). ------------- PR Review: https://git.openjdk.org/jdk/pull/16144#pullrequestreview-1676617747 From dfuchs at openjdk.org Fri Oct 13 14:39:18 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Fri, 13 Oct 2023 14:39:18 GMT Subject: Integrated: 8317808: HTTP/2 stream cancelImpl may leave subscriber registered In-Reply-To: References: Message-ID: On Wed, 11 Oct 2023 10:25:28 GMT, Daniel Fuchs wrote: > Some of the ThrowingSubscriberXxx tests (typically those that use a streaming body) have been observed failing intermittently (though rarely) in timeout. The error message printed at the end showed that some HTTP/2 stream subscribers had not been properly deregistered when an exception was thrown in GET_BODY. > > The issue appears to be a race condition between `cancelImpl` and `schedule` where the scheduler `sched` may get stopped before the subscriber is exceptionally completed. > > A simple fix is to ensure that `cancelImpl` will complete the subscriber, if needed. This pull request has now been integrated. Changeset: 6273ab97 Author: Daniel Fuchs URL: https://git.openjdk.org/jdk/commit/6273ab97dc1a0d3c1f51ba94694d9594dd7593d4 Stats: 29 lines in 4 files changed: 22 ins; 4 del; 3 mod 8317808: HTTP/2 stream cancelImpl may leave subscriber registered Reviewed-by: michaelm, djelinski ------------- PR: https://git.openjdk.org/jdk/pull/16144 From duke at openjdk.org Fri Oct 13 16:59:27 2023 From: duke at openjdk.org (Terry Chow) Date: Fri, 13 Oct 2023 16:59:27 GMT Subject: RFR: 8308593: Add Keepalive Extended Socket Options Support for Windows [v4] In-Reply-To: References: <7yOv2rc-pawQNLJSkjIU_fP2Z0hofqh1SMvN0dihFUk=.75f29eed-dbc0-48b6-8e59-86750691e6c1@github.com> Message-ID: <1TjXly8LhR5oJUVfw3UnawdvuOLyvBnsIvqeaBZXOtQ=.13bf9012-28c9-42f7-9744-bf663e2993f6@github.com> On Thu, 20 Jul 2023 18:52:53 GMT, Terry Chow wrote: >> 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 incrementally with one additional commit since the last revision: > > Fixed inconsistent 'keep' vs. 'Keep' in method names Hello, a release note was added to the ticket awhile ago. Let me know if there's anything else I need to do or correct. Thanks again. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14232#issuecomment-1761822453 From dfuchs at openjdk.org Fri Oct 13 17:23:31 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Fri, 13 Oct 2023 17:23:31 GMT Subject: RFR: 8308593: Add Keepalive Extended Socket Options Support for Windows [v4] In-Reply-To: <1TjXly8LhR5oJUVfw3UnawdvuOLyvBnsIvqeaBZXOtQ=.13bf9012-28c9-42f7-9744-bf663e2993f6@github.com> References: <7yOv2rc-pawQNLJSkjIU_fP2Z0hofqh1SMvN0dihFUk=.75f29eed-dbc0-48b6-8e59-86750691e6c1@github.com> <1TjXly8LhR5oJUVfw3UnawdvuOLyvBnsIvqeaBZXOtQ=.13bf9012-28c9-42f7-9744-bf663e2993f6@github.com> Message-ID: <8Non0u57uw1TU1NqlwpBtpulNN7OVRhWKGFTIOH9KIo=.489cc32e-308b-4283-9860-4485bbfafa32@github.com> On Fri, 13 Oct 2023 16:56:23 GMT, Terry Chow wrote: >> Terry Chow has updated the pull request incrementally with one additional commit since the last revision: >> >> Fixed inconsistent 'keep' vs. 'Keep' in method names > > Hello, a release note was added to the ticket awhile ago. Let me know if there's anything else I need to do or correct. Thanks again. Thanks Terry @tkyc. I have made some updates and marked it DELIVERED. Can you double check that everything still looks good? ------------- PR Comment: https://git.openjdk.org/jdk/pull/14232#issuecomment-1761877877 From duke at openjdk.org Fri Oct 13 17:58:25 2023 From: duke at openjdk.org (Terry Chow) Date: Fri, 13 Oct 2023 17:58:25 GMT Subject: RFR: 8308593: Add Keepalive Extended Socket Options Support for Windows [v4] In-Reply-To: <8Non0u57uw1TU1NqlwpBtpulNN7OVRhWKGFTIOH9KIo=.489cc32e-308b-4283-9860-4485bbfafa32@github.com> References: <7yOv2rc-pawQNLJSkjIU_fP2Z0hofqh1SMvN0dihFUk=.75f29eed-dbc0-48b6-8e59-86750691e6c1@github.com> <1TjXly8LhR5oJUVfw3UnawdvuOLyvBnsIvqeaBZXOtQ=.13bf9012-28c9-42f7-9744-bf663e2993f6@github.com> <8Non0u57uw1TU1NqlwpBtpulNN7OVRhWKGFTIOH9KIo=.489cc32e-308b-4283-9860-4485bbfafa32@github.com> Message-ID: On Fri, 13 Oct 2023 17:19:20 GMT, Daniel Fuchs wrote: >> Hello, a release note was added to the ticket awhile ago. Let me know if there's anything else I need to do or correct. Thanks again. > > Thanks Terry @tkyc. I have made some updates and marked it DELIVERED. Can you double check that everything still looks good? @dfuch LGTM. Thanks for the quick update Daniel. ------------- PR Comment: https://git.openjdk.org/jdk/pull/14232#issuecomment-1761948896 From djelinski at openjdk.org Mon Oct 16 10:32:17 2023 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Mon, 16 Oct 2023 10:32:17 GMT Subject: RFR: 8318150: StaticProxySelector.select should not throw NullPointerExceptions Message-ID: `ProxySelector.select` and `connectFailed` methods should throw `IllegalArgumentException`s on null parameters. Additionally, the `select` method doesn't need to be synchronized - the selector is immutable. Tier2 green. ------------- Commit messages: - Fix connectFailed, add test - Improve null handling Changes: https://git.openjdk.org/jdk/pull/16199/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=16199&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8318150 Stats: 74 lines in 2 files changed: 19 ins; 24 del; 31 mod Patch: https://git.openjdk.org/jdk/pull/16199.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/16199/head:pull/16199 PR: https://git.openjdk.org/jdk/pull/16199 From jpai at openjdk.org Mon Oct 16 10:52:46 2023 From: jpai at openjdk.org (Jaikiran Pai) Date: Mon, 16 Oct 2023 10:52:46 GMT Subject: RFR: 8318150: StaticProxySelector.select should not throw NullPointerExceptions In-Reply-To: References: Message-ID: On Mon, 16 Oct 2023 09:21:52 GMT, Daniel Jeli?ski wrote: > `ProxySelector.select` and `connectFailed` methods should throw `IllegalArgumentException`s on null parameters. > > Additionally, the `select` method doesn't need to be synchronized - the selector is immutable. > > Tier2 green. The change to the source and the migration of the test to junit looks fine to me. ------------- Marked as reviewed by jpai (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/16199#pullrequestreview-1679678256 From dfuchs at openjdk.org Mon Oct 16 11:52:48 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Mon, 16 Oct 2023 11:52:48 GMT Subject: RFR: 8318150: StaticProxySelector.select should not throw NullPointerExceptions In-Reply-To: References: Message-ID: On Mon, 16 Oct 2023 09:21:52 GMT, Daniel Jeli?ski wrote: > `ProxySelector.select` and `connectFailed` methods should throw `IllegalArgumentException`s on null parameters. > > Additionally, the `select` method doesn't need to be synchronized - the selector is immutable. > > Tier2 green. Looks reasonable to me. I believe CSR and release notes would be warranted. Also it would be good to double check whether other implementations of ProxySelector - e.g. when using -Djava.net.useSystemProxies=true also respect the contract of throwing IAE in those cases. We can't check that with a non-regression test unfortunately (unless it's a manual test) - but some code inspection might reveal whether the contract is respected or not. ------------- Marked as reviewed by dfuchs (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/16199#pullrequestreview-1679777786 From aivanov at openjdk.org Mon Oct 16 12:09:50 2023 From: aivanov at openjdk.org (Alexey Ivanov) Date: Mon, 16 Oct 2023 12:09:50 GMT Subject: RFR: 8317696: Fix compilation with clang-16 [v4] In-Reply-To: References: Message-ID: On Wed, 11 Oct 2023 09:27:30 GMT, Jan Kratochvil wrote: >> `--with-toolchain-type=clang` fails the compilation for me with `clang-16.0.6-3.fc38.x86_64` >> >> While the warnings can be disabled I find better to just fix them. The GTK prototypes in JDK reported by clang are either missing or wrong. >> >> >> src/java.base/unix/native/libnet/DefaultProxySelector.c:378:41: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] >> proxies = (*g_proxy_resolver_lookup)(resolver, uri, NULL, &error); >> ^ >> src/java.base/unix/native/libnet/DefaultProxySelector.c:397:63: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] >> (*g_network_address_parse_uri)(proxies[i], 0, >> ^ >> src/java.base/unix/native/libnet/DefaultProxySelector.c:402:70: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] >> phost = (*g_network_address_get_hostname)(conn); >> ^ >> src/java.base/unix/native/libnet/DefaultProxySelector.c:403:66: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] >> pport = (*g_network_address_get_port)(conn); >> ^ >> src/java.base/unix/native/libnet/DefaultProxySelector.c:445:22: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] >> (*g_strfreev)(proxies); >> ^ >> src/java.base/unix/native/libnet/DefaultProxySelector.c:448:25: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] >> (*g_clear_error)(&error); >> ^ >> Compiling X11Renderer.c (for libawt_headless.so) >> In file included from src/java.desktop/unix/native/common/java2d/x11/X11PMBlitLoops.c:29: >> In file included from src/java.desktop/unix/native/common/java2d/x11/X11Surf... > > Jan Kratochvil has updated the pull request incrementally with one additional commit since the last revision: > > Remove the XShmQueryExtension declaration completely. Client tests are green. Looks good to me. ------------- Marked as reviewed by aivanov (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/16092#pullrequestreview-1679806119 From djelinski at openjdk.org Mon Oct 16 13:18:42 2023 From: djelinski at openjdk.org (Daniel =?UTF-8?B?SmVsacWEc2tp?=) Date: Mon, 16 Oct 2023 13:18:42 GMT Subject: RFR: 8318150: StaticProxySelector.select should not throw NullPointerExceptions In-Reply-To: References: Message-ID: On Mon, 16 Oct 2023 09:21:52 GMT, Daniel Jeli?ski wrote: > `ProxySelector.select` and `connectFailed` methods should throw `IllegalArgumentException`s on null parameters. > > Additionally, the `select` method doesn't need to be synchronized - the selector is immutable. > > Tier2 green. There are only 2 implementations of ProxySelector in the JDK, and they are both covered by this test. `-Djava.net.useSystemProxies=true` changes the behavior of DefaultProxySelector, but parameter validation code path is the same in both cases. I could add a separate `@run` line with `-Djava.net.useSystemProxies=true`, but in the current state it would just run the same code again. Will post a CSR and a release note soon. ------------- PR Comment: https://git.openjdk.org/jdk/pull/16199#issuecomment-1764463803 From dfuchs at openjdk.org Mon Oct 16 13:25:35 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Mon, 16 Oct 2023 13:25:35 GMT Subject: RFR: 8318150: StaticProxySelector.select should not throw NullPointerExceptions In-Reply-To: References: Message-ID: On Mon, 16 Oct 2023 13:15:18 GMT, Daniel Jeli?ski wrote: > I could add a separate @run line with -Djava.net.useSystemProxies=true, but in the current state it would just run the same code again. No need for that - and thanks for confirming that we have only two concrete implementations in the JDK and they now both behave in the same way. ------------- PR Comment: https://git.openjdk.org/jdk/pull/16199#issuecomment-1764475904 From mbaesken at openjdk.org Mon Oct 16 15:52:47 2023 From: mbaesken at openjdk.org (Matthias Baesken) Date: Mon, 16 Oct 2023 15:52:47 GMT Subject: RFR: JDK-8313764: Offer JVM HS functionality to shared lib load operations done by the JDK codebase [v2] In-Reply-To: References: Message-ID: On Wed, 23 Aug 2023 15:18:03 GMT, Matthias Baesken wrote: >> Currently there is a number of functionality that would be interesting to have for shared lib load operations in the JDK C code. >> Some examples : >> Events::log_dll_message for hs-err files reporting >> JFR event NativeLibraryLoad >> There is the need to update the shared lib Cache on AIX ( see LoadedLibraries::reload() , see also https://bugs.openjdk.org/browse/JDK-8314152 ), >> this is currently not fully in sync with libs loaded form jdk c-libs and sometimes reports outdated information >> >> Offer an interface (e.g. jvm.cpp) to support this. > > Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision: > > windows aarch64 build issues Hello, any comments about the idea of calling into 'os::dll_load' instead ? That would indeed make the coding smaller and less 'messy' . ------------- PR Comment: https://git.openjdk.org/jdk/pull/15264#issuecomment-1764687056 From aefimov at openjdk.org Mon Oct 16 16:18:10 2023 From: aefimov at openjdk.org (Aleksei Efimov) Date: Mon, 16 Oct 2023 16:18:10 GMT Subject: RFR: 8272215: Add InetAddress methods for parsing IP address literals Message-ID: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.3ec50176-1370-4050-9115-10e3d735c74e@github.com> ### Summary The changes in this PR add new API to `java.net.InetAddress`, `java.net.Inet4Address`, and `java.net.Inet6Address` classes to parse IP address literals: ``` method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lang.String) method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) ``` ### How new methods differ from existing ones These methods differ from `InetAddress.getByName` and `InetAddress.getAllByName` in the following ways: 1. If a string supplied is not an address literal it is not forwarded to the system-wide resolver, but IllegalArgumentException is thrown instead. The system-wide resolver is never called from these new methods. 2. No reverse lookup is performed to resolve a hostname for the supplied address literal - the `InetAddress[46 ]` instances returned by the new `ofLiteral` API has no hostname set. 3. Each `ofLiteral` static method returns addresses of its class only. It gives the ability to check if an IP address literal is of a specific address type. ### The list of noteworthy changes - `IPv4-mapped IPv6 address` and `IPv4-compatible IPv6 addresses` require some special handling in the new API to implement all supported IP address types. - All address literal parsing code has been moved from `InetAddress.getAllByName` to address type-specific `Inet4Address.parseAddressString` and `Inet6Address.parseAddressString` methods. - The text with scoped IPv6 addresses architecture draft IETF file has been replaced from `[draft-ietf-ipngwg-scoping-arch-04.txt]` to reference `RFC 4007: IPv6 Scoped Address Architecture`. The "RFC 4007" has been also added as `@ spec` into Inet6Address class-level Javadoc. ### Testing `jdk-tier1`, `jdk-tier2`, and `jdk-tier3` test sets show no failure with the changes. `java/net` JCK tests are failing with new methods added failure (CSR is planned for this change): Added Methods ------------- java.net.Inet4Address: method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) java.net.Inet6Address: method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) java.net.InetAddress: method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lang.String) ------------- Commit messages: - improve the ambiguous term readability according to Daniel comments - test update: run IPv6-scoped address with wrong scope-id test case only with at least 2 NI - Moving snippets to class-level docs per Michael suggestion, associated doc changes - Daniel suggestions - Merge branch 'master' into JDK-8272215_API_parse_IP_literals - update javadoc of internal utility methods. - updates for Inet6Address.ofLiteral return type, javadoc and the regression test - add null checks and NPE to methods javadoc - 8272215: Add InetAddress methods for parsing IP address literals Changes: https://git.openjdk.org/jdk/pull/15775/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15775&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8272215 Stats: 658 lines in 6 files changed: 579 ins; 57 del; 22 mod Patch: https://git.openjdk.org/jdk/pull/15775.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/15775/head:pull/15775 PR: https://git.openjdk.org/jdk/pull/15775 From dfuchs at openjdk.org Mon Oct 16 16:18:15 2023 From: dfuchs at openjdk.org (Daniel Fuchs) Date: Mon, 16 Oct 2023 16:18:15 GMT Subject: RFR: 8272215: Add InetAddress methods for parsing IP address literals In-Reply-To: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.3ec50176-1370-4050-9115-10e3d735c74e@github.com> References: <-YUa82ajVJwcpeTiOUz4gYaWQBKsyArXLZxSjgqyEno=.3ec50176-1370-4050-9115-10e3d735c74e@github.com> Message-ID: On Sun, 17 Sep 2023 13:38:08 GMT, Aleksei Efimov wrote: > ### Summary > > The changes in this PR add new API to `java.net.InetAddress`, `java.net.Inet4Address`, and > `java.net.Inet6Address` classes to parse IP address literals: > ``` > method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lang.String) > method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) > method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) > ``` > > ### How new methods differ from existing ones > > These methods differ from `InetAddress.getByName` and `InetAddress.getAllByName` in the following ways: > 1. If a string supplied is not an address literal it is not forwarded to the system-wide resolver, but IllegalArgumentException is thrown instead. The system-wide resolver is never called from these new methods. > 2. No reverse lookup is performed to resolve a hostname for the supplied address literal - the `InetAddress[46 ]` instances returned by the new `ofLiteral` API has no hostname set. > 3. Each `ofLiteral` static method returns addresses of its class only. It gives the ability to check if an IP address literal is of a specific address type. > > ### The list of noteworthy changes > - `IPv4-mapped IPv6 address` and `IPv4-compatible IPv6 addresses` require some special handling in the new API to implement all supported IP address types. > - All address literal parsing code has been moved from `InetAddress.getAllByName` to address type-specific `Inet4Address.parseAddressString` and `Inet6Address.parseAddressString` methods. > - The text with scoped IPv6 addresses architecture draft IETF file has been replaced from `[draft-ietf-ipngwg-scoping-arch-04.txt]` to reference `RFC 4007: IPv6 Scoped Address Architecture`. The "RFC 4007" has been also added as `@ spec` into Inet6Address class-level Javadoc. > > ### Testing > > `jdk-tier1`, `jdk-tier2`, and `jdk-tier3` test sets show no failure with the changes. > > `java/net` JCK tests are failing with new methods added failure (CSR is planned for this change): > > Added Methods > ------------- > > java.net.Inet4Address: method public static java.net.Inet4Address java.net.Inet4Address.ofLiteral(java.lang.String) > java.net.Inet6Address: method public static java.net.InetAddress java.net.Inet6Address.ofLiteral(java.lang.String) > java.net.InetAddress: method public static java.net.InetAddress java.net.InetAddress.ofLiteral(java.lang.String) Good work Aleksei, certainly enough to get the discussion going :-) I'm not entirely sure of some aspects of this proposal though. See my other comments inline. Sorry for the back and forth suggestions - I hadn't noticed that "ambiguous" was already introduced earlier in the method description. I'd suggest the following refactoring to make it easier to read. The main motivation here is to have a method that will create an InetAddress from an IP literal, and throw if the string given as parameters doesn't correspond to an IP literal. By comparison, `getByName` will try to parse the given name as an IP literal, and if it can't parse it as an IP literal, pass it to the resolver. The new method will never invoke the resolver and throw in that case. I find the name `ofLiteral` to be closer to what the method does than it would be if we provided it as an override to e.g. `getByAddress`, but naming can be discussed. Well the name `ofLiteral` clearly conveys that it only accepts a string that represents an IP literal: I'm not sure what's cryptic about it? src/java.base/share/classes/java/net/Inet4Address.java line 148: > 146: *