Running any Java program produces messages in the terminal, while rendering many Java applications broken

Bug #1441487 reported by Kumbarov on 2015-04-08
232
This bug affects 52 people
Affects Status Importance Assigned to Milestone
Jayatana
Unknown
Unknown
One Hundred Papercuts
Critical
Unassigned
jayatana (Ubuntu)
Critical
Unassigned
Vivid
Critical
Unassigned

Bug Description

[Impact]
* Some programs are running java -version and grep the output to determine which java version they are running on. However, having jayatana installed exports JAVA_TOOL_OPTIONS which then result in the various available java vm to output "Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar" on their command line. Programs not resilient enough against this output will then just crash as not finding their output
* Random crash happens as well with jayatana under openjdk-8 when interacting with menus

[Test case]
1. Enable the -proposed repository and install this new jayatana version
2. Restart your session
3. Run java -version
-> You shouldn't see anymore "Picked up JAVA_TOOL_OPTIONS:…" line
4. Start any java application which was crashing (see list in comment #25)
-> The application shouldn't trigger those crashes again.

[Regression Potential]
* We disable the entire menu, the regression that some people will see (if this was working well for their apps) is that the menu won't be exported anymore for their java app in Unity or Gnome Shell menu bar. Technical users will be able to reexport it if they desires thanks to the recipe described in the changelog or stackoverflow.

------------

I just installed Ubuntu 15.04 and was surprised to discover that when running a Java based program from the terminal in Unity, the following message appears: "Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar". I tried several programs and it is all the same. Some Java programs with enabled Java security produce even some error messages and crash. If I press Ctrl+Alt+F1 to start a new terminal session without a GUI and run a Java program (without a GUI), I don't experience this problem. Back in Unity, if I unset JAVA_TOOL_OPTIONS in the terminal and run a Java program, it works fine.

ProblemType: Bug
DistroRelease: Ubuntu 15.04
Package: unity 7.3.2+15.04.20150330-0ubuntu1
ProcVersionSignature: Ubuntu 3.19.0-10.10-generic 3.19.2
Uname: Linux 3.19.0-10-generic x86_64
ApportVersion: 2.17-0ubuntu1
Architecture: amd64
CompizPlugins: No value set for `/apps/compiz-1/general/screen0/options/active_plugins'
CurrentDesktop: Unity
Date: Wed Apr 8 10:11:10 2015
InstallationDate: Installed on 2015-03-30 (9 days ago)
InstallationMedia: Ubuntu 15.04 "Vivid Vervet" - Beta amd64 (20150326)
SourcePackage: unity
UpgradeStatus: No upgrade log present (probably fresh install)

Kumbarov (kumbarov) wrote :
Changed in unity (Ubuntu):
status: New → Confirmed
Changed in unity:
status: New → Confirmed
Changed in unity (Ubuntu):
importance: Undecided → Low
importance: Low → High
no longer affects: unity
affects: unity (Ubuntu) → openjdk-7 (Ubuntu)
Steve Langasek (vorlon) on 2015-05-07
affects: openjdk-7 (Ubuntu) → jayatana (Ubuntu)
tags: added: regression-update
Changed in unity:
status: New → Confirmed
no longer affects: openjdk
Changed in hundredpapercuts:
status: New → Triaged
Changed in jayatana (Ubuntu):
status: Confirmed → Triaged
importance: High → Medium
Changed in hundredpapercuts:
importance: Undecided → Medium
Brian Murray (brian-murray) wrote :

The regression-update tag is designated for bug reports that have occurred due to a change between a package in the release pocket of Ubuntu and the package in the updates pocket. Given that there has not been an SRU of jayatana, or openjdk-(6|7) this tag is not warranted.

tags: removed: regression-update
Christopher Townsend (townsend) wrote :

I don't think this is a Unity issue, so I'm just going to remove that project.

no longer affects: unity

@ Brian Murray

It worked well today, till:
> 2015-05-07 20:21:39 upgrade jayatana:amd64 2.7-0ubuntu3 2.7-0ubuntu3

So it should be a regression.

@ Christopher Townsend

It was me who just linked the jayatana package to the Unity project. So if you think this is wrong, please correct it at <https://launchpad.net/ubuntu/+source/jayatana>.

Brian Murray (brian-murray) wrote :

@ Alberto

We can clearly see that jayatana does not exist in the updates pocket on this page.

https://launchpad.net/ubuntu/+source/jayatana

I'm not sure what you this is from:

> 2015-05-07 20:21:39 upgrade jayatana:amd64 2.7-0ubuntu3 2.7-0ubuntu3

It would help if you were to have given some more context.

The line belongs to the dpkg.log of my system.

And the same problem appeared to a second computer after upgrading yesterday to Ubuntu 15.04.

Brian Murray (brian-murray) wrote :

In that case then the correct tag would be regression-release as that indicates a change between two different releases of Ubuntu.

tags: added: regression-release
NuWin (thes4s67) wrote :

I can also confirm this bug exists. I just installed 15.04 and installed Java 8. When using Eclipse, each time I compile a class file, I see the message " Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar "

@ NuWin

You can confirm a bug exist for you by clicking on the " This bug affects X people. Does this bug affect you?" option.

Changed in unity:
status: New → Confirmed
Changed in unity (Ubuntu):
status: New → Confirmed
Stephen M. Webb (bregma) wrote :

Removing upstream Unity project again, since I linked the correct upstream Jayatana project to the Ubuntu packages

Changed in unity:
status: Confirmed → Invalid
Changed in unity (Ubuntu):
status: Confirmed → Invalid
no longer affects: unity (Ubuntu)
no longer affects: unity

Someone mistakenly linked it to Unity, but Unity is not the upstream project. A new jayatana project has been created. As such, removing the Unity tasks.

Dzmitry_Hancharou (dmitrijddd) wrote :

pret@computer:~$ java -version
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

For me too, I cannot run some java programs without unsetting this variable. The title of this bug doesn't really convey the importance of the problem.

Changed in jayatana (Ubuntu):
importance: Medium → High
Changed in hundredpapercuts:
importance: Medium → High
summary: - Running any Java program produces messages in the terminal
+ Running any Java program produces messages in the terminal, while
+ rendering some applications broken
summary: Running any Java program produces messages in the terminal, while
- rendering some applications broken
+ rendering some Java applications broken

I have tested that plenty of Java programs doesn't work.

summary: Running any Java program produces messages in the terminal, while
- rendering some Java applications broken
+ rendering many Java applications broken
Changed in jayatana (Ubuntu):
importance: High → Critical
Changed in hundredpapercuts:
importance: High → Critical
Changed in jayatana (Ubuntu):
importance: Critical → High
Changed in hundredpapercuts:
importance: Critical → High
Dan Jared (danjaredg) wrote :

Can you send the name of program to reproduce the bug?

@ Dan Jared

Any Java program that is launched through a shell-script can be affected.

For example, all launching scripts from the Java programs in the following site seemed not to work:
http://sourceforge.net/directory/business-enterprise/financial/investment/os:linux/freshness:recently-updated/

Claudio (claudio-fischer) wrote :

I'm affected also: Ubuntu 15.04 64 Bit.
Some of the java progs started in the console evaluate the java version, which they expect in line 1,
and now get JAVA_TOOL_OPTIONS instead of the java version.
If I do this workaround:
unset JAVA_TOOL_OPTIONS
the java progs work.
See also:
http://askubuntu.com/questions/613562/message-on-each-startup-of-java-after-upgrade-to-15-04

The introduction of jayatana causes some important Java use cases to dump core; in my case, using an IDE that loads project matisse (https://netbeans.org/features/java/swing.html) for GUI design causes the JVM to abort and dump a trace.

I can work around the issue, disabling jayatana by calling "unset JAVA_TOOL_OPTIONS" in the shell before invoking my IDE.

Netmisha (netmisha) wrote :

By default this functionality should be disabled.

Bryan (engineer-dollery) wrote :

Wow. I'm a java developer and this completely breaks everything I do. We're lucky it actually provides evidence of what it did, and we're lucky it's easy to uninstall.

Changed in jayatana (Ubuntu):
importance: High → Critical
Changed in hundredpapercuts:
importance: High → Critical
Erich Schubert (erich) wrote :

This REALLY breaks random things.

Please replace this package with an empty package to immediately unbreak things.

See also:
http://stackoverflow.com/questions/26074446/picked-up-java-tool-options-javaagent-usr-share-java-jayatanaag-jar-when-st
http://elki.dbs.ifi.lmu.de/ticket/133
http://elki.dbs.ifi.lmu.de/ticket/131
http://elki.dbs.ifi.lmu.de/ticket/130
https://github.com/NixOS/nixpkgs/issues/7082

and probably a thousand other hits on Google by now.

In my opinion, jayatana is broken by design, appears to be unmaintained, and thus should be abandoned ASAP.

Didier Roche (didrocks) wrote :

Thanks for resporting this bug and help to make Ubuntu better. Sorry for the inconvenience. We are looking closely at it.

However, to help upstream understanding what the bug is about (quite a lot of noise here), it would be great to clarify this:
- what distribution are you all using? (vivid/wily, are there trusty user?)
- how do you start those apps? For instance, I'm using intellij and android studio, and I don't get any crash. I tried to start them using the launcher icon or directly from the command line.
- are you using the default openjdk java vm or oracle java version?

That would help us a lot :)

Didier Roche (didrocks) wrote :

Oh also, knowing if you are using an Unity environment or not can be a good indication! (IIRC, that was tested under non Unity environment, but better to confirm) Thanks for your feedback!

Robin Sheat (eythian) wrote :

Didier, the issue is that launching Java causes extra messages to appear in the terminal. If there's a script expecting certain output it gets confused. You can test this just by running "java -version" and seeing if you get the "Picked up JAVA_TOOL_OPTIONS" message that Dzmitry shows in comment #15. It is notable that it may not be identical and other jar files may show up (from memory.)

in my case i can only confirm it as documented in Bug 1451818
I have only run into this with Moneydance program.
Currently the issue still exists.
Ubuntu 15.04 64 bit 3.19.0-30-generic
Moneydance started from hud
using openjdk version "1.8.0_45-internal"
and unity
have worked around the problem by creating a launcher that calls "unset
JAVA_TOOL_OPTIONS && /opt/Moneydance/Moneydance"
thanx
dave

On 09/29/2015 04:36 AM, Didier Roche wrote:
> Thanks for resporting this bug and help to make Ubuntu better. Sorry for
> the inconvenience. We are looking closely at it.
>
> However, to help upstream understanding what the bug is about (quite a lot of noise here), it would be great to clarify this:
> - what distribution are you all using? (vivid/wily, are there trusty user?)
> - how do you start those apps? For instance, I'm using intellij and android studio, and I don't get any crash. I tried to start them using the launcher icon or directly from the command line.
> - are you using the default openjdk java vm or oracle java version?
>
> That would help us a lot :)
>

Didier Roche (didrocks) wrote :

@Robin: the extra message is annoying indeed (only with openjdk), it's hardcoded in openjdk, writing those env variable on stderr. I agree that some written script can have some output expectation on stderr (even if I don't think it's the best and most reliable way of handling output from a script). I think this part will be redirected in another bug report (even if we disable jayatana, to keep a track on it and have that noise turned off on openjdk).

I was wondering if the crash that people here were seeing were due to openjdk 8 instead of 7. I didn't get any crash with it though with jayatana installed, (I checked that /usr/lib/jvm/java-8-openjdk-amd64/bin/java was executed) when starting android studio on my wily machine which was pointed as one of the crashy program. The menu is then correctly exported. Can somebody give a simple (with a program that is in ubuntu repository) step by step reproducer so that we all start from the same bases? That would probably help danjaredg to have a better start.

Changed in jayatana (Ubuntu Vivid):
importance: Undecided → Critical
Didier Roche (didrocks) wrote :

It doesn't seem that the output from openjdk will get removed (see https://bugs.openjdk.java.net/browse/JDK-8039152), I tend to think that we should take the pragmatic approach for now, and remove the env variable initializing it (still giving the option to the user to export it for applications he knows that works well with it).

If there is a general agreement on this (and while upstream is working on maybe a better exported menu support for both GNOME shell and Unity environmen), I can push such a patch to wily and vivid tomorrow. Thought?

Changed in jayatana (Ubuntu Vivid):
status: New → Triaged
jondee (jonathandilks) wrote :

"I tend to think that we should take the pragmatic approach for now, and remove the env variable initializing it (still giving the option to the user to export it for applications he knows that works well with it)." I wholeheartedly agree with this. Giving the user and/or developer the choice is the best way forward.

The ideal situation would be that developers enable Jayatana in their apps for their programs they know work well with it and if they don't the user should be able to do it for them when they know the app works fine.

If we want to make a really good experience for the average user, we could always try and implement a white-listing system for Java apps in Ubuntu (particularly for packaged Java apps)? I appreciate that might be a bit of a fiddly work around though! :)

Éric Piel (pieleric) wrote :

Hi,
In my case, I've noticed it with the arduino IDE, as described in bug 1453094.

That's on Ubuntu 15.04 (x86-64). Java is Oracle java 8 (1.8.0_45, installed via the webup8 ppa).
To reproduce, it's very easy:
1. sudo apt-get arduino
2. arduino
3. Type anything in the file
4. Press the "save" button
=> Crash:
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f93df57ac84, pid=16684, tid=140271369373440
#
# JRE version: Java(TM) SE Runtime Environment (8.0_45-b14) (build 1.8.0_45-b14)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.45-b02 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C [libpthread.so.0+0x9c84] pthread_mutex_lock+0x4
:

Didier Roche (didrocks) wrote :

Ok, let's then do this as it seems there is general agreement here.

Whitelist can be an option as well, however, the issue is that it depends on the environment (for instance, most of the menu crash that are reported here, don't happen with openjdk-7 but only with 8), this can be fixed of course, but it will always been "after the fact", or we need to start maintaining a list of "APP <-> java version <-> … next env factor…" ;)

So, stripping the env line export for wily and SRUing it for 15.04, while pushing the same change to the ubuntu make ppa. We'll need people to confirm that it's fixed for 15.04 using proposed once it's accepted to get it moved to the -updates pocket and be available to everyone.

Thanks again all for your feedbacks!

Didier Roche (didrocks) on 2015-09-30
description: updated
Didier Roche (didrocks) on 2015-09-30
Changed in jayatana (Ubuntu):
status: Triaged → Fix Committed

I get the following building VirtualBox (the problematic command is "javac vboxjxpcom.jar", can't immediately see the full command line). Using Unity and a pretty standard Ubuntu Wily.

Could not find agent library instrument on the library path, with error: libinstrument.so: cannot open shared object file: No such file or directory
kmk: *** [/home/michael/alt-vbox/trunk/out/linux.amd64/debug/obj/VBoxJXpcom-inst-jar/vboxjxpcom.jar] Error 1

Will test your fixed package as soon as it is available.

Erich Schubert (erich) wrote :

Whitelisting will be hard, since some of the problems are probably due to threading problems between the OpenJDK, and the GTK thread used by jayatana. So even if an application works fine on one JDK, it may be broken on the next JDK. The whitelist would then need to check both, and will need to be updated a lot.

Installing jayatana for the user to use "at own risk" is of course okay.

I still do think the way jayatana is injected into the JVM is bound to repeatedly cause such trouble. A more reliable fix would probably be to patch the JDK itself. It then would of course not apply to Oracle JDKs (unless merged back by them), and require updates with new JDK versions. The place to do this would probably be "jdk/src/solaris/native/sun/awt/{swing_GTK*,gtk*}.c" and "com/sun/java/swing/plaf/gtk/*.java"; or by implementing this as an alternate "Unity" look-and-feel altogether.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package jayatana - 2.7-0ubuntu4

---------------
jayatana (2.7-0ubuntu4) wily; urgency=medium

  * Do not export JAVA_TOOL_OPTION session file for now. It seems jayatana
    breaks some tools which are running java -version to grep for the runtime
    version. Openjdk hardcode though some outputs "Picked up <variable name>"
    that can't be suppress and isn't willing to remove it as they see it as
    a security vulnerability. Remove session variable export until java
    upstream get a proper upstream solution for Gnome Shell and Unity global
    menu. (LP: #1441487)
    Meanwhile, people who wants to keep this functionality enabled (or
    programs which knows are working well with it) can reexport
    JAVA_TOOL_OPTIONS="-javaagent:/usr/share/java/jayatanaag.jar
    $JAVA_TOOL_OPTIONS" in their session environment on a per program by
    program bases.

 -- Didier Roche <email address hidden> Tue, 29 Sep 2015 17:40:39 +0200

Changed in jayatana (Ubuntu):
status: Fix Committed → Fix Released

Hello Kumbarov, or anyone else affected,

Accepted jayatana into vivid-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/jayatana/2.7-0ubuntu3.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in jayatana (Ubuntu Vivid):
status: Triaged → Fix Committed
tags: added: verification-needed
Didier Roche (didrocks) on 2015-09-30
Changed in hundredpapercuts:
status: Triaged → Fix Committed

Seems to work for me (see comment 35).

bademux (bademux) wrote :

PLEASE dont fix what is not broken!
It isn't jayatana problem but problem of " Some programs" .
Consider to revert "Do not export JAVA_TOOL_OPTION session file for now" and create some compatibility layer for broken applications.

Please don't fragment application UX for Unity, in this way you get UX\UI monster parade in Ubuntu.
Please be the OS, not a Frankenstain

bademux (bademux) wrote :

It is normal Hotspot JVM output - "Picked up %s: %s\n"
see for more info: http://hg.openjdk.java.net/jdk7/jdk7/hotspot/file/tip/src/share/vm/runtime/arguments.cpp

Sorry for double posting.

Didier Roche (didrocks) wrote :

@bademux: indeed, but it seems that the amount of broken apps is too large to be at a acceptable default experience, so we back it off from previous release.
However, are a user, you can still export this variable (jayatana is kept being installed), and any help is welcome meanwhile in fixing those broken apps or ensuring openjdk/oracle java exports this message in a way that won't break script.

dave albright (fromhell-dave) wrote :

install of the proposed jayatana package seems to have fixed Bug 1451818
crash no longer happens and dialogs act as they should
thanx
dave

Didier Roche (didrocks) on 2015-10-02
tags: added: verification-done
removed: verification-needed
jondee (jonathandilks) wrote :

@bademux "PLEASE dont fix what is not broken!" - sadly though, this statement is not true as Jayatana is presently very broken both for existing apps and for apps using Swing I've been developing in Java myself.

I do however share your opinion that ideally we should by trying to keep the UX unified where possible. However Java apps have always been a bit different in that they never ever did natively use GTK, as most Java apps are implemented in Swing (even on Windows). I also like Jayatana when it works, but it's Jayatana itself that is supposed to be a compatibility layer between Swing and Unity/ the Ayatana project so I don't understand what your idea of another compatibility would actually look like?!? :S If the Jayatana project becomes a bit more tested, matured and more actively developed than maybe we can can start to consider it again in the future.

Erich Schubert (erich) wrote :

Note that the bug description, and the changelog entry are MISLEADING.

jayatana BREAKS unrelated applications.

It's not just an irritating error message that is not supported by some shell scripts, but jayatana is causing NullPointerExceptions all over the place in unrelated programs, and even causing SIGSEGV as you can see above!

It is NOT just the hotspot output that is causing problems. jayatana is a really really BROKEN approach, and in my opinion is is so badly broken that it cannot even be fixed properly (because of threading issues - to get this kind of menus, you need to have dbus integrated; which means you need another thread that must be properly synchronized with Java - including whatever other hacks Java programs such as NetBeans, Eclipse etc. may do... - unless you write a non-JNI dbus API for Java this is bound to cause trouble, big time. Launching threads from JNI is pretty much never a good idea, even less when the Java application doesn't even know about this thread...)

jondee (jonathandilks) wrote :

@erich Thank you for explaining what it is about Jayatana that makes it break so easily. I understand the Java side of the issue fairly well, and empirically, about how much Jayatana was breaking things. But I wasn't really sure what was happening on the system/ JVM side other than the issues occurring were getting fairly low level and your explanation about the lack of safe threading between the processes helps this make sense!

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package jayatana - 2.7-0ubuntu3.1

---------------
jayatana (2.7-0ubuntu3.1) vivid; urgency=medium

  * Do not export JAVA_TOOL_OPTION session file for now. It seems jayatana
    breaks some tools which are running java -version to grep for the runtime
    version. Openjdk hardcode though some outputs "Picked up <variable name>"
    that can't be suppress and isn't willing to remove it as they see it as
    a security vulnerability. Remove session variable export until java
    upstream get a proper upstream solution for Gnome Shell and Unity global
    menu. (LP: #1441487)
    Meanwhile, people who wants to keep this functionality enabled (or
    programs which knows are working well with it) can reexport
    JAVA_TOOL_OPTIONS="-javaagent:/usr/share/java/jayatanaag.jar
    $JAVA_TOOL_OPTIONS" in their session environment on a per program by
    program bases.

 -- Didier Roche <email address hidden> Tue, 29 Sep 2015 17:40:39 +0200

Changed in jayatana (Ubuntu Vivid):
status: Fix Committed → Fix Released

The verification of the Stable Release Update for jayatana has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Marlin Cremers (marlinc) wrote :

I noticed that the Unity integration with IntellIJ IDEA stopped working. Then I found out that the JAVA_TOOL_OPTIONS environment variable was removed in the latest version. Is there a way to put this back? If so where?

bademux (bademux) wrote :

+Marlin Cremers (marlinc)
run "echo -javaagent:/usr/share/java/jayatanaag.jar >> ~/tools/ide/idea/bin/idea64.vmoptions"
for 64 bit Idea by "umake ide idea"

...they broke HUD in most useful place in favor of some unknown apps...

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers