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

8329013: StackOverflowError when starting Apache Tomcat with signed jar #2687

Closed
wants to merge 3 commits into from

Conversation

amosshi
Copy link
Contributor

@amosshi amosshi commented Apr 26, 2024

Backport of JDK-8329013

  • This PR contains two commits
  • commit 1:
    • is the original git apply
    • and the src/java.base/share/classes/jdk/internal/misc/ThreadTracker.java file needed by this PR
      • The ThreadTracker.java class was added by openjdk/jdk@9583e36 , which is pretty big for Virtual Threads (JDK-8284161) and we have no intention to back port this change to Java 11 right now
      • So here we simply copy the current code of ThreadTracker.java to jdk11u-dev
  • commit 2:
    • Manual merge of src/java.base/share/classes/jdk/internal/event/EventHelper.java based on the EventHelper.java.rej file. The change to this file can be considered as clean.
    • Fix java 11 compile error for ThreadTracker.java
  • commit 3: The Inner Class ThreadRef for the original Record type should be final

Testing

  • Local: Test passed
    • RecursiveEventHelper.java: Test results: passed: 1
  • Pipeline: All checks have passed
  • Testing Machine: SAP nightlies passed on 2024-04-28
    • Automated jtreg test: jtreg_jdk_tier2
    • jdk/security/logging/RecursiveEventHelper.java: SUCCESSFUL GitHub 📊⏲ - [2,152 msec]
  • Testing Machine with commit 3: SAP nightlies passed on 2024-05-04
    • Automated jtreg test: jtreg_jdk_tier2
    • jdk/security/logging/RecursiveEventHelper.java: SUCCESSFUL GitHub 📊⏲ - [2,301 msec]

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
  • JDK-8329013 needs maintainer approval

Issue

  • JDK-8329013: StackOverflowError when starting Apache Tomcat with signed jar (Bug - P4 - Approved)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk11u-dev.git pull/2687/head:pull/2687
$ git checkout pull/2687

Update a local copy of the PR:
$ git checkout pull/2687
$ git pull https://git.openjdk.org/jdk11u-dev.git pull/2687/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 2687

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk11u-dev/pull/2687.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 26, 2024

👋 Welcome back ashi! 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
Copy link

openjdk bot commented Apr 26, 2024

@amosshi This change now passes all automated pre-integration checks.

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

8329013: StackOverflowError when starting Apache Tomcat with signed jar

Reviewed-by: mbaesken

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 39 new commits pushed to the master branch:

  • c35d30d: 8331263: Bump update version for OpenJDK: jdk-11.0.25
  • 47fd86c: 8273153: Consolidate file_exists into os:file_exists
  • 8a489e5: 8293887: AArch64 build failure with GCC 12 due to maybe-uninitialized warning in libfdlibm k_rem_pio2.c
  • 3533374: 8312194: test/hotspot/jtreg/applications/ctw/modules/jdk_crypto_ec.java cannot handle empty modules
  • b7596f3: 8316138: Add GlobalSign 2 TLS root certificates
  • b8ee2aa: 8326591: New test JmodExcludedFiles.java fails on Windows when --with-external-symbols-in-bundles=public is used
  • 1d6965f: 8267796: vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/TestDescription.java fails with NoClassDefFoundError
  • 2a804f5: 8297082: Remove sun/tools/jhsdb/BasicLauncherTest.java from problem list
  • ece9b2c: 8326521: JFR: CompilerPhase event test fails on windows 32 bit
  • 2ff4d4e: 8318322: Update IANA Language Subtag Registry to Version 2023-10-16
  • ... and 29 more: https://git.openjdk.org/jdk11u-dev/compare/dabf4d16a190f5169a2eb56ff964f9a3365bce62...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 changed the title Backport 925d82931c09dc11ea5a3bc410ea5cfd67ee14aa 8329013: StackOverflowError when starting Apache Tomcat with signed jar Apr 26, 2024
@openjdk
Copy link

openjdk bot commented Apr 26, 2024

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk bot added backport rfr Pull request is ready for review labels Apr 26, 2024
@mlbridge
Copy link

mlbridge bot commented Apr 26, 2024

Webrevs

Thread thread() {
return this.thread;
}

@Override
Copy link
Contributor Author

@amosshi amosshi Apr 26, 2024

Choose a reason for hiding this comment

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

Java 11 doe not have record yet (Java 14 via JEP 359), so we convert this record type as inner class.

@Override
public int hashCode() {
return Long.hashCode(thread.threadId());
return Long.hashCode(thread.getId());
}
Copy link
Contributor Author

@amosshi amosshi Apr 26, 2024

Choose a reason for hiding this comment

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

threadId() method does not exit in Java 11 yet

we are using getId() method on jdk11u-dev which is doing exactly the same job.

    @Deprecated(since="19")
    public long getId() {
        return threadId();
    }

    public final long threadId() {
        return tid;
    }

return (obj instanceof ThreadRef other)
&& this.thread == other.thread;
return (obj instanceof ThreadRef)
&& this.thread == ((ThreadRef)obj).thread;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

instanceof operator was introduced by Java 14 via JEP 305, on jdk11u-dev we need convert this code to traditional manner

Copy link
Member

@MBaesken MBaesken left a comment

Choose a reason for hiding this comment

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

looks okay but please check for final in the record to class conversion.

* The hashCode/equals methods do not invoke the Thread hashCode/equals method
* as they may run arbitrary code and/or leak references to Thread objects.
*/
private class ThreadRef {
Copy link
Member

Choose a reason for hiding this comment

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

In case of record to class, shouldn't it be a final class ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@MBaesken Good catch. I decompiled a Java Record type confirmed this point: final is needed

access_flags: 0000000000110000 final super

@openjdk
Copy link

openjdk bot commented Apr 29, 2024

⚠️ @amosshi This change is now ready for you to apply for maintainer approval. This can be done directly in each associated issue or by using the /approval command.

@tstuefe
Copy link
Member

tstuefe commented Apr 29, 2024

I don't have time to review this, but kudos for clearly delineating and explaining the delta between this patch and its original. Wish every backporter would do this.

@amosshi
Copy link
Contributor Author

amosshi commented May 6, 2024

/approval request "Un-Clean backport. SAP nightlies passed on 2024-05-04”

@openjdk
Copy link

openjdk bot commented May 6, 2024

@amosshi
8329013: The approval request has been created successfully.

@openjdk openjdk bot added the approval label May 6, 2024
@openjdk openjdk bot added ready Pull request is ready to be integrated and removed approval labels May 29, 2024
@amosshi
Copy link
Contributor Author

amosshi commented Jun 3, 2024

/integrate

@openjdk
Copy link

openjdk bot commented Jun 3, 2024

Going to push as commit 7b377ac.
Since your change was applied there have been 40 commits pushed to the master branch:

  • 31a780d: 8276819: javax/print/PrintServiceLookup/FlushCustomClassLoader.java fails to free
  • c35d30d: 8331263: Bump update version for OpenJDK: jdk-11.0.25
  • 47fd86c: 8273153: Consolidate file_exists into os:file_exists
  • 8a489e5: 8293887: AArch64 build failure with GCC 12 due to maybe-uninitialized warning in libfdlibm k_rem_pio2.c
  • 3533374: 8312194: test/hotspot/jtreg/applications/ctw/modules/jdk_crypto_ec.java cannot handle empty modules
  • b7596f3: 8316138: Add GlobalSign 2 TLS root certificates
  • b8ee2aa: 8326591: New test JmodExcludedFiles.java fails on Windows when --with-external-symbols-in-bundles=public is used
  • 1d6965f: 8267796: vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/TestDescription.java fails with NoClassDefFoundError
  • 2a804f5: 8297082: Remove sun/tools/jhsdb/BasicLauncherTest.java from problem list
  • ece9b2c: 8326521: JFR: CompilerPhase event test fails on windows 32 bit
  • ... and 30 more: https://git.openjdk.org/jdk11u-dev/compare/dabf4d16a190f5169a2eb56ff964f9a3365bce62...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jun 3, 2024

@amosshi Pushed as commit 7b377ac.

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

@amosshi amosshi deleted the backport-8329013 branch June 11, 2024 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants