Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » How to avoid crashing the JVM on Linux with GTK3
How to avoid crashing the JVM on Linux with GTK3 [message #1353143] Tue, 13 May 2014 19:58 Go to next message
Kris De Volder is currently offline Kris De VolderFriend
Messages: 5
Registered: August 2012
Junior Member
Short version of my question:

How can I detect that Eclipse is running GTK3?

I need this 'check' to be able to avoid opening EFX widgetry because they will immediately crash the JVM.

Actually... it would be nicer if efx runtime itself performed this check and throws some kind of exception we can recover from instead of crashing the JVM.

Longer version with some background (no need to read if you don't want to Smile

In Spring Tool Suite we have a 'dashboard' component that uses JavaFX webview to render. Unfortunately when trying to use this on Eclipse 4.4 M7 it immediately crashes the JVM [1].

I assume this is because Eclipse 4.4 now uses GTK3 by default [2] and Efclipse/JavaFX is not compatible (can't remember where I got that information, but I gather it is true).

The problem can be avoided by setting environment variable SWT_GTK3=0 before launching the product. However this solution is not acceptable, we really want to use the JavaFX implementation if we can, and detect when we are in an incompatible environment to open a fallback implementation instead.

Kris

[1] = https : //issuetracker.springsource.com/browse/STS-3829
[2] = https : //bugs.eclipse.org/bugs/show_bug.cgi?id=420182
Re: How to avoid crashing the JVM on Linux with GTK3 [message #1353368 is a reply to message #1353143] Tue, 13 May 2014 22:13 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi,

Right JavaFX is linked against GTK 2.x and it won't change anytime soon
if I get the JavaFX people right.

We are talking about the SWT-Embedding right? I guess we could check SWT
and which GTK version it uses but how would you detect that then - by
trying to load a JavaFX class but get a ClassNotFoundException?

Please file a bug!

IMHO the main advantage of GTK3 is that the embedded SWT webkit is not
crashing - something you fixed by embedding JavaFX ;-) SWT-GTK3 is not
really working here at our company - so we are ALL running with
SWT_GTK3=0 :-(

Tom

On 13.05.14 21:58, Kris De Volder wrote:
> Short version of my question:
>
> How can I detect that Eclipse is running GTK3?
> I need this 'check' to be able to avoid opening EFX widgetry because
> they will immediately crash the JVM.
>
> Actually... it would be nicer if efx runtime itself performed this check
> and throws some kind of exception we can recover from instead of
> crashing the JVM.
>
> Longer version with some background (no need to read if you don't want
> to :)
>
> In Spring Tool Suite we have a 'dashboard' component that uses JavaFX
> webview to render. Unfortunately when trying to use this on Eclipse 4.4
> M7 it immediately crashes the JVM [1].
>
> I assume this is because Eclipse 4.4 now uses GTK3 by default [2] and
> Efclipse/JavaFX is not compatible (can't remember where I got that
> information, but I gather it is true).
>
> The problem can be avoided by setting environment variable SWT_GTK3=0
> before launching the product. However this solution is not acceptable,
> we really want to use the JavaFX implementation if we can, and detect
> when we are in an incompatible environment to open a fallback
> implementation instead.
>
> Kris
>
> [1] = https : //issuetracker.springsource.com/browse/STS-3829
> [2] = https : //bugs.eclipse.org/bugs/show_bug.cgi?id=420182
Re: How to avoid crashing the JVM on Linux with GTK3 [message #1353479 is a reply to message #1353368] Tue, 13 May 2014 23:18 Go to previous messageGo to next message
Kris De Volder is currently offline Kris De VolderFriend
Messages: 5
Registered: August 2012
Junior Member
> We are talking about the SWT-Embedding right?

Yes, an eclipse plugin using JavaFX to create a Eclipse View.

> I guess we could check SWT
> and which GTK version it uses but how would you detect that then

I was hoping you would know. That was my question Smile

>- by trying to load a JavaFX class but get a ClassNotFoundException?

I don't think that will work because that seems to cause a JVM crash, not a CNFE.
You would need to find a way to determine which native libraries are loaded and check this *before* doing anything with JavaFX.

> Please file a bug!

Alright, will file a bug asking for a 'nice exception' instead of 'nasty crash' in unsupported environment. I'll try to come up with a simple test program that causes the crash.

> IMHO the main advantage of GTK3 is that the embedded SWT webkit is not
crashing - something you fixed by embedding JavaFX Wink SWT-GTK3 is not
really working here at our company - so we are ALL running with
SWT_GTK3=0 Sad

Yes, and this is realy ironic. If the SWT browser widget works (GTK3) we don't really need JavaFX anymore in theory. However... if we want to work in different environments we need some way for our code to 'test the waters' without crashing the JVM in the process.

Kris

On 13.05.14 21:58, Kris De Volder wrote:
> Short version of my question:
>
> How can I detect that Eclipse is running GTK3?
> I need this 'check' to be able to avoid opening EFX widgetry because
> they will immediately crash the JVM.
>
> Actually... it would be nicer if efx runtime itself performed this check
> and throws some kind of exception we can recover from instead of
> crashing the JVM.
>
> Longer version with some background (no need to read if you don't want
> to Smile
>
> In Spring Tool Suite we have a 'dashboard' component that uses JavaFX
> webview to render. Unfortunately when trying to use this on Eclipse 4.4
> M7 it immediately crashes the JVM [1].
>
> I assume this is because Eclipse 4.4 now uses GTK3 by default [2] and
> Efclipse/JavaFX is not compatible (can't remember where I got that
> information, but I gather it is true).
>
> The problem can be avoided by setting environment variable SWT_GTK3=0
> before launching the product. However this solution is not acceptable,
> we really want to use the JavaFX implementation if we can, and detect
> when we are in an incompatible environment to open a fallback
> implementation instead.
>
> Kris
>
> [1] = https : //issuetracker.springsource.com/browse/STS-3829
> [2] = https : //bugs.eclipse.org/bugs/show_bug.cgi?id=420182[/quote]
Re: How to avoid crashing the JVM on Linux with GTK3 [message #1354300 is a reply to message #1353479] Wed, 14 May 2014 07:39 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Hi,

On 14.05.14 01:18, Kris De Volder wrote:
>> We are talking about the SWT-Embedding right?
>
> Yes, an eclipse plugin using JavaFX to create a Eclipse View.
>
>> I guess we could check SWT
>> and which GTK version it uses but how would you detect that then
>
> I was hoping you would know. That was my question :)
>
>> - by trying to load a JavaFX class but get a ClassNotFoundException?
>
> I don't think that will work because that seems to cause a JVM crash,
> not a CNFE.
> You would need to find a way to determine which native libraries are
> loaded and check this *before* doing anything with JavaFX.

What I meant was that in case I detect we are on SWT & GTK3 and you try
to e.g. load FXCanvas I won't return you the class but throw an CNFE.

I don't think it would be correct to throw an CNFE for any JavaFX class
because e.g. the the stuff that does not need an UI - e.g.
JavaFX-Properties are still fine.

>
>> Please file a bug!
>
> Alright, will file a bug asking for a 'nice exception' instead of 'nasty
> crash' in unsupported environment. I'll try to come up with a simple
> test program that causes the crash.
>

I don't think I need a sample application (I don't currently have a
Linux-System anyways).

Tom
Re: How to avoid crashing the JVM on Linux with GTK3 [message #1355097 is a reply to message #1354300] Wed, 14 May 2014 15:17 Go to previous message
Kris De Volder is currently offline Kris De VolderFriend
Messages: 5
Registered: August 2012
Junior Member
Bug raised: https://bugs.eclipse.org/bugs/show_bug.cgi?id=434869
Previous Topic:DS services problem
Next Topic:Override captions on Dialogs
Goto Forum:
  


Current Time: Fri Apr 26 21:06:48 GMT 2024

Powered by FUDForum. Page generated in 0.03875 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top