Skip to content

Conversation

@jayathirthrao
Copy link
Member

@jayathirthrao jayathirthrao commented May 24, 2024

In IJG library's jmemmgr.c file we can define MEM_STATS(by default this flag is disabled and we don't see this issue) to enable printing of memory trace logs when we have OOM. But if we enable it we get crash while disposing IJG stored objects in jmemmgr->free-pool() function.

This is happening because we delete the error handler before we actually start deleting IJG stored objects and while freeing the IJG objects we try to access cinfo->err->trace_level of error handler. This early deletion of error handler is happening in imageioJPEG.c->imageio_dispose() function.

Moved the logic to delete error handler after we are done with deleting IJG stored objects, after this change there is no crash. There is no regression test because this issue is seen only when we enable MEM_STATS flag in IJG library. Ran jtreg ImageIO tests with code update and i don't see any regressions.

I have verified that this issue doesn't effect SplashScreen code path and disposing of IJG objects is handled differently in SplashScreen.


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

Issue

  • JDK-8332866: Crash in ImageIO JPEG decoding when MEM_STATS in enabled (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 19386

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 24, 2024

👋 Welcome back jdv! 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 May 24, 2024

@jayathirthrao 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:

8332866: Crash in ImageIO JPEG decoding when MEM_STATS in enabled

Reviewed-by: abhiscxk, psadhukhan

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

  • 29e10e4: 8332547: Unloaded signature classes in DirectMethodHandles
  • c7d2a5c: 8314070: javax.print: Support IPP output-bin attribute extension
  • d230b30: 8333398: Uncomment the commented test in test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java
  • 1512011: 8332123: [nmt] Move mallocLimit code to the nmt subdir
  • 6dac8d6: 8332424: Update IANA Language Subtag Registry to Version 2024-05-16
  • 9686e80: 8333103: Re-examine the console provider loading
  • 4de6207: 8333229: Parallel: Rename ParMarkBitMap::_region_start to _heap_start
  • 1f9e629: 8333434: IGV: Print loop node for PHASE_BEFORE/AFTER_CLOOPS
  • 27af19d: 8332586: Avoid cloning empty arrays in java.lang.reflect.{Method,Constructor}
  • 1c514b3: 8325435: [macos] Menu or JPopupMenu not closed when main window is resized
  • ... and 143 more: https://git.openjdk.org/jdk/compare/af056c1676dab3b0b35666a8259db60f9bbf824e...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 rfr Pull request is ready for review label May 24, 2024
@openjdk
Copy link

openjdk bot commented May 24, 2024

@jayathirthrao The following label will be automatically applied to this pull request:

  • client

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 client client-libs-dev@openjdk.org label May 24, 2024
@mlbridge
Copy link

mlbridge bot commented May 24, 2024

Webrevs

Copy link
Contributor

@kumarabhi006 kumarabhi006 left a comment

Choose a reason for hiding this comment

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

Verified the fix with sample test program. Looks good to me.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jun 3, 2024
@prsadhuk
Copy link
Contributor

prsadhuk commented Jun 4, 2024

Please update the copyright year when you integrate

@jayathirthrao
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Jun 4, 2024

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

  • 29e10e4: 8332547: Unloaded signature classes in DirectMethodHandles
  • c7d2a5c: 8314070: javax.print: Support IPP output-bin attribute extension
  • d230b30: 8333398: Uncomment the commented test in test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java
  • 1512011: 8332123: [nmt] Move mallocLimit code to the nmt subdir
  • 6dac8d6: 8332424: Update IANA Language Subtag Registry to Version 2024-05-16
  • 9686e80: 8333103: Re-examine the console provider loading
  • 4de6207: 8333229: Parallel: Rename ParMarkBitMap::_region_start to _heap_start
  • 1f9e629: 8333434: IGV: Print loop node for PHASE_BEFORE/AFTER_CLOOPS
  • 27af19d: 8332586: Avoid cloning empty arrays in java.lang.reflect.{Method,Constructor}
  • 1c514b3: 8325435: [macos] Menu or JPopupMenu not closed when main window is resized
  • ... and 143 more: https://git.openjdk.org/jdk/compare/af056c1676dab3b0b35666a8259db60f9bbf824e...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jun 4, 2024

@jayathirthrao Pushed as commit ca30726.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client client-libs-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants