Skip to content

RANGER-5708 : Correct early publication of KnoxRangerPlugin in Ranger - #1121

Open
rgupta94 wants to merge 1 commit into
apache:masterfrom
rgupta94:RANGER-5708
Open

RANGER-5708 : Correct early publication of KnoxRangerPlugin in Ranger#1121
rgupta94 wants to merge 1 commit into
apache:masterfrom
rgupta94:RANGER-5708

Conversation

@rgupta94

Copy link
Copy Markdown

Fix a race in RangerPDPKnoxFilter where the static KnoxRangerPlugin instance was published before init() finished.
Previously, plugin was assigned immediately after construction, and plugin.init() ran afterward. When multiple Knox topologies initialized the filter concurrently, another thread could observe a partially initialized plugin and use it for authorization.

This change assigns the new plugin to a local variable, calls init() on that instance, and only then sets the static plugin field. That keeps the singleton fully initialized before it is visible to other threads.
Also adds a unit test to verify that concurrent filter initialization blocks until the first plugin finishes initializing.

@rgupta94
rgupta94 marked this pull request as ready for review August 3, 2026 06:29
@rgupta94
rgupta94 requested a review from rameeshm August 3, 2026 06:30
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