Skip to content

CASSANALYTICS-143 Fix various leaks in CDC caching and bridge implementation#189

Open
jmckenzie-dev wants to merge 4 commits intoapache:trunkfrom
jmckenzie-dev:fix_leaks
Open

CASSANALYTICS-143 Fix various leaks in CDC caching and bridge implementation#189
jmckenzie-dev wants to merge 4 commits intoapache:trunkfrom
jmckenzie-dev:fix_leaks

Conversation

@jmckenzie-dev
Copy link
Copy Markdown
Contributor

@jmckenzie-dev jmckenzie-dev commented Mar 31, 2026

Patch by Josh McKenzie; reviewed by TBD for CASSANALYTICS-143

This patch makes a lot of the lifecycle implementation in tests explicit (temp fails, cleanup of resources, etc) that previously relied on the CI env Just Working. Some of it is about tidying up and making explicit our position on resource management w/regards to test class lifecycle, and some of it is about leaks preventing GC (schema graph, etc).

…ntation

Patch by Josh McKenzie; reviewed by TBD for CASSANALYTICS-143

This patch makes a lot of the lifecycle implementation in tests explicit
(temp failes, cleanup of resources, etc) that previously relied on the
CI env Just Working. Some of it is about tidying up and making explicit
our position on resource management w/regards to test class lifecycle,
and some of it is about leaks preventing GC (schema graph, etc).

// Second call is idempotent — the flag stays true and no exception is thrown
CassandraBridgeFactory.maybeRegisterShutdownHook();
assertThat(CassandraBridgeFactory.isShutdownHookRegistered()).isTrue();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would be helpful to have a test to verify close() is indeed clearing the cache.

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.

Good call; added both a method for external tests to confirm bridges are closed and a test that populates, confirm live, then closes and confirm closed. We don't necessarily introspect to ensure that the internal close runs actually succeeded (vs. the warn path on catch if they fail), but it at least indicates it went through that path and operated upon them.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we still need this or can we remove it? This one is creating uncached classloader which is never closed.

@skoppu22
Copy link
Copy Markdown
Contributor

LGTM, only minor comments

}
});
COMMIT_LOG_DIRS.clear();
CdcBridgeFactory.close();
Copy link
Copy Markdown
Contributor

@skoppu22 skoppu22 Apr 10, 2026

Choose a reason for hiding this comment

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

Don't we need to clear TypeCache here?

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