Skip to content

Pipe: release resources of pipe event that have been GCed but the reference count is not zero by PhantomReference#13360

Merged
SteveYurongSu merged 31 commits intoapache:masterfrom
VGalaxies:PipePhantomReference
Oct 13, 2024
Merged

Pipe: release resources of pipe event that have been GCed but the reference count is not zero by PhantomReference#13360
SteveYurongSu merged 31 commits intoapache:masterfrom
VGalaxies:PipePhantomReference

Conversation

@VGalaxies
Copy link
Copy Markdown
Contributor

@VGalaxies VGalaxies commented Aug 31, 2024

Considering that when the event is garbage collected, the file resources it holds will not automatically end their lifecycle, we adopt a reference counting maintenance + safety net fallback method (releasing resources later is better than never releasing them).

@SteveYurongSu SteveYurongSu self-assigned this Sep 2, 2024
@VGalaxies VGalaxies marked this pull request as ready for review September 19, 2024 07:46
return PIPE_EVENT_PHANTOM_REFERENCES.size();
}

protected void gcHook() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use a seperated thread pool (extends PipePeriodicalJobExecutor?) to run this method periodically?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For one thread, what is the max number of events per second can be checked?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We have to consider using a multi-threaded pool to run this method if necessary (maybe we can add a conf parma for this?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

consider optimizing in the next PR...

config.setPipeEventReferenceEliminateIntervalSeconds(
Long.parseLong(
properties.getProperty(
"pipe_event_reference_eliminate_interval_seconds",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can be shorter by default?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

no other ideas for now...

@SteveYurongSu SteveYurongSu merged commit 29ae643 into apache:master Oct 13, 2024
@VGalaxies VGalaxies deleted the PipePhantomReference branch October 13, 2024 07:26
VGalaxies added a commit to VGalaxies/iotdb that referenced this pull request Oct 13, 2024
VGalaxies added a commit to VGalaxies/iotdb that referenced this pull request Dec 6, 2024
SteveYurongSu pushed a commit that referenced this pull request Dec 6, 2024
…d but the reference count is not zero by PhantomReference (#13360, #13756, #13813, #13962, part of #13992) (#14355)

* Pipe: release resources of pipe event that have been GCed but the reference count is not zero by PhantomReference (#13360)

* Pipe: remove protected method reference under jdk8 & add GH yml for checking compatibility issues (#13756)

* Pipe: add seperated thread pool for phantom reference clean job (#13813)

* Pipe: reduce pipe phantom reference logging frequency by omitting printing if count unchanged (#13962)

* cherry-pick part of #13992
Caideyipi pushed a commit to Caideyipi/iotdb that referenced this pull request Mar 25, 2026
…d but the reference count is not zero by PhantomReference (apache#13360, apache#13756, apache#13813, apache#13962, part of apache#13992) (apache#14355)

* Pipe: release resources of pipe event that have been GCed but the reference count is not zero by PhantomReference (apache#13360)

* Pipe: remove protected method reference under jdk8 & add GH yml for checking compatibility issues (apache#13756)

* Pipe: add seperated thread pool for phantom reference clean job (apache#13813)

* Pipe: reduce pipe phantom reference logging frequency by omitting printing if count unchanged (apache#13962)

* cherry-pick part of apache#13992
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants