JDK-8325437 : Safepoint polling in monitor deflation can cause massive logs
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 17,21,22,23
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-02-07
  • Updated: 2024-04-19
  • Resolved: 2024-02-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 21 JDK 23
21.0.4-oracleFixed 23 b10Fixed
Related Reports
Relates :  
Relates :  
Description
If ObjectSynchronizer::chk_in_use_entry is called while monitor deflation is safepoint polled/blocked, we can have deflated monitors on the in-use list and we can get a huge number of lines stating:

[10.570s][debug][monitorinflation] WARNING: monitor=0x00007fa1004f8480: in-use monitor is deflated.

This comes from the following code:
void ObjectSynchronizer::chk_in_use_entry(ObjectMonitor* n, outputStream* out,
                                          int* error_cnt_p) {
  if (n->owner_is_DEFLATER_MARKER()) {
    // This should not happen, but if it does, it is not fatal.
    out->print_cr("WARNING: monitor=" INTPTR_FORMAT ": in-use monitor is "
                  "deflated.", p2i(n));
    return;
  }

There are tentative plans to rewrite the monitor deflation to unlink deflated monitors from the in-use list *before* the safepoint polls, but I'd like to suggest that we make an interim patch that deletes this warning.
Comments
[jdk21u-fix-request] Approval Request from Aleksey Shipilëv Reduces the logs noise, followup for JDK-8319896. This is a part of atomic 21u integration, see 21u-dev PR for more details. Applies cleanly. All tests pass. Was in mainline for a month, without bugtail.
12-03-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk21u-dev/pull/337 Date: 2024-03-06 19:12:00 +0000
07-03-2024

Fix Request This is a small, trivial fix that only removes a noise log line. Without this fix our UL log files can become massive, if the user runs with -Xlog:monitordeflation=debug. The log line used to warn about an unexpected state of object monitors, but with recent rewrites to the monitor deflation code, this state is not uncommon anymore (by design), so it is better to not log messages about it.
15-02-2024

Changeset: 52d49761 Author: Stefan Karlsson <stefank@openjdk.org> Date: 2024-02-09 13:09:12 +0000 URL: https://git.openjdk.org/jdk/commit/52d497619e58a5677bc4a015b1bd87f600f23837
09-02-2024

>> There are tentative plans to rewrite the monitor deflation to unlink deflated monitors >> from the in-use-list *before* the safepoint polls > >I can't find an issue for this. Can someone point me to it? During the review of: 8319048: Monitor deflation unlink phase prolongs time to safepoint there was a discussion about a simplified and unified version of the code around the monitor deflation. [~aboldtch] created a prototype, but it was rejected/deferred in favor of a version that could be backported. You can read about this in the PR: https://github.com/openjdk/jdk/pull/16412 Since then he has been polishing his prototype. I don't know if he has created a JBS issue for it yet.
07-02-2024

> Another side effect of not doing a deflation pass before the auditing pass? Yes, the removal of the deflation in: 8319896: Remove monitor deflation from final audit triggers this. But, IIUC, this could be triggered even without that in the audit pass in SafepointSynchronize::do_cleanup_tasks.
07-02-2024

> There are tentative plans to rewrite the monitor deflation to unlink deflated monitors > from the in-use-list *before* the safepoint polls I can't find an issue for this. Can someone point me to it?
07-02-2024

Another side effect of not doing a deflation pass before the auditing pass?
07-02-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/17752 Date: 2024-02-07 15:35:16 +0000
07-02-2024