Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to print the exception message to give more information #1429

Merged
merged 1 commit into from
Sep 4, 2024

Conversation

tjwatson
Copy link
Contributor

If running on a system that does not have the required glibc version then important information is lost to tell the user what is wrong. For example:

version 'GLIBC_2.34' not found (required by .../libswt-pi3-gtk-4966r6.so)

@tjwatson
Copy link
Contributor Author

I think this is necessary before #1426 is done otherwise it will be impossible for end users to know why Eclipse fails to start when they don't have the required glibc version.

Copy link
Contributor

github-actions bot commented Aug 29, 2024

Test Results

   486 files  ±0     486 suites  ±0   8m 9s ⏱️ - 1m 1s
 4 151 tests ±0   4 143 ✅ ±0   8 💤 ±0  0 ❌ ±0 
16 358 runs  ±0  16 266 ✅ ±0  92 💤 ±0  0 ❌ ±0 

Results for commit 5329fd6. ± Comparison against base commit 482c7ca.

♻️ This comment has been updated with latest results.

Copy link
Member

@HannesWell HannesWell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that this is imporant and it looks good.

version 'GLIBC_2.34' not found (required by .../libswt-pi3-gtk-4966r6.so)

Is that the message of the exception that is printed with this?
If not, could you please provide an example?

@tjwatson
Copy link
Contributor Author

Is that the message of the exception that is printed with this? If not, could you please provide an example?

Here is the sanitized exceptions after removing my system path information:

java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: 
	Failed to load library (".../eclipse/configuration/org.eclipse.osgi/266/0/.cp/libswt-pi3-gtk-4966r6.so") /lib64/libc.so.6: version `GLIBC_2.34' not found (required by .../eclipse/configuration/org.eclipse.osgi/266/0/.cp/libswt-pi3-gtk-4966r6.so)
	Can't load swt-pi3-gtk
	Can't load swt-pi3
	Failed to load library (".../.swt/lib/linux/x86_64/libswt-pi3-gtk-4966r6.so") /lib64/libc.so.6: version `GLIBC_2.34' not found (required by .../.swt/lib/linux/x86_64/libswt-pi3-gtk-4966r6.so)
	Can't load .../.swt/lib/linux/x86_64/libswt-pi3-gtk.so
	Can't load .../.swt/lib/linux/x86_64/libswt-pi3.so
	Failed to load library (".../.swt/lib/linux/x86_64/libswt-pi3-gtk-4966r6.so") /lib64/libc.so.6: version `GLIBC_2.34' not found (required by .../.swt/lib/linux/x86_64/libswt-pi3-gtk-4966r6.so)

The message is a little weird because of all the different fallbacks SWT has for attempting to load its libraries.

@akurtakov akurtakov force-pushed the printExceptionMessage branch from 23d5cf6 to da4cb1f Compare September 4, 2024 05:03
@laeubi
Copy link
Contributor

laeubi commented Sep 4, 2024

The message is a little weird because of all the different fallbacks SWT has for attempting to load its libraries.

I wonder if Javas "suppressed exception" feature could better be used here? this was for sure not possible at the time this method was introduced, but should work with Java 17?

If running on a system that does not have the required glibc
version then important information is lost to tell the user
what is wrong. For example:

version 'GLIBC_2.34' not found (required by .../libswt-pi3-gtk-4966r6.so)

The fallback is tried if that fails then its exception is added
as suppressed by the original exception and the original is thrown.
@tjwatson tjwatson force-pushed the printExceptionMessage branch from da4cb1f to 5329fd6 Compare September 4, 2024 14:43
@tjwatson
Copy link
Contributor Author

tjwatson commented Sep 4, 2024

This now records the error in the log like this:

1725464596788.log

SESSION 2024-09-04 10:43:16.617 -----------------------------------------------
eclipse.buildId=4.33.0.I20240828-1820
java.fullversion=21.0.3+9-LTS
JRE 21 Linux amd64-64-Bit Compressed References 20240416_177 (JIT enabled, AOT enabled)
OpenJ9   - b0699311c7
OMR      - 254af5a04
JCL      - ac8f341bc20 based on jdk-21.0.3+9
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments:  -os linux -ws gtk -arch x86_64

!ENTRY org.eclipse.osgi 4 0 2024-09-04 10:43:20.668
!MESSAGE Application error
!STACK 1
java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: 
	Failed to load library (".../Downloads/eclipse-SDK-I20240828-1820-linux-gtk-x86_64/eclipse/configuration/org.eclipse.osgi/266/0/.cp/libswt-pi3-gtk-4966r6.so") /lib64/libc.so.6: version `GLIBC_2.34' not found (required by .../Downloads/eclipse-SDK-I20240828-1820-linux-gtk-x86_64/eclipse/configuration/org.eclipse.osgi/266/0/.cp/libswt-pi3-gtk-4966r6.so)
	Can't load swt-pi3-gtk
	Can't load swt-pi3
	Failed to load library (".../.swt/lib/linux/x86_64/libswt-pi3-gtk-4966r6.so") /lib64/libc.so.6: version `GLIBC_2.34' not found (required by .../.swt/lib/linux/x86_64/libswt-pi3-gtk-4966r6.so)
	Can't load .../.swt/lib/linux/x86_64/libswt-pi3-gtk.so
	Can't load .../.swt/lib/linux/x86_64/libswt-pi3.so
	Failed to load library (".../.swt/lib/linux/x86_64/libswt-pi3-gtk-4966r6.so") /lib64/libc.so.6: version `GLIBC_2.34' not found (required by .../.swt/lib/linux/x86_64/libswt-pi3-gtk-4966r6.so)

	at org.eclipse.swt.internal.Library.loadLibrary(Library.java:345)
	at org.eclipse.swt.internal.Library.loadLibrary(Library.java:254)
	at org.eclipse.swt.internal.gtk.OS.<clinit>(OS.java:99)
	at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:209)
	at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:155)
	at org.eclipse.swt.widgets.Display.<clinit>(Display.java:170)
	at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:721)
	at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI.java:185)
	at org.eclipse.ui.internal.ide.application.IDEApplication.createDisplay(IDEApplication.java:182)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:125)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:208)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:143)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:109)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:439)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:271)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:586)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:668)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:605)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1481)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1454)
	Suppressed: java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: 
	Can't load swt-pi4-gtk-4966r6
	Can't load swt-pi4-gtk
	Can't load swt-pi4
	Can't load .../.swt/lib/linux/x86_64/libswt-pi4-gtk-4966r6.so
	Can't load .../.swt/lib/linux/x86_64/libswt-pi4-gtk.so
	Can't load .../.swt/lib/linux/x86_64/libswt-pi4.so

		at org.eclipse.swt.internal.Library.loadLibrary(Library.java:345)
		at org.eclipse.swt.internal.Library.loadLibrary(Library.java:254)
		at org.eclipse.swt.internal.gtk.OS.<clinit>(OS.java:103)
		.../ 18 more

Copy link
Contributor

@laeubi laeubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be sufficient, as with all native errors its hard to understand for the user but includes enough to find out for someone investigating the failure and much better than simply hide the cause!

@tjwatson tjwatson merged commit d200d94 into eclipse-platform:master Sep 4, 2024
11 of 14 checks passed
lathapatil pushed a commit to swt-initiative31/prototype-gtk that referenced this pull request Nov 14, 2024
…-platform#1429)

If running on a system that does not have the required glibc
version then important information is lost to tell the user
what is wrong. For example:

version 'GLIBC_2.34' not found (required by .../libswt-pi3-gtk-4966r6.so)

The fallback is tried if that fails then its exception is added
as suppressed by the original exception and the original is thrown.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants