Bug 465531

Summary: unable to run java applets from firefox on fedora 10 x86_64
Product: [Fedora] Fedora Reporter: Donald Cohen <don-redhat-z6y>
Component: java-1.6.0-openjdkAssignee: Deepak Bhole <dbhole>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 10CC: gecko-bugs-nobody, langel, lkundrak, mcepl, mjw, walters
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-12-12 04:23:19 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
~/.xsession-errors
none
shell transcript
none
the file name says it all
none
transcript of shell containing comments, saved as plain text
none
java.stdout
none
java.err none

Description Donald Cohen 2008-10-03 18:35:03 UTC
Description of problem:
I guess this is all supposed to work automatically, since I can't find any documentation describing what I'm supposed to do or how to tell what's wrong.
$ uname -a
Linux number11.don-eve.dyndns.org 2.6.27-0.372.rc8.fc10.x86_64 #1 SMP Tue Sep 30 00:58:34 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux

last occurrence of firefox in yum.log:
Oct 01 15:29:21 Updated: firefox-3.0.2-1.fc10.x86_64

In order to get some output I run firefox from shell:
==== transcript====
$ firefox &
[1] 5696
[2008-10-03 11:24:15 root@number11 /tmp]
$ ../src/npw-wrapper.c:2554../src/npw-wrapper.c:2668../src/npw-viewer.c:3602../src/npw-viewer.c:2403../src/npw-viewer.c:2405../src/npw-viewer.c:2403../src/npw-viewer.c:2405../src/npw-viewer.c:2403../src/npw-viewer.c:2405../src/npw-viewer.c:2382../src/npw-viewer.c:2384../src/npw-viewer.c:3602../src/npw-viewer.c:2403GCJ PLUGIN: thread 0x1f8fbc0: NP_GetValue
GCJ PLUGIN: thread 0x1f8fbc0: NP_GetValue: returning plugin description.
GCJ PLUGIN: thread 0x1f8fbc0: NP_GetValue return
../src/npw-viewer.c:2405../src/npw-viewer.c:3381../src/npw-viewer.c:3384../src/npw-wrapper.c:2827../src/npw-wrapper.c:2879../src/npw-viewer.c:2519../src/npw-viewer.c:2486../src/npw-viewer.c:2511GCJ PLUGIN: thread 0x1f8fbc0: NP_Initialize
GCJ PLUGIN: thread 0x1f8fbc0: NP_Initialize: using /usr/bin/gappletviewer.
GCJ PLUGIN: thread 0x1f8fbc0: NP_Initialize return
../src/npw-viewer.c:2513../src/npw-wrapper.c:2618../src/npw-wrapper.c:1381../src/npw-viewer.c:2616../src/npw-viewer.c:2595GCJ PLUGIN: thread 0x1f8fbc0: GCJ_New
GCJ PLUGIN: thread 0x1f8fbc0: plugin_data_new
../src/npw-viewer.c:894GCJ PLUGIN: thread 0x1f8fbc0: plugin_data_new return
GCJ PLUGIN: thread 0x1f8fbc0: plugin_get_documentbase
../src/npw-wrapper.c:2955../src/npw-wrapper.c:2885*** NSPlugin Wrapper *** ERROR: NPP_New() wait for reply: Connection closed
../src/npw-wrapper.c:1383

Comment 1 Matěj Cepl 2008-10-06 23:19:22 UTC
Created attachment 319602 [details]
~/.xsession-errors

Can reproduce with firefox-3.0.2-1.fc10.i386 and java-1.6.0-openjdk-plugin-1.6.0.0-0.21.b12.fc10.i386 looking at http://www4.passur.com/bos.html which displayed the page, but no airplanes (although it was 19:15 on Monday in Boston, so there should be a plane somewhere around)

Comment 2 Bug Zapper 2008-11-26 03:31:15 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 10 development cycle.
Changing version to '10'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 3 Donald Cohen 2008-12-10 23:15:11 UTC
I just upgraded to fedora 10 (and did yum update)
I now seem to have firefox 3.0.4
It says it has the icedtea plugin.
When I run from shell and try to start an applet I get the following output.

ICEDTEAPLUGIN_DEBUG = (null)
Initializing JVM...

And there it hangs.

Comment 4 Deepak Bhole 2008-12-11 01:27:27 UTC
Looks like something went wrong during installation. What does about:plugins say the Java plugin is?

Also, can you paste the output of:
1. rpm -q java-1.6.0-openjdk-plugin
2. readlink -f /usr/lib64/mozilla/plugins/libjavaplugin.so
3. rpm -qV java-1.6.0-openjdk-plugin (assuming #1 shows a version installed)

Comment 5 Donald Cohen 2008-12-11 03:13:06 UTC
(In reply to comment #4)
> Looks like something went wrong during installation. What does about:plugins
> say the Java plugin is?
IcedTea
I see many lines containing IcedTea, starting with
application/x-java-vm 	IcedTea 	class,jar 	Yes
application/x-java-applet 	IcedTea 	class,jar 	Yes
application/x-java-applet;version=1.1 	IcedTea 	class,jar 	Yes

> Also, can you paste the output of:
> 1. rpm -q java-1.6.0-openjdk-plugin
> 2. readlink -f /usr/lib64/mozilla/plugins/libjavaplugin.so
> 3. rpm -qV java-1.6.0-openjdk-plugin (assuming #1 shows a version installed)

# rpm -q java-1.6.0-openjdk-plugin
java-1.6.0-openjdk-plugin-1.6.0.0-8.b14.fc11.x86_64
# readlink -f /usr/lib64/mozilla/plugins/libjavaplugin.so
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/IcedTeaPlugin.so
# rpm -qV java-1.6.0-openjdk-plugin 

(no output) 
(what output did you expect?)

Comment 6 Deepak Bhole 2008-12-11 04:02:45 UTC
Everything appears to be correct (the last command gives output only if something is wrong).

Can you try it again -- close all firefox instances, and start it from a console as:

ICEDTEAPLUGIN_DEBUG=true firefox

and send me the resulting log, and the /tmp/java.std* files (assuming any are created)?

Comment 7 Donald Cohen 2008-12-11 05:05:18 UTC
Created attachment 326585 [details]
shell  transcript

comments are in the transcript

Comment 8 Donald Cohen 2008-12-11 05:06:36 UTC
Created attachment 326586 [details]
the file name says it all

(why must I add a comment?)

Comment 9 Donald Cohen 2008-12-11 05:08:02 UTC
Created attachment 326587 [details]
transcript of shell containing comments, saved as plain text

Comment 10 Donald Cohen 2008-12-11 05:08:54 UTC
Created attachment 326588 [details]
java.stdout

Comment 11 Donald Cohen 2008-12-11 05:09:35 UTC
Created attachment 326589 [details]
java.err

Comment 12 Donald Cohen 2008-12-11 05:11:58 UTC
Ignore the two files automatically misinterpreted as binary.
I wanted to comply with the request to post the resulting log (transcript)
and the two java.std* files- these are the last 3 attached files.

Comment 13 Deepak Bhole 2008-12-11 16:00:18 UTC
Hmm that looks okay too. So what happens after that last line in the log (... GetJavaObject ...). It just hangs?

Comment 14 Donald Cohen 2008-12-11 17:25:09 UTC
Now that I have rebooted from the crash I thought I should try it again and
it works.  So I think this is a different bug.
However, I do still have a related question - how can I get a java console?

Comment 15 Deepak Bhole 2008-12-11 18:31:05 UTC
I am not aware of any way to show the console in Firefox > 3.0. Do you need the console for debugging an applet? If so, you can start firefox as 'ICEDTEAPLUGIN_DEBUG=true firefox' , and that will start the underlying vm with a debug server, which can then remotely debug via port 8787.

Comment 16 Donald Cohen 2008-12-11 18:59:19 UTC
(In reply to comment #15)
> I am not aware of any way to show the console in Firefox > 3.0. Do you need the
> console for debugging an applet? If so, you can start firefox as
yes, exactly

> 'ICEDTEAPLUGIN_DEBUG=true firefox' , and that will start the underlying vm with
> a debug server, which can then remotely debug via port 8787.

You mean like 
 telnet localhost 8787
or
 http://localhost:8787 ?
Neither of those seem to work.

Where can I find some doc on this?
I was not even aware of any such shell syntax as the command above.

Comment 17 Deepak Bhole 2008-12-11 19:07:49 UTC
No, that is for debugging, it will only work when attaching a debugger. What is it that you need the console for? Do you need to debug an applet, or do you need to monitor it's output?

Comment 18 Donald Cohen 2008-12-11 19:49:30 UTC
(In reply to comment #17)
> No, that is for debugging, it will only work when attaching a debugger. What is
> it that you need the console for? Do you need to debug an applet, or do you
> need to monitor it's output?

I'd at least like to see the console output - that's where I tend to write debugging info.  If I can do more, that would be even better.
What is the protocol for connecting to that port?  
What tools know how to do that already?  (I'm guessing eclipse?)
And back to my original question, where's some doc for all this?

Comment 19 Deepak Bhole 2008-12-11 20:21:33 UTC
Nope, there are no docs for it atm :/

Okay, so if you just want to monitor output, it is much simpler. Just start firefox from console with the ICEDTEAPLUGIN_DEBUG=true .. and then monitor the /tmp/java.stdout and /tmp/java.stderr files. That is where stdout and stderr from the applet will go.

If you do wish to debug, you can start firefox with ICEDTEAPLUGIN_DEBUG=true, and attach a debugger to the underlying vm. To do that:

1. Start firefox from console as ICEDTEAPLUGIN_DEBUG=true firefox
2. Go to the page where the applet is, and let it load.
3. Load your applet project in Eclipse and open it
4. Go to Run->Debug Configurations
5. Double-click "Remote Java Applications" in the listbox on the left
6. Provide a name and make sure the right project is selected, and set the Port to 8787 (default is 8000). The rest of the items can stay at default (Connection type = Standard Socket Attach and Host = localhost).
7. Click apply to save it, and then click debug.

From then on, you can you can debug the instances directly by going to Run->Debug History-><The name you gave in step 6>

Comment 20 Donald Cohen 2008-12-11 20:36:07 UTC
Thank you.
But where do you find this info?
And also tell me about the strange command line, and where you find this documented.

Comment 21 Deepak Bhole 2008-12-11 20:38:36 UTC
I didn't find it anywhere. I am the IcedTea plugin maintainer, so I know the internals :)

Comment 22 Donald Cohen 2008-12-11 20:54:43 UTC
Well it ought to be documented somewhere so people like me can find it!
I still want to know about the funky command line.
Also, do you know where to find doc about how to control which java plugin is used by firefox, what parameters are passed, etc?
There used to be a java control panel - what became of that?  I see it on my FC6 machine but not in Fedora 10.  Not that I ever understood how that communicated with firefox ...
And, come to think of it, in Fedora 10 Alpha there was another browser, part of KDE I think, Konqueror ?  All the same questions (if not more) apply to that.
I want to find out how to try different combinations of browsers and java plugins.

I know this is way off the original topic.  I'll be happy to open another bug if you prefer.
I also thank you profusely for all the help you have already given me.

Comment 23 Deepak Bhole 2008-12-11 21:16:51 UTC
Until now I was the only user of the debug features, but there are more users now and you're right, it should be documented. Okay, I have added a note to my task list to create a wiki page with this info.

What do you need to know about the commandline?

The plugin used by firefox is determined based on what is in the plugins dir. Firefox first searches $LIBDIR/mozilla/plugins and then ~/.mozilla/plugins for available plugins. IcedTea plugin is set up via the alternatives system. /usr/lib[64]/mozilla/plugins/libjavaplugin.so is a link to a file in /etc/alternatives which ultimately links to IcedTeaPlugin.so distributed with the JVM.

The java console option was removed from Firefox options a while ago. Sun's Java plugin allows showing of the Java console by checking the appropriate box in the plugin Control Panel.

As for konqueror.. I had never tried it, but it (the plugin) doesn't seem to work with it for some reason. I have opened a bug against it: Bug #476091

Comment 24 Donald Cohen 2008-12-11 22:44:00 UTC
 > What do you need to know about the commandline?
  ICEDTEAPLUGIN_DEBUG=true firefox
I always thought that the shell expected the first thing on the line to be the name of a program that is to be run, and the rest to be arguments passed to that program.
If I do 
 which ICEDTEAPLUGIN_DEBUG=true
or
 which ICEDTEAPLUGIN_DEBUG
or
 which ICEDTEAPLUGIN
I get back the message that it's not found in my search path.
So how should I interpret that line?
And where's the doc that tells me that this is how any shell interprets it?

I now see in man bash something called "variable assignment", which is not well
described.  Is that what this is?
So the command is something like this?
 export ICEDTEAPLUGIN_DEBUG=true ; firefox

Is there a list of such variables and what the possible values mean?
For instance, perhaps this is how I can control the memory available to the JVM used for applets?  How are you supposed to control that now?
This sort of thing seems too important to be undocumented.

Comment 25 Deepak Bhole 2008-12-11 23:12:26 UTC
ICEDTEAPLUGIN_DEBUG is a variable you are setting.

When you tun "ICEDTEAPLUGIN_DEBUG=true firefox" on the command line, bash sets the variable ICEDTEAPLUGIN_DEBUG to value "true", and then starts firefox. Once firefox is closed, ICEDTEAPLUGIN_DEBUG is no longer set on the shell.

If on the other hand you do "export ICEDTEAPLUGIN_DEBUG=true ; firefox", it will export the variable ICEDTEAPLUGIN_DEBUG and set it to true. This will work too, but then when you exit firefox, ICEDTEAPLUGIN_DEBUG will continue to remain set in that shell until you exit.

As for controlling things like memory set aside for applets, that is not possible with the IcedTea plugin at this time. Besides, this is not something you should rely on any way. Even if there were a way to change those options, you can only make that change on your own machine, and not one anyone else's who might visit your page.

Comment 26 Donald Cohen 2008-12-11 23:23:04 UTC
I agree you can't count on other browsers to set it, but you can
show users how much memory is left, tell them how much they need in order to do what they want to, and show them instructions for making that much available.
At least you can do that for sun java plugins that use the java control panel.
I'm guessing this is still available in windows, for example.

Comment 27 Deepak Bhole 2008-12-12 04:23:19 UTC
Do you have an applet that is running out/can run out of memory, or is this hypothetical?

In either case, you need to open a separate bug for it so I can track it via that and explore potentials ways to address this. In the mean time, I am closing this issue since it is fixed. If you have any further questions, please feel free to send a note to distro-pkg-dev.net -- that is the mailing list for IcedTea.

Comment 28 Donald Cohen 2008-12-12 04:40:46 UTC
Actually I do have an applet that tends to run out.
In the past I've referred users to this page:
http://www.duckware.com/pmvr/howtoincreaseappletmemory.html
Given that all applets share the same VM, you're always in danger of running out because of what other applets do -- only one reason that I think someone was crazy to make all applets share the same VM.
In general I think one needs control over all the various parameters that control JVM, and this ought to be possible on an individual applet basis.
Of course, the fact that this is not supported is not YOUR bug.
In any case, feel free to file a new bug for the ability to control memory and other parameters of JVM's created by browsers, and put me on the CC.