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

8264752: SIGFPE crash with option FlightRecorderOptions:threadbuffersize=30M #3432

Closed
wants to merge 2 commits into from

Conversation

huishi-hs
Copy link

@huishi-hs huishi-hs commented Apr 12, 2021

…ize=30M

Fix misc explicit JFR memory option caused crash and assertion (https://bugs.openjdk.java.net/browse/JDK-8241773).

  1. Fix SIGFPE crash in div_total_by_per_unit.
    a) In valid_memory_relations, check threadbuffersize should not larger than memorysize.
    b) In "void thread_buffer_size(JfrMemoryOptions* options)", calculate memorysize if it isn't configured, avoid SIGFPE when thread buffer size is larger than default memorysize.

  2. Fix "assert(free_size() == size, "invariant");" in JfrBuffer::initialize.
    Limit globalbuffersize and threadbuffersize under 2G, avoid size_t to u4 coversion lost.

  3. Check and report possible inconsistent conditions after jfr memory size adjustment.
    a) globalbuffercount < MIN_BUFFER_COUNT
    b) globalbuffersize < threadbuffersize


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8264752: SIGFPE crash with option FlightRecorderOptions:threadbuffersize=30M

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3432/head:pull/3432
$ git checkout pull/3432

Update a local copy of the PR:
$ git checkout pull/3432
$ git pull https://git.openjdk.java.net/jdk pull/3432/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3432

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/3432.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 12, 2021

👋 Welcome back hshi! 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 changed the title 8264752: SIGFPE crash with option FlightRecorderOptions:threadbuffers… 8264752: SIGFPE crash with option FlightRecorderOptions:threadbuffersize=30M Apr 12, 2021
@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 12, 2021
@openjdk
Copy link

openjdk bot commented Apr 12, 2021

@huishi-hs The following label will be automatically applied to this pull request:

  • hotspot-jfr

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 hotspot-jfr hotspot-jfr-dev@openjdk.org label Apr 12, 2021
@mlbridge
Copy link

mlbridge bot commented Apr 12, 2021

Webrevs

Copy link

@mgronlun mgronlun left a comment

Choose a reason for hiding this comment

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

Hi Hui, looks good - thank you for testing and making this a bit more robust.

@openjdk
Copy link

openjdk bot commented Apr 16, 2021

@huishi-hs 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:

8264752: SIGFPE crash with option FlightRecorderOptions:threadbuffersize=30M

Reviewed-by: mgronlun

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

  • 4b7f027: 8231179: Investigate why tools/javac/options/BCPOrSystemNotSpecified.java fails on Window
  • d87a4c3: 8239596: PARAMETER annotation on receiver type does not cause error
  • 52f9d22: 8265884: ProblemList compiler/codecache/jmx/PoolsIndependenceTest.java on macOS-X64
  • 5aed446: 8265403: consolidate definition of CPU features
  • 20a373a: 8265393: VM crashes if both -XX:+RecordDynamicDumpInfo and -XX:SharedArchiveFile options are specified
  • 6803ab2: 8265880: ProblemList serviceability/dcmd/gc/RunFinalizationTest.java on Linux-X64
  • e08f506: 8265816: Handle new VectorMaskCast node for x86
  • bebfae4: 8264208: Console charset API
  • 5aab160: 8265531: doc/building.md should mention homebrew install freetype
  • d8e638f: 8265794: Remove ProblemList-non-cds-mode
  • ... and 219 more: https://git.openjdk.java.net/jdk/compare/627ad9fe22a153410c14d0b2061bb7dee2c300af...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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@mgronlun) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 16, 2021
@mgronlun
Copy link

I did see this test fail when running on linux-aarch64:

[2021-04-16T12:55:44,162Z] java.lang.RuntimeException: 'Decrease globalbuffersize or increase memorysize or adjust global/threadbuffersize' missing from stdout/stderr
[2021-04-16T12:55:44,163Z]
[2021-04-16T12:55:44,163Z] at jdk.test.lib.process.OutputAnalyzer.shouldContain(OutputAnalyzer.java:206)
[2021-04-16T12:55:44,163Z] at jdk.jfr.startupargs.TestBadOptionValues.test(TestBadOptionValues.java:56)
[2021-04-16T12:55:44,163Z] at jdk.jfr.startupargs.TestBadOptionValues.main(TestBadOptionValues.java:139)
[2021-04-16T12:55:44,163Z] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2021-04-16T12:55:44,163Z] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
[2021-04-16T12:55:44,163Z] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[2021-04-16T12:55:44,164Z] at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[2021-04-16T12:55:44,164Z] at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:298)
[2021-04-16T12:55:44,164Z] at java.base/java.lang.Thread.run(Thread.java:831)
[2021-04-16T12:55:44,164Z]
[2021-04-16T12:55:44,164Z] JavaTest Message: Test threw exception: java.lang.RuntimeException
[2021-04-16T12:55:44,165Z] JavaTest Message: shutting down test

@huishi-hs
Copy link
Author

huishi-hs commented Apr 17, 2021

@mgronlun Thanks for your reivew and test!

Is default page size larger than 4k in your aarch64 enivronment? I found an aarch64 mchine default page size 64k.
In this case both local/global buffer size is aligned to 64K page size and not fail.
Fix is checking vm page size isn't larger than 4K before running test "memorysize=1m,numglobalbuffers=256".

Testing on both linux aarch64/x64 pass now.

./build/linux-aarch64-server-release/jdk/bin/java -XX:StartFlightRecording -XX:FlightRecorderOptions:memorysize=1m,numglobalbuffers=256 -Xlog:arguments=trace -version
[0.157s][trace][arguments] Memory size (original) 1048576 B (user defined: true)
[0.157s][trace][arguments] Memory size (adjusted) 1048576 B (modified: false)
[0.157s][trace][arguments] Memory size (adjustment) +0 B
[0.157s][trace][arguments] Global buffer size (original) 524288 B (user defined: false)
[0.157s][trace][arguments] Global buffer size (adjusted) 65536 B (modified: true)
[0.157s][trace][arguments] Global buffer size (adjustment) -458752 B
[0.157s][trace][arguments] Thread local buffer size (original) 8192 B (user defined: false)
[0.157s][trace][arguments] Thread local buffer size (adjusted) 65536 B (modified: true)
[0.157s][trace][arguments] Thread local buffer size (adjustment) +57344 B
[0.157s][trace][arguments] Number of global buffers (original) 256 (user defined: true)
[0.157s][trace][arguments] Number of global buffers (adjusted) 16 (modified: true)
[0.157s][trace][arguments] Number of global buffers (adjustment) -240
Started recording 1. No limit specified, using maxsize=250MB as default.

@huishi-hs
Copy link
Author

@mgronlun Could you please help review again for updated commit?

Copy link

@mgronlun mgronlun left a comment

Choose a reason for hiding this comment

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

Tests are green after the update - thank you.

@huishi-hs
Copy link
Author

Tests are green after the update - thank you.

Thanks for your review!

@huishi-hs
Copy link
Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Apr 24, 2021
@openjdk
Copy link

openjdk bot commented Apr 24, 2021

@huishi-hs
Your change (at version c1ffe6e) is now ready to be sponsored by a Committer.

@huishi-hs
Copy link
Author

Could someone give a second review before integrate this?

@mgronlun
Copy link

/sponsor

@openjdk openjdk bot closed this Apr 27, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed sponsor Pull request is ready to be sponsored ready Pull request is ready to be integrated rfr Pull request is ready for review labels Apr 27, 2021
@openjdk
Copy link

openjdk bot commented Apr 27, 2021

@mgronlun @huishi-hs Since your change was applied there have been 277 commits pushed to the master branch:

  • dc323a9: 8263421: Module image file is opened twice during VM startup
  • fbfd4ea: 8265914: Duplicated NotANode and not_a_node
  • 9481fad: 8163367: Test javax/swing/JComboBox/8033069/bug8033069NoScrollBar.java javax/swing/JComboBox/8033069/bug8033069ScrollBar.java fails intermittently
  • 9adbf15: 8265995: Shenandoah: Move ShenandoahInitMarkRootsClosure close to its use
  • 879a77f: 8265757: stack-use-after-scope in perfMemory_posix.cpp get_user_name_slow()
  • e4be968: 8265980: Fix systemDictionary and loaderConstraints printing
  • f6e26f6: 8265756: AArch64: initialize memory allocated for locals according to Windows AArch64 stack page growth requirement in template interpreter
  • 0a4c338: 8263432: javac may report an invalid package/class clash on case insensitive filesystems
  • 82b3719: 8265967: Unused NullCheckNode forward declaration in node.hpp
  • 468c847: 8234020: Remove FullGCCount_lock
  • ... and 267 more: https://git.openjdk.java.net/jdk/compare/627ad9fe22a153410c14d0b2061bb7dee2c300af...master

Your commit was automatically rebased without conflicts.

Pushed as commit 377b346.

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

@huishi-hs huishi-hs deleted the JFR_fix branch May 16, 2021 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-jfr hotspot-jfr-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

2 participants