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

Fix QueueEntry recycle problem. #3747

Merged
merged 2 commits into from
Feb 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,8 @@ public void run() {
cbThreadPoolQueueSize.dec();
journalAddEntryStats.registerSuccessfulEvent(MathUtils.elapsedNanos(enqueueTime), TimeUnit.NANOSECONDS);
cb.writeComplete(0, ledgerId, entryId, null, ctx);
recycle();
callbackTime.addLatency(MathUtils.elapsedNanos(startTime), TimeUnit.NANOSECONDS);
recycle();
Copy link
Member

Choose a reason for hiding this comment

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

@horizonzy This change wasn't mentioned in the PR description. Why was this missing before? Was the recycling completely unused before? /cc @hangc0276

Copy link
Member Author

@horizonzy horizonzy Feb 3, 2023

Choose a reason for hiding this comment

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

Cause we already reset callbackTime to null. And we should ensure do all works before recycle self, instead of addLatency after recycle self.

}

private final Handle<QueueEntry> recyclerHandle;
Expand All @@ -365,6 +365,14 @@ protected QueueEntry newObject(Recycler.Handle<QueueEntry> handle) {
};

private void recycle() {
this.entry = null;
this.cb = null;
this.ctx = null;
this.journalAddEntryStats = null;
this.journalCbQueuedLatency = null;
this.journalCbQueueSize = null;
this.cbThreadPoolQueueSize = null;
this.callbackTime = null;
recyclerHandle.recycle(this);
}
}
Expand Down