RFR: 8272124: Cgroup v1 initialization causes NullPointerException when path contains colon
Severin Gehwolf
sgehwolf at openjdk.java.net
Tue Aug 17 15:04:28 UTC 2021
On Tue, 17 Aug 2021 09:07:17 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:
>> Please review this small fix for JDK-8272124. The fix puts a limit of 3 when splitting self cgroup lines by ':' so that Cgroup paths won't get truncated if they contain embedded ':'s. For example, an entry of "11:memory:/user.sli:ce" in a /proc/self/cgroup file will now result in a Cgroup path of "/user.sli:ce" instead of "/user.sli".
>>
>> The fix was tested with Mach5 tiers 1 and 2, and Mach5 tiers 3-5 on Linux x64 and Linux aarch64.
>>
>> Thanks, Harold
>
> src/java.base/linux/classes/jdk/internal/platform/CgroupSubsystemFactory.java line 200:
>
>> 198: }
>> 199: selfCgroupLines.map(line -> line.split(":", 3))
>> 200: .filter(tokens -> (tokens.length >= 3))
>
> This filter no longer makes sense as tokens.length == 3 in every case after this patch. Please remove. From the javadoc from `String.split(String, limit)`:
>
> If the limit is positive then the pattern will be applied
> at most limit-1 times, the array's length will be
> no greater than limit, and the array's last entry will contain
> all input beyond the last matched delimiter.
On second thought, we might want to keep `tokens.length == 3`, but I don't know if it'll ever be < 3 in reality. It certainly would no longer be > 3.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5127
More information about the serviceability-dev
mailing list