JDK-8219562 : Line of code in osContainer_linux.cpp#L102 appears unreachable
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 8,11.0.2,12,13
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: x86_64
  • Submitted: 2019-02-21
  • Updated: 2024-06-04
  • Resolved: 2019-03-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13 JDK 8 Other
11.0.5Fixed 13 b13Fixed 8u321Fixed openjdk8uResolved
Related Reports
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
Latest JDK source

A DESCRIPTION OF THE PROBLEM :
In the block starting at line 102 of osContainer_linux.cpp (https://github.com/unofficial-openjdk/openjdk/blob/jdk/jdk/src/hotspot/os/linux/osContainer_linux.cpp#L102) there appear to be two mutually contradictory checks, meaning that the branch is never evaluated.  Specifically it first checks whether or not cgroup_path is the prefix of _root, and then checks to ensure that cgroup_path is longer than _root. Obviously cgroup_path cannot simultaneously be a refix of and longer than _root.


FREQUENCY : always



Comments
Fix Request (OpenJDK 8u): Please approve backporting this to OpenJDK 8u. The reason this is needed is because JDK-8220579 is being backported which introduces a test regression requiring the fix of JDK-8221340 (one hunk of it). Since JDK-8221340 also changes jdk code for cgroups paths we should get this one in as well to keep hotspot in sync. JDK 11 patch applies as-is post path unshuffeling. Testing: container tests on Linux with JDK-8221340 patch applied as well.
03-11-2020

Fix Request (OpenJDK 11u): Please approve backporting this to OpenJDK 11u. The reason this is needed is because JDK-8220579 is being backported which introduces a test regression requiring the fix of JDK-8221340 (one hunk of it). Since JDK-8221340 also changes jdk code for cgroups paths we should get this one in as well to keep hotspot in sync. JDK 13 patch applies as-is. Testing: Linux x86_64 tier1 + docker tests with JDK-8221340 patch applied as well.
07-08-2019

URL: http://hg.openjdk.java.net/jdk/jdk/rev/da7f6755ba71 User: bobv Date: 2019-03-19 18:32:08 +0000
19-03-2019

This block was supposed to check to see if the cgroup path begins with the root path but is a longer more specific path. For example: If the root is: /docker/2debdb8371eea44e2ae32bc24e8d5c1e00b161c29a215607bca412b8e69bff46 and root if mounted on: 30 26 0:26 /docker/2debdb8371eea44e2ae32bc24e8d5c1e00b161c29a215607bca412b8e69bff46 /sys/fs/cgroup/memory rw,nosuid,nodev,noexec,relatime shared:11 - c group cgroup rw,memory and the cgroup_path is: 3:memory:/docker/2debdb8371eea44e2ae32bc24e8d5c1e00b161c29a215607bca412b8e69bff46/user.slice Then the memory subsystem directory should be: /sys/fs/cgroup/memory/user.slice This is an extreemly rare case that I have not seen yet but it is possible to occur. The fix is: line 102: - char *p = strstr(_root, cgroup_path); + char *p = strstr(cgroup_path, _root); line 109: - if ((buflen + strlen(cgroup_path)) > (MAXPATHLEN-1)) { + if ((buflen + strlen(cgroup_path) - strlen(_root)) > (MAXPATHLEN-1)) {
27-02-2019

As report suggested, code remains same in jdk/jdk also Assigning to Bob
22-02-2019