Bug 1206856

Summary: yum update of java-1.8.0-openjdk-headless breaks running java processes when loading jar files on demand
Product: [Fedora] Fedora Reporter: Edgar Hoch <edgar.hoch>
Component: java-1.8.0-openjdkAssignee: jiri vanek <jvanek>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 25CC: ahughes, dbhole, jerboaa, jvanek, omajid
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-12-12 10:09:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Edgar Hoch 2015-03-29 00:42:41 UTC
Description of problem:

yum update of java-1.8.0-openjdk-headless breaks running java processes when these processes want to load jar files provided by the package.

The problem is that java is installed in a directory path that changes on update of the package. The path contains the fullversion of the package.

Java calculates some internal class paths in dependence of the path of the java binary. This means that these paths contain the fullversion of the java package. If the java package is updated (for example, by yum-updatesd) while a java process is running, the files and directores of the old java packages are removed, resulting in file not found error of the running java processes when they want to access these files.


Example:

A running java process was killed by the following exception:

Exception in thread "main" java.lang.InternalError: java.io.FileNotFoundException: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.31-5.b13.fc21.x86_64/jre/lib/ext/sunpkcs11.jar 
...

Here we can see why:

$ ll /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.31-5.b13.fc21.x86_64/jre/lib/ext/sunpkcs11.jar
ls: cannot access /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.31-5.b13.fc21.x86_64/jre/lib/ext/sunpkcs11.jar: No such file or directory
$ ll /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/ext/sunpkcs11.jar
-rw-r--r--. 1 root root 265087 Mar 19 09:53 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/ext/sunpkcs11.jar


It seems that the java process was started while ava-1.8.0-openjdk version 1.8.0.31-5.b13 was installed, and then yum-updatesd updated it to version 1.8.0.40-21.b25.


Version-Release number of selected component (if applicable):

java-1.8.0-openjdk-headless-1.8.0.40-21.b25.fc21.x86_64
java-1.8.0-openjdk-headless-1.8.0.31-5.b13.fc21.x86_64


How reproducible:
Always.

Steps to Reproduce:
1. Install java-1.8.0-openjdk-headless in a previous version.
2. Start a java process that runs a long time and loads some jar files of this packages on demand after some time.
3. Update java-1.8.0-openjdk-headless to a newer version.
4. Wait until the running java process wants to load a jar file of this package.

Actual results:
The java process crashes.

Expected results:
The java process finds the requested jar file.
In this case it is acceptable that the jar file is from the new packages.

Additional info:

Check the spec file java-1.8.0-openjdk.spec for "fullversion".
I think the use of this macro in directory paths causes the problem.

I think that the installation path of java should be the same for all java packages that differ only in minor version numbers.

In this case, the files should be installed in
/usr/lib/jvm/java-1.8.0-openjdk/
not in
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/

Comment 1 jiri vanek 2015-03-30 11:14:01 UTC
one additional  question:
How do you run the application?

If you run it via the "symlinked" path - eg /usr/lib/jvm/java/jre/bin  JVM should be running from this location, and so search libraries in  /usr/lib/jvm/java/ instead in full path. But maybe there is some mechanism in jvm which is doing exactly this.


Otherwise to have release number in path is fully intentional. Sorry for this complication.

Comment 2 Edgar Hoch 2015-03-30 11:22:51 UTC
(In reply to jiri vanek from comment #1)
> one additional  question:
> How do you run the application?

My colleagues (they have the problem, I am the adminstrator) run java by calling "java", e.g. from /usr/bin/java .

lrwxrwxrwx. 1 root root 22 27. Mär 09:45 /usr/bin/java -> /etc/alternatives/java
lrwxrwxrwx. 1 root root 72 27. Mär 09:45 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/bin/java


The problem seems to be that java dereferences the symbolic links to set the search paths. Please see the output of "java -XshowSettings" (here the relevant part):

    java.endorsed.dirs = /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/endorsed
    java.ext.dirs = /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/ext
        /usr/java/packages/lib/ext
    java.home = /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre
    sun.boot.class.path = /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/resources.jar
        /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/rt.jar
        /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/sunrsasign.jar
        /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/jsse.jar
        /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/jce.jar
        /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/charsets.jar
        /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/jfr.jar
        /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/classes
    sun.boot.library.path = /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.40-21.b25.fc21.x86_64/jre/lib/amd64


I haven't found an option for java to prevent the dereference of symlinks.

Comment 4 Fedora End Of Life 2015-11-04 12:52:08 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 5 Edgar Hoch 2015-11-04 13:23:03 UTC
The problem still exists in Fedora 22.

Comment 10 Jan Kurik 2016-07-26 04:28:42 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 25 development cycle.
Changing version to '25'.

Comment 11 Fedora End Of Life 2017-11-16 19:53:51 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 12 Fedora End Of Life 2017-12-12 10:09:51 UTC
Fedora 25 changed to end-of-life (EOL) status on 2017-12-12. Fedora 25 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.