Skip to content

Conversation

@zhengyu123
Copy link
Contributor

@zhengyu123 zhengyu123 commented Mar 31, 2022

Please review this small patch to fix leaking XShmSegmentInfo that is attached to XImage.

Test:

  • jdk_2d

Progress

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

Issue

  • JDK-8284093: Memory leak: X11SD_DisposeXImage should also free obdata

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 8060

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Mar 31, 2022

👋 Welcome back zgu! 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 added the rfr Pull request is ready for review label Mar 31, 2022
@openjdk
Copy link

openjdk bot commented Mar 31, 2022

@zhengyu123 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 Mar 31, 2022
@mlbridge
Copy link

mlbridge bot commented Mar 31, 2022

Webrevs

Copy link
Contributor

@prrace prrace left a comment

Choose a reason for hiding this comment

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

Looks like X11SD_DropSharedSegment doesn't free this .. so this seems needed.
But be sure to run X11 testing that will exercise the code path to verify no surprises before this is pushed

@openjdk
Copy link

openjdk bot commented Apr 4, 2022

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

8284093: Memory leak: X11SD_DisposeXImage should also free obdata

Reviewed-by: prr, andrew

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

  • f4edb59: 8284567: Collapse identical catch branches in java.base
  • 40ddb75: 8284641: Doc errors in sun.security.ssl.SSLSessionContextImpl
  • 8ebea44: 8270090: C2: LCM may prioritize CheckCastPP nodes over projections
  • 755bfcb: 8284581: Serial: Remove unused GenCollectedHeap::collect_locked
  • 0c04bf8: 8284198: Undo JDK-8261137: Optimization of Box nodes in uncommon_trap
  • eb3ead9: 8284036: Make ConcurrentHashMap.CollectionView a sealed hierarchy
  • 92f5e42: 8284549: JFR: FieldTable leaks FieldInfoTable member
  • 34914f1: 8284178: os::commit_memory() should assert the given range
  • 37e28ae: 8282221: x86 intrinsics for divideUnsigned and remainderUnsigned methods in java.lang.Integer and java.lang.Long
  • 0b867b5: 8284330: jcmd may not be able to find processes in the container
  • ... and 125 more: https://git.openjdk.java.net/jdk/compare/720e751f35150251cab05bc9fca3add39daf70af...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 ready Pull request is ready to be integrated label Apr 4, 2022
@zhengyu123
Copy link
Contributor Author

Looks like X11SD_DropSharedSegment doesn't free this .. so this seems needed. But be sure to run X11 testing that will exercise the code path to verify no surprises before this is pushed

Thanks for the review, @prrace

I ran jdk_2d tests on Linux. Could you suggest any other tests I should run before push?

@zhengyu123
Copy link
Contributor Author

Friendly ping!

May I have a second review?

Thanks

@neugens
Copy link

neugens commented Apr 11, 2022

I'm not officially a reviewer but afaik there isn't any other place where the obdata is freed, and X11SD_DropSharedSegment doesn't do it, so we probably need to do it there. Since obdata is malloced in X11SD_CreateSharedImage, it seems correct to free it in X11SD_DisposeXImage (instead of directly within X11SD_DropSharedSegment), so the patch looks good to me.

Copy link
Member

@gnu-andrew gnu-andrew left a comment

Choose a reason for hiding this comment

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

This looks correct to me.

There is another similar block:

        if (xsdo->shmPMData.shmSegInfo != NULL) {
            X11SD_DropSharedSegment(xsdo->shmPMData.shmSegInfo);
            xsdo->shmPMData.shmSegInfo = NULL;
        }

But xsdo->shmPMData.shmSegInfo is assigned img->obdata in X11SD_CreateSharedPixmap, so looks like this is the one and only place to free this.

@zhengyu123
Copy link
Contributor Author

Thanks, @neugens @gnu-andrew

@zhengyu123
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Apr 11, 2022

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

  • f4edb59: 8284567: Collapse identical catch branches in java.base
  • 40ddb75: 8284641: Doc errors in sun.security.ssl.SSLSessionContextImpl
  • 8ebea44: 8270090: C2: LCM may prioritize CheckCastPP nodes over projections
  • 755bfcb: 8284581: Serial: Remove unused GenCollectedHeap::collect_locked
  • 0c04bf8: 8284198: Undo JDK-8261137: Optimization of Box nodes in uncommon_trap
  • eb3ead9: 8284036: Make ConcurrentHashMap.CollectionView a sealed hierarchy
  • 92f5e42: 8284549: JFR: FieldTable leaks FieldInfoTable member
  • 34914f1: 8284178: os::commit_memory() should assert the given range
  • 37e28ae: 8282221: x86 intrinsics for divideUnsigned and remainderUnsigned methods in java.lang.Integer and java.lang.Long
  • 0b867b5: 8284330: jcmd may not be able to find processes in the container
  • ... and 125 more: https://git.openjdk.java.net/jdk/compare/720e751f35150251cab05bc9fca3add39daf70af...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Apr 11, 2022

@zhengyu123 Pushed as commit 205cfb8.

💡 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.

4 participants