RFR: 8324668: JDWP process management needs more efficient file descriptor handling [v4]

Gerard Ziemski gziemski at openjdk.org
Mon Jan 29 17:59:41 UTC 2024


On Mon, 29 Jan 2024 10:00:37 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> Can I please get a review of this change which proposes to address https://bugs.openjdk.org/browse/JDK-8324668?
>> 
>> This change proposes to fix the issue in jdwp where when launching a child process (for the `launch=<cmd>` option), it iterates over an extremely large number of file descriptors to close each one of those. Details about the issue and the proposed fixed are added in a subsequent comment in this PR https://github.com/openjdk/jdk/pull/17588#issuecomment-1912256075. tier1, tier2 and tier3 testing is currently in progress with this change.
>
> Jaikiran Pai has updated the pull request incrementally with three additional commits since the last revision:
> 
>  - add a log message to help debuggability
>  - improve code comments
>  - David's review - use standard isdigit instead of custom isAsciiDigit

Again, the changes make the code better already, I just want to make sure take this opportunity to polish this code really well...

src/jdk.jdwp.agent/unix/native/libjdwp/exec_md.c line 108:

> 106:         if (isdigit(dirp->d_name[0]) &&
> 107:             (fd = strtol(dirp->d_name, NULL, 10)) >= from_fd) {
> 108:             (void)close(fd);

I'd really, really like to check `close()` for errors and report any.

src/jdk.jdwp.agent/unix/native/libjdwp/exec_md.c line 138:

> 136:                   " %d file descriptors sequentially", (max_fd - i + 1)));
> 137:         for (; i < max_fd; i++) {
> 138:             (void)close(i);

Here as well, I'd really like to check for `close()`for errors here and report any.

And if we find errors here, do we really want to proceed knowing that something went wrong already?

-------------

Changes requested by gziemski (Committer).

PR Review: https://git.openjdk.org/jdk/pull/17588#pullrequestreview-1849357100
PR Review Comment: https://git.openjdk.org/jdk/pull/17588#discussion_r1469984071
PR Review Comment: https://git.openjdk.org/jdk/pull/17588#discussion_r1469979677


More information about the serviceability-dev mailing list