[ 
https://issues.apache.org/jira/browse/RANGER-3160?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

hbprotoss updated RANGER-3160:
------------------------------
    Description: 
RecursivePathResourceMatcher init variable _valueWithoutSeparator_ and 
_valueWithSeparator_ in function isMatch(), which will lead to a race condition 
that when the matcher is used for the first time and there are multiple threads 
try to match the resource, _valueWithSeparator_ will be null in some scenario, 
and match fails.

A patch is attached below based on master branch.

 

PS: If I guess the lazy init here is to save some memory, but even the two 
variables are inited at constructor, the memory cost is very little to ignore. 
We have about 60k rules, and each has an average path length of 100 bytes, it 
only needs about 11M of memory

  was:
RecursivePathResourceMatcher init variable _valueWithoutSeparator_ and 
_valueWithSeparator_ in function isMatch(), which will lead to a race condition 
that when the matcher is used for the first time and there are multiple threads 
try to match the resource, _valueWithSeparator_ will be null in some scenario, 
and match fails.

 

A patch is attached below based on master branch


> RecursivePathResourceMatcher race condition
> -------------------------------------------
>
>                 Key: RANGER-3160
>                 URL: https://issues.apache.org/jira/browse/RANGER-3160
>             Project: Ranger
>          Issue Type: Bug
>          Components: Ranger
>    Affects Versions: 2.1.0, 2.2.0
>            Reporter: hbprotoss
>            Priority: Major
>         Attachments: 
> 0001-fix-RecursivePathResourceMatcher-race-condition.patch
>
>
> RecursivePathResourceMatcher init variable _valueWithoutSeparator_ and 
> _valueWithSeparator_ in function isMatch(), which will lead to a race 
> condition that when the matcher is used for the first time and there are 
> multiple threads try to match the resource, _valueWithSeparator_ will be null 
> in some scenario, and match fails.
> A patch is attached below based on master branch.
>  
> PS: If I guess the lazy init here is to save some memory, but even the two 
> variables are inited at constructor, the memory cost is very little to 
> ignore. We have about 60k rules, and each has an average path length of 100 
> bytes, it only needs about 11M of memory



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to