[
https://issues.apache.org/jira/browse/MINIFICPP-839?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16845850#comment-16845850
]
Daniel Bakai commented on MINIFICPP-839:
----------------------------------------
[~phrocker] The TestPlan doesn't drain its Connections like FlowController or
ProcessGroup does, and one of the first things I tried was to drain them in
~TestPlan, but even with that were still leaks.
The test I was using mostly was the second test from PutFileTests (named
"PutFileTest").
Because I had a hard time figuring out what shared_ptr instances caused the
leak (I see where it was allocated, but it's much harder to find out which is
the last standing shared_ptr that doesn't get freed), my method was to severe
the cycles where it seemed the least disruptive, but I don't have an exact
causal chain explaining why every modification is needed the way it is done.
I will take an another look at the whole issue taking into account the teardown
concept you explained, ensure that is done properly everywhere and see what
leaks remain.
> Multiple memory leaks because of shared_ptr cycles
> --------------------------------------------------
>
> Key: MINIFICPP-839
> URL: https://issues.apache.org/jira/browse/MINIFICPP-839
> Project: Apache NiFi MiNiFi C++
> Issue Type: Bug
> Reporter: Daniel Bakai
> Assignee: Daniel Bakai
> Priority: Blocker
> Labels: ReloadValidation
> Fix For: 0.7.0
>
> Time Spent: 1h 50m
> Remaining Estimate: 0h
>
> There seems to be a Connection<->Processor shared_ptr cycle which means that
> the Processors never get destructed.
> This causes leaks in reloads and in tests.
> There are also other cycles causing leaks:
> * Connection <-> FlowFile (this seems to be partially mitigated by
> Connection::drain(), but not entirely)
> * ResourceClaim <-> VolatileContentRepository
> * VolatileContentRepository <-> VolatileContentRepository (capturing a
> shared_ptr into a thread func and detaching the thread)
> * FlowController <- > SchedulingAgent (TimerDrivenSchedulingAgent,
> EventDrivenSchedulingAgent, CronDrivenSchedulingAgent) and even
> FlowController <- > util::ThreadPool because of this
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)