Bug Hunting Session
Bug 103507 - Java not selected automatically with u111/112
Summary: Java not selected automatically with u111/112
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: framework (show other bugs)
Version:
(earliest affected)
5.0.0.5 release
Hardware: x86-64 (AMD64) Windows (All)
: medium minor
Assignee: Stephan Bergmann
URL:
Whiteboard: target:5.3.0 target:5.2.3
Keywords: regression
Depends on:
Blocks: Java-Runtime-JRE
  Show dependency treegraph
 
Reported: 2016-10-25 23:33 UTC by dheif
Modified: 2016-11-02 08:54 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
SolarMutex not locked assertion error (13.98 KB, image/png)
2016-10-26 07:54 UTC, Aron Budea
Details
View of JDK installed screen (42.95 KB, image/png)
2016-10-26 23:50 UTC, dheif
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dheif 2016-10-25 23:33:59 UTC
Using Windows 7, 64 bit - Java 8, 111 - LibreOffice 5.2.2.2 

- BASE does not work with this latest version of Java though the same version of Java does work with LibreOfficeBase 5.1.5.2 portable 

- Previous version of Java did work with LO 5.2.2.2
Comment 1 tommy27 2016-10-26 04:30:29 UTC
I wonder if this incompatibility between latest LibO and latest Java is a LibO bug or a Java bug.
Comment 2 Alex Thurgood 2016-10-26 06:54:45 UTC
@dheif : have you tried installing a 64bit JDK instead of a JRE ?

Setting to NEEDINFO, please set back to UNCONFIRMED once you have tried with a 64bit JDK
Comment 3 Aron Budea 2016-10-26 07:54:01 UTC
Created attachment 128276 [details]
SolarMutex not locked assertion error

Reproduced with 5.2.2.2 and 5.3 master build / Windows 7. Both LO and Java 8u112 are 32-bit.

Java appears in Options - LibreOffice - Advanced, but when a database is opened, and Tables view is selected, Base gives an error that JRE needs to be installed.


A possibly different issue:
In 5.3 master debug build, opening a database results in a "SolarMutex not locked" assertion error (see attached image).
Comment 4 tommy27 2016-10-26 07:58:00 UTC
status NEW since confirmation in comment 3
Comment 5 Aron Budea 2016-10-26 08:04:31 UTC
If there's a regression, it's not on LO's side, handling Java update version numbers > 99 has only been fixed a few months ago (see "depends on" bug report).
Comment 6 Aron Budea 2016-10-26 09:16:06 UTC
The assertion failed error is unrelated, and now has its own bug report: bug 103515.
Comment 7 Aron Budea 2016-10-26 09:42:08 UTC
Weird things are happening in jfw_findAndSelectJRE(...) (jvmfwk\source\framework.cxx).

So it goes through the vendors defined in javavendors.xml, and gets info for the installed Java version that's from that specific vendor:
http://opengrok.libreoffice.org/xref/core/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx#323

In my case it finds two entries for vendor "Sun Microsystems Inc." (JDK+JRE), but the vendor in the returned info says "Oracle Corporation", so they're thrown away.

Then in the next iteration, when Java installations are queried for vendor "Oracle Corporation", nothing is returned.
Comment 8 Alex Thurgood 2016-10-26 10:36:37 UTC
@Stephan : any idea ?
Comment 9 Stephan Bergmann 2016-10-26 10:56:30 UTC
(In reply to dheif from comment #0)
> - BASE does not work with this latest version of Java though the same
> version of Java does work with LibreOfficeBase 5.1.5.2 portable 

what is the exact problem?

(In reply to Aron Budea from comment #3)
> Java appears in Options - LibreOffice - Advanced, but when a database is
> opened, and Tables view is selected, Base gives an error that JRE needs to
> be installed.

If you then go to the Advanced options page and select one of the listed Java installations (assuming none was previously selected), does Base work afterwards?
Comment 10 dheif 2016-10-26 23:50:36 UTC
Created attachment 128293 [details]
View of JDK installed screen

I don't have the foggiest idea as to why the JDK installation shows up twice.
Comment 11 dheif 2016-10-27 00:08:58 UTC
(In reply to Alex Thurgood from comment #2)
> @dheif : have you tried installing a 64bit JDK instead of a JRE ?
> 
> Setting to NEEDINFO, please set back to UNCONFIRMED once you have tried with
> a 64bit JDK

Hello Alex,

After installing JDK 64 bit, version 8 111, LOBase 5.2.2.2 worked though it did NOT work with JRE 32 bit(same version). The JRE 32 bit(same version) DID work with LOBase 5.1.5 (portable). 

I have an attachment located in the queue (I don't know how to keep it with this reply) which shows that the JDK version shows up twice when checked via tools, options, advanced, Java Options. It shows up as version 1.8.0_111.

Hope this information helps in tracking down the problem.
Comment 12 Aron Budea 2016-10-27 02:04:30 UTC
Dheif, you see two Java installations because you have JDK and JRE installed, and each has its runtime environment. This is not an issue.

Stephan:
Indeed, I checked now, and could get Java 8u112 to work after selecting Java, probably restart was needed. I didn't test in detail, but went back to 8u92 to test wit that.

Results with 8u92 (all in Windows 7, with cleared profile):

-5.2.0.4, 5.2.2.2, 5.3 alpha1:
After opening a database and switching to Tables view, there's the error: "LibreOffice requires a Java runtime environment (JRE) to perform this task. The selected JRE is defective. Please select another version or install a new JRE and select it under Tools - Options - LibreOffice - Advanced."
(then another that connection to the data source could not be established)

Upon second start there's no error when opening a database.
Even if the first start was only the Start Center and nothing Base-related, there's no error upon second start.


-5.1.5.2:
No error message upon opening a database with a clean profile.

Debugging revealed that for this Java version (8u92) on the first attempt jfw_startVM(...) call returns with JFW_E_VM_CREATION_FAILED:
http://opengrok.libreoffice.org/xref/core/stoc/source/javavm/javavm.cxx#758

So this issue seems to be different than with the newer Java version (code doesn't even go to the same place in sunjavaplugin.cxx as in the other case). It's also a regression. Priority is low.

Next step: upgrade to Java 8u112 again, and test in detail with that.
Comment 13 Aron Budea 2016-10-27 02:51:01 UTC
With Java 8u112 the error doesn't go away with a restart, but indeed goes away if a Java version is selected in Java Options (which doesn't happen automatically, while it does with 8u92).

The message in this case: "LibreOfficeDev requires a Java runtime environment (JRE) to perform this task. Please install a JRE and restart LibreOfficeDev."

Issue goes back to 5.0.0.5, while JRE is automatically selected in 4.4.0.3, so indeed this is a regression (and bug 101057 didn't affect all OSes).

Since, though it has to be selected manually (the warning message is confusing), Java ultimately seems to work, reducing importance.


Dheif: LibreOffice and JRE/JDK has to be either both 64-bit or 32-bit. If they are mixed 64/32-bit, then LibreOffice won't see Java, that is normal.
Comment 14 Stephan Bergmann 2016-10-27 07:16:23 UTC
(In reply to dheif from comment #11)
> After installing JDK 64 bit, version 8 111, LOBase 5.2.2.2 worked though it
> did NOT work with JRE 32 bit(same version). The JRE 32 bit(same version) DID
> work with LOBase 5.1.5 (portable). 

The (32 vs. 64) bit-ness of LO and Java need to match, see bug 37089.
Comment 15 Stephan Bergmann 2016-10-27 07:51:31 UTC
(In reply to Aron Budea from comment #13)
> Issue goes back to 5.0.0.5, while JRE is automatically selected in 4.4.0.3,
> so indeed this is a regression (and bug 101057 didn't affect all OSes).

You mean, starting each time with a fresh UserInstall, LO 5.0.0.5 and later do not automatically select 8u112, and LO 4.4.0.3 does?

(That would confuse me, as my understanding is that, while it did't necessarily lead to crashes on all platforms, bug 101057 meant that LO did't detect Java versions with a three-digit update number (as in "8u112") on any platform, and that bug fix wasn't backported to anything prior to LO 5.1.5.)
Comment 16 Aron Budea 2016-10-27 17:32:04 UTC
(In reply to Stephan Bergmann from comment #15)
> You mean, starting each time with a fresh UserInstall, LO 5.0.0.5 and later
> do not automatically select 8u112, and LO 4.4.0.3 does?

Yes, exactly.
It seems bug 101057 doesn't cause any issues in this case, the cause is something else.
Comment 17 Stephan Bergmann 2016-10-28 09:15:14 UTC
(In reply to Aron Budea from comment #16)
> (In reply to Stephan Bergmann from comment #15)
> > You mean, starting each time with a fresh UserInstall, LO 5.0.0.5 and later
> > do not automatically select 8u112, and LO 4.4.0.3 does?
> 
> Yes, exactly.
> It seems bug 101057 doesn't cause any issues in this case, the cause is
> something else.

Indeed, I had misinterpreted effects of bug 101057.

The cause for this bug is <https://cgit.freedesktop.org/libreoffice/core/commit/?id=5e9a2e9b0f33ab50aa3a84728db75383aede19d9> "Check each potential JRE location only once" (which first appeared in LO 5.0.0).
Comment 18 Commit Notification 2016-10-28 09:35:26 UTC
Stephan Bergmann committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=36f637f7f21906fa3f37223e69b044db52036fb1

tdf#103507 quickfix: Automatic selection of Oracle Java runtime on Windows

It will be available in 5.3.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 19 Stephan Bergmann 2016-10-28 09:40:43 UTC
...though I have no idea why this issue should be specific to "u111/112", and not also hit with older Oracle Java runtimes
Comment 20 Stephan Bergmann 2016-10-28 09:47:26 UTC
...oh, and thanks for the excellent analysis, Aron :)
Comment 21 Commit Notification 2016-10-28 10:19:05 UTC
Stephan Bergmann committed a patch related to this issue.
It has been pushed to "libreoffice-5-2-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=fe5d367fae1323416e03d1b618ba2af64e237e8c&h=libreoffice-5-2-3

tdf#103507 quickfix: Automatic selection of Oracle Java runtime on Windows

It will be available in 5.2.3.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 22 Commit Notification 2016-10-28 11:47:50 UTC
Stephan Bergmann committed a patch related to this issue.
It has been pushed to "libreoffice-5-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=541febffd9d6f367e23081a1f0d095f232325014&h=libreoffice-5-2

tdf#103507 quickfix: Automatic selection of Oracle Java runtime on Windows

It will be available in 5.2.4.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 23 Aron Budea 2016-10-29 09:15:01 UTC
Thanks for the fix, Stephan. I tested and verified it working in 5.2.3.3 x86 / Java 8u112 x86 / Windows 7.

Now the fix brought forth the issue described in comment 12, for which I opened bug 103570, but that's really a low/trivial category bug, as it only comes up after the very first opening of a database table with an empty profile (or where Java hasn't been initialized, yet).

Dheif, if you think there's still an independent issue related to Base and Java, please open another bug report on it.
Comment 24 Stephan Bergmann 2016-11-02 08:54:22 UTC
(turns out macOS had the same issue; to be addressed for LO 5.2.4 with <https://gerrit.libreoffice.org/#/c/30475/> "quickfix: Automatic selection of Oracle Java runtime on macOS")