Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8296804: Document HttpClient configuration properties in java.net.http module-info #11241

Closed

Conversation

Michael-Mc-Mahon
Copy link
Member

@Michael-Mc-Mahon Michael-Mc-Mahon commented Nov 18, 2022

Hi,

Could I get the following doc change reviewed please? It documents the system/networking properties used by the java.net.http HTTP client in its module-info. (CSR to follow)

Thanks,
Michael


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change requires a CSR request to be approved

Issues

  • JDK-8296804: Document HttpClient configuration properties in java.net.http module-info
  • JDK-8297583: Document HttpClient configuration properties in java.net.http module-info (CSR)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/11241/head:pull/11241
$ git checkout pull/11241

Update a local copy of the PR:
$ git checkout pull/11241
$ git pull https://git.openjdk.org/jdk pull/11241/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 11241

View PR using the GUI difftool:
$ git pr show -t 11241

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/11241.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 18, 2022

👋 Welcome back michaelm! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 18, 2022
@openjdk
Copy link

openjdk bot commented Nov 18, 2022

@Michael-Mc-Mahon The following label will be automatically applied to this pull request:

  • net

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the net net-dev@openjdk.org label Nov 18, 2022
@mlbridge
Copy link

mlbridge bot commented Nov 18, 2022

Copy link
Member

@dfuch dfuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should limit ourselves to document properties that are of interest to users of the API - so probably looking at what is documented in the Java Core Libraries Developer's Guide

Comment on lines 126 to 134
* <li><p><b>{@systemProperty jdk.internal.httpclient.debug}</b> (default: false)<br>
* Enables general debug tracing.
* </li>
* <li><p><b>{@systemProperty jdk.internal.httpclient.websocket.debug}</b> (default: false)<br>
* Enables general websocket debug tracing.
* </li>
* <li><p><b>{@systemProperty jdk.internal.httpclient.hpack.debug}</b> (default: false)<br>
* Enables general HTTP/2 HPACK debug tracing.
* </li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These three *.debug properties are too low level and should not be documented.

Comment on lines 94 to 96
* <li><p><b>{@systemProperty jdk.httpclient.keepalive.timeout}</b> (default: 1200)<br>
* The number of seconds to keep idle HTTP/1.1 connections alive in the keep alive cache.
* </li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer strictly true. Also jdk.httpclient.keepalive.timeout.h2 should be documented, see JDK-8295649

@dfuch
Copy link
Member

dfuch commented Nov 18, 2022

Also it should be made clear that these system properties should be specified on the java command line (no guarantee that a value specified with System.setProperty() willl be taken into account) and are implementation specific properties, not part of the specification. That is - another implementation of java.net.http.HttpClient may not support them or may support a different set.

Comment on lines 111 to 113
* <li><p><b>{@systemProperty jdk.httpclient.maxstreams}</b> (default: 100)<br>
* The maximum number of HTTP/2 streams per connection.
* </li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be useful to be a bit more precise here: this is the maximum number of concurrent push streams that a server is allowed to initiate on an HTTP/2 connection

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, good point. It's the client telling the server how many streams it is allowed to open. So, that implies push streams only

Comment on lines 129 to 133
* <li><p><b>{@systemProperty jdk.internal.httpclient.selectorTimeout}</b> (default: 3000)<br>
* The selector thread wakes up repeatedly after this number of milliseconds when there is no activity.
* This allows the thread to terminate when no longer needed. The value provided is limited
* to the range from 1 to 1200(???) seconds.
* </li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to document this property? If yes then what is the meaning of the (???) question marks?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The question mark was a place holder to query the value range. 1200 seemed extremely high. But, I think we don't need to document it at all.

Comment on lines 134 to 136
* <li><p><b>{@systemProperty jdk.httpclient.sendBufferSize}</b> (default: operating system default)<br>
* The HTTP client socket send buffer size. Values less than or equal to zero are ignored.
* </li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should make a note that attempting to specify a receive or send buffer size may be detrimental to performance as it might prevent the underlying system to optimize sending and receiving. Also a link to the corresponding StandardOptions may be in order (same for receive buffer size above).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would agree with linking to the StandardSocketOption descriptions, as that would also help to distinguish the send buffer option from the write buffer option, which sounds similar. In my view, any discussion of performance trade-offs should be in the StandardSocketOption apidoc rather than here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable to me. BTW - you seem to have tripped jcheck due to trailing white spaces.

Comment on lines 137 to 139
* <li><p><b>{@systemProperty jdk.internal.httpclient.disableHostnameVerification}</b> (default: false)<br>
* If true, hostname verification in SSL certificates is disabled. This is a system property only.
* </li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we emphasize that it is intended for testing purposes?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good idea

Comment on lines 140 to 147
* <li><p><b>{@systemProperty jdk.http.auth.proxying.disabledSchemes}</b> (default: see conf/net.properties)<br>
* A comma separated list of HTTP authentication scheme names, that are disallowed for use by
* the HTTP client implementation, for HTTP proxying.
* </li>
* <li><p><b>{@systemProperty jdk.http.auth.tunneling.disabledSchemes}</b> (default: see conf/net.properties)<br>
* A comma separated list of HTTP authentication scheme names, that are disallowed for use by
* the HTTP client implementation, for HTTP CONNECT tunneling.
* </li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we provide a link to net-properties.html here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the benefit in that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe these properties are documented there already.

Copy link
Member

@dfuch dfuch Nov 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah - no. They are not. My mistake. They are documented in conf/net.properties but we can't have a link to that.

@openjdk openjdk bot removed the rfr Pull request is ready for review label Nov 23, 2022
@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 23, 2022
@openjdk openjdk bot added the csr Pull request needs approved CSR before integration label Nov 24, 2022
@Michael-Mc-Mahon
Copy link
Member Author

/csr needed

@openjdk
Copy link

openjdk bot commented Nov 24, 2022

@Michael-Mc-Mahon an approved CSR request is already required for this pull request.

* <li>frames</li>
* <li>ssl</li>
* <li>trace</li>
* <li>channel</li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Michael, is it intentional that we haven't documented content in this list?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for noticing that omission Jai!

* </li>
* <li><p><b>{@systemProperty jdk.httpclient.connectionWindowSize}</b> (default: 2^26)<br>
* The HTTP/2 client connection window size in bytes. The maximum size is 2^31-1. This value cannot be
* smaller than the stream window size.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this additionally point to the jdk.httpclient.windowsize system property? Something like This value cannot be smaller than the stream window size, which can be configured through {@code jdk.httpclient.windowsize} system property?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea!

* </li>
* <li><p><b>{@systemProperty jdk.internal.httpclient.disableHostnameVerification}</b> (default: false)<br>
* If true, hostname verification in SSL certificates is disabled. This is a system property only and not
* available in {@code conf/net.properties}. It is provided for testing purposes only.
Copy link
Member

@jaikiran jaikiran Nov 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can see in the code jdk.internal.net.http.common.Utils#hostnameVerificationDisabledValue(), we consider an empty value for this property to imply true. Perhaps we should note that here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, agreed!

Comment on lines 75 to 76
* Enables high-level logging of various events through the Java Logging API (which is contained in the
* package java.util.logging). The value contains a comma-separated list of any of the following items:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

java.util.logging is actually only the default backend, so I'd suggest to reword as:

 * Enables high-level logging of various events through the {@linkplain java.lang.System.Logger Platform Logging API}.
 * The value contains ...

* <li>all</li>
* </ul><br>
* Specifying an item adds it to the HTTP client's log. For example, if you specify the following value,
* then the Java Logging API logs all possible HTTP Client events:<br>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here - use Platform Logging API rather than Java Logging API.

* <li><p><b>{@systemProperty jdk.httpclient.keepalive.timeout}</b> (default: 30)<br>
* The number of seconds to keep idle HTTP connections alive in the keep alive cache. This property
* applies to both HTTP/1.1 and HTTP/2. The value for HTTP/2 can be overridden with the
* jdk.httpclient.keepalive.timeout.h2 property.
Copy link
Member

@dfuch dfuch Nov 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{@code jdk.httpclient.keepalive.timeout.h2} ?

* </li>
* <li><p><b>{@systemProperty jdk.httpclient.keepalive.timeout.h2}</b> (default: see below)<br>
* The number of seconds to keep idle HTTP/2 connections alive. If not set, then the
* jdk.httpclient.keepalive.timeout setting is used.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{@code jdk.httpclient.keepalive.timeout} ?

@Michael-Mc-Mahon
Copy link
Member Author

Will push an update including the comments above and then a further update with just reformatting changes.

@Michael-Mc-Mahon
Copy link
Member Author

CSR updated now.

@@ -72,12 +73,13 @@
* The HTTP/2 client maximum HPACK header table size in bytes.
* </li>
* <li><p><b>{@systemProperty jdk.httpclient.HttpClient.log}</b> (default: none)<br>
* Enables high-level logging of various events through the Java Logging API (which is contained in the
* package java.util.logging). The value contains a comma-separated list of any of the following items:
* Enables high-level logging of various events through the {@link java.lang.System.Logger Platform Logging
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be {@linkplain } otherwise the text will be in fixed font.

Copy link
Member

@jaikiran jaikiran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Michael for these changes. These look fine to me. One final thing - I just noticed that the file will need a copyright year update.

@openjdk openjdk bot removed the csr Pull request needs approved CSR before integration label Nov 29, 2022
@openjdk
Copy link

openjdk bot commented Nov 29, 2022

@Michael-Mc-Mahon This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8296804: Document HttpClient configuration properties in java.net.http module-info

Reviewed-by: dfuchs, jpai

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 26 new commits pushed to the master branch:

  • 692bedb: 8297106: Remove the -Xcheck:jni local reference capacity checking
  • 05128c2: 8286185: The Java manpage can be more platform inclusive
  • d450314: 8297276: Remove thread text from Subject.current
  • cdf9ed0: 8297528: java/io/File/TempDirDoesNotExist.java test failing on windows-x64
  • 105d9d7: 8295351: java/lang/Float/Binary16Conversion.java fails with "Unexpected result of converting"
  • a80552e: 8236919: Refactor com.sun.tools.javac.main.CommandLine into a reusable module for other JDK tools
  • a249a52: 8296754: AutoCreateSharedArchive in JDK 20 is not compatible with JDK 19
  • 405b188: 8297570: jdk/jfr/threading/TestDeepVirtualStackTrace.java fails with -XX:-UseTLAB
  • ba0a252: 8297717: Remove jdk/internal/misc/TerminatingThreadLocal/TestTerminatingThreadLocal.java from ProblemList
  • c05dc80: 8297660: x86: Redundant test+jump in C1 allocateArray
  • ... and 16 more: https://git.openjdk.org/jdk/compare/4f65570204e2d38415e7761bd81660b081eae882...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 29, 2022
@Michael-Mc-Mahon
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Nov 29, 2022

Going to push as commit 48017b1.
Since your change was applied there have been 31 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Nov 29, 2022
@openjdk openjdk bot closed this Nov 29, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Nov 29, 2022
@openjdk
Copy link

openjdk bot commented Nov 29, 2022

@Michael-Mc-Mahon Pushed as commit 48017b1.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@Michael-Mc-Mahon Michael-Mc-Mahon deleted the http.properties branch November 29, 2022 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated net net-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

3 participants