Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 340341

Summary: [LTTng] Missing liblttngtrace format not handled gracefully at all
Product: z_Archived Reporter: Daniel U. Thibault <d.u.thibault>
Component: LinuxToolsAssignee: Francois Chouinard <fchouinard>
Status: CLOSED FIXED QA Contact: Francois Chouinard <fchouinard>
Severity: normal    
Priority: P3 CC: ykuo
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on:    
Bug Blocks: 321366    
Attachments:
Description Flags
patch to display error dialog when native trace library fails to load instead of displaying stack trace in console
fchouinard: iplog+
screenshot of the new error dialog
none
Alternative error dialog none

Description Daniel U. Thibault CLA 2011-03-17 12:03:24 EDT
Build Identifier: M20100909-0800

If you install just the latest liblttngtrace format and then try to import an older-format trace into an LTTng project, the application sort of crashes without any obvious feedback (no alert reporting the problem) and becomes unusable.

The host eclipse application captures the error:
Contributor org.eclipse.ui.navigator.ProjectExplorer cannot be created.
Plug-in org.eclipse.ui.navigator.resources was unable to instantiate class org.eclipse.ui.internal.navigator.resources.workbench.TabbedPropertySheetTitleProvider

Upon double-clicking the imported trace (yes, it did appear in the explorer, contrary to what should have happened), the host eclipse application's console captures:

org.eclipse.linuxtools.lttng.trace.LTTngTraceException: Failed to initialize library! Is the trace version supported?
Make sure you have the correct LTTv library compiled. (openTrace)
	at org.eclipse.linuxtools.lttng.trace.LTTngTrace.<init>(LTTngTrace.java:152)
	at org.eclipse.linuxtools.lttng.trace.LTTngTrace.<init>(LTTngTrace.java:125)
	at org.eclipse.linuxtools.lttng.ui.views.project.ProjectView.selectTrace(ProjectView.java:182)
	at org.eclipse.linuxtools.lttng.ui.views.project.ProjectView.access$2(ProjectView.java:173)
	at org.eclipse.linuxtools.lttng.ui.views.project.ProjectView$3.mouseDoubleClick(ProjectView.java:166)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:189)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3540)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3161)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
WARNING : Failed to initialize library handle from liblttvtraceread-2.5.so!

Obviously, the trace import should FAIL if the proper format library is not found, it should report this to the user through a dialog, and the trace should not appear in the project.  The exception should not escape.

Reproducible: Always

Steps to Reproduce:
1. Install just the latest liblttngtrace format (e.g. 2.6).
2. Launch org.eclipse.linuxtools.lttng.ui as an Eclipse application.
3. Create an LTTng project.
4. Import an older-format trace.
Comment 1 Yufen Kuo CLA 2011-08-12 15:31:17 EDT
Created attachment 201426 [details]
patch to display error dialog when native trace library fails to load instead of displaying stack trace in console

This patch needs to be applied after the patches for bug 354541 are applied.
Comment 2 Yufen Kuo CLA 2011-08-12 15:32:22 EDT
Created attachment 201427 [details]
screenshot of the new error dialog
Comment 3 Yufen Kuo CLA 2011-08-12 15:36:14 EDT
Legal Message: I, Yufen Kuo, declare that I developed attached code from scratch, without referencing any 3rd party materials except material licensed under the EPL. {I am authorized by my employer to make this contribution under the EPL.}
Comment 4 Francois Chouinard CLA 2011-08-25 18:47:07 EDT
The patch works very well. Thanks!
Comment 5 Francois Chouinard CLA 2011-08-25 20:12:54 EDT
Created attachment 202192 [details]
Alternative error dialog

I would like to improve the error description a little bit. Anything you would like to see?
Comment 6 Yufen Kuo CLA 2011-08-25 22:36:59 EDT
(In reply to comment #5)
> Created attachment 202192 [details]
> Alternative error dialog
> 
> I would like to improve the error description a little bit. Anything you would
> like to see?

I like the improved one also.
Comment 7 Francois Chouinard CLA 2011-08-26 19:45:18 EDT
Comment on attachment 201426 [details]
patch to display error dialog when native trace library fails to load instead of displaying stack trace in console

Patch committed to stable-0.8 branch (with minor changes)
Comment 8 Francois Chouinard CLA 2011-08-26 19:45:55 EDT
Still need to commit changes on HEAD.
Comment 9 Francois Chouinard CLA 2011-08-28 20:33:16 EDT
Committed on HEAD.
Comment 10 Francois Chouinard CLA 2011-09-28 17:32:05 EDT
Delivered with 0.8.1