[
https://issues.apache.org/jira/browse/ARTEMIS-4206?focusedWorklogId=853533&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-853533
]
ASF GitHub Bot logged work on ARTEMIS-4206:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 28/Mar/23 22:57
Start Date: 28/Mar/23 22:57
Worklog Time Spent: 10m
Work Description: tabish121 commented on code in PR #4418:
URL: https://github.com/apache/activemq-artemis/pull/4418#discussion_r1151224880
##########
artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/RefCountMessage.java:
##########
@@ -49,6 +76,28 @@ public int getDurableCount() {
return DURABLE_REF_COUNT_UPDATER.get(this);
}
+ /** Sub classes may mark fired=true when they were explicitly called.
+ * E.g large message removed the file upon cancellation */
+ protected void markFired() {
+ fired = true;
+ if (firedAtomic != null) {
+ firedAtomic.set(true);
+ }
+ }
+
+ public RefCountMessage() {
+ if (DEBUG_REF_COUNT) {
+ AtomicBoolean refFired = this.firedAtomic;
+ List<Exception> crumbs = debugCrumbs;
+ crumbs.add(new Exception("new Instance"));
+ String clazz = this.getClass().getName();
+ // notice you can't have a direct reference on the LargeMessage
Itself,
+ // Otherwise you would get a leak from itself
+ // RefCountMessageLeakTest is validating this scenario
+ CLEANER.register(this, () -> debug(clazz, refFired, crumbs));
Review Comment:
Even with the comment I'm not a huge fan of the lambda being used here
because it is super easy for someone to later change this to capture 'this'
inadvertently. I'd recommend passing the state data to a static function that
returns a Runnable just as an additional safety mechanism as that prevents a
capture of 'this' in the Runnable.
##########
artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/RefCountMessage.java:
##########
@@ -58,54 +107,42 @@ public int getDurableCount() {
public RefCountMessage getParentRef() {
return parentRef;
}
- // I am usually against keeping commented out code
- // However this is very useful for me to debug referencing counting.
- // Uncomment out anything between #ifdef DEBUG and #endif
- // #ifdef DEBUG
Issue Time Tracking
-------------------
Worklog Id: (was: 853533)
Time Spent: 0.5h (was: 20m)
> Unreferenced AMQP Large Messages are not removed
> ------------------------------------------------
>
> Key: ARTEMIS-4206
> URL: https://issues.apache.org/jira/browse/ARTEMIS-4206
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Reporter: Clebert Suconic
> Assignee: Clebert Suconic
> Priority: Major
> Fix For: 2.29.0
>
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> Say you crashed the server after the ack, and before the file.remove, and the
> journal. record removal.
> The AMQP Large Message may not be removed right away, requiring a restart of
> the broker.
> At this point this is really caused by ARTEMIS-4193 and only affected 2.29.0
> and no previous versions
--
This message was sent by Atlassian Jira
(v8.20.10#820010)