Skip to content

SIGSEGV in swt_fixed_resize #697

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

Open
torokati44 opened this issue Jun 9, 2023 · 23 comments · Fixed by #915
Open

SIGSEGV in swt_fixed_resize #697

torokati44 opened this issue Jun 9, 2023 · 23 comments · Fixed by #915

Comments

@torokati44
Copy link

Describe the bug

Segmentation fault.

#0  0x00007ffadd922a22 in _gtk_css_shadows_value_get_extents (border=0x7ffaeedf9940, shadows=0x0)
    at ../../../gtk/gtkcssshadowsvalue.c:327
#1  gtk_css_gadget_allocate (gadget=0x7ffaea33ca70, allocation=0x7ffaeedf9a10, baseline=-1, out_clip=0x7ffaeedf9a20)
    at ../../../gtk/gtkcssgadget.c:792
#2  0x00007ffadda79ee0 in gtk_scrolled_window_size_allocate (widget=0x7ffaea33bb10, allocation=0x7ffaeedf9b00)
    at ../../../gtk/gtkscrolledwindow.c:3420
#3  0x00007ffaddb42830 in gtk_widget_size_allocate_with_baseline
    (widget=0x7ffaea33bb10, allocation=<optimized out>, baseline=<optimized out>) at ../../../gtk/gtkwidget.c:6179
#4  0x00007ffabbe5221d in  ()
    at <redacted>/org.eclipse.osgi/340/0/.cp/libswt-pi3-gtk-4958r2.so
#5  0x00007ffaddb42830 in gtk_widget_size_allocate_with_baseline
    (widget=0x7ffaea33b0f0, allocation=<optimized out>, baseline=<optimized out>) at ../../../gtk/gtkwidget.c:6179
#6  0x00007ffabbe527d2 in swt_fixed_resize ()
    at <redacted>/org.eclipse.osgi/340/0/.cp/libswt-pi3-gtk-4958r2.so
#7  0x00007ffabbe4e76c in Java_org_eclipse_swt_internal_gtk_OS_swt_1fixed_1resize ()
    at <redacted>/org.eclipse.osgi/340/0/.cp/libswt-pi3-gtk-4958r2.so
#8  0x00007ffae220cb48 in  ()
#9  0x00007ffadf207988 in  ()
#10 0x00007ffaed0da576 in type_node_conforms_to_U
    (support_prerequisites=0, support_interfaces=1, iface_node=<optimized out>, node=<optimized out>) at ../../../gobject/gtype.c:3618
#11 g_type_check_instance_is_a (type_instance=type_instance@entry=0x7ffadf1d76f8, iface_type=<optimized out>)
    at ../../../gobject/gtype.c:4154
#12 0x00007ffaddb458aa in gtk_widget_get_parent (widget=0x7ffadf1d76f8) at ../../../gtk/gtkwidget.c:9707
#13 0x0000000000000000 in  ()

To Reproduce

I don't have a minimal reproducer yet sadly.

Expected behavior
No crash.

Screenshots
Not really applicable.

Environment:

  1. Select the platform(s) on which the behavior is seen:
    • All OS
    • Windows
    • Linux
    • macOS
  1. Additional OS info (e.g. OS version, Linux Desktop, etc)

Ubuntu 23.04, GTK 3.24.37

  1. JRE/JDK version

JustJ Adoptium OpenJDK Hotspot JRE 17.0.7, Eclipse 4.27.0

Workaround (or) Additional context

Couldn't find a workaround yet.

@torokati44
Copy link
Author

It appears that setting GTK_THEME=HighContrast in the environment works around this crash. It might be specific to the "Yaru (dark)" theme in Ubuntu.

@SyntevoAlex
Copy link
Member

SyntevoAlex commented Jun 21, 2023

Could you please also attach the generated hs_err_pid*.log file? It's created whenever JRE crashes.

By the way, how did you manage to obtain a GDB stack trace? When I want that, I have to resort to complicated script that ignores JRE internal exceptions but not the "fatal" exceptions

@torokati44
Copy link
Author

torokati44 commented Jun 21, 2023

Tomorrow perhaps.
I added -Xint to the JVM args in eclipse.ini. This disables the JIT compiler (switches to pure interpreter mode), which uses SIGSEGV.

@SyntevoAlex
Copy link
Member

I added -Xint to the JVM args in eclipse.ini. This disables the JIT compiler (switches to pure interpreter mode), which uses SIGSEGV.

Somehow this idea never crossed my mind. Thanks!

@torokati44
Copy link
Author

Here is the stack trace from the hs_err_pid####.log file:

--------------- T H R E A D ---------------
Current thread (0x00007f81ac024ca0):  JavaThread "main" [_thread_in_native, id=50603, stack(0x00007f81b1300000,0x00007f81b1400000)]

Stack: [0x00007f81b1300000,0x00007f81b1400000],  sp=0x00007f81b13f9fb0,  free space=999k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libgtk-3.so.0+0x122a22]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
J 7958  org.eclipse.swt.internal.gtk.OS.swt_fixed_resize(JJII)V (0 bytes) @ 0x00007f81a1fc83ea [0x00007f81a1fc83a0+0x000000000000004a]
J 8269 c1 org.eclipse.swt.widgets.Scrollable.resizeHandle(II)V (78 bytes) @ 0x00007f819ad26f7c [0x00007f819ad26e80+0x00000000000000fc]
J 8283 c1 org.eclipse.swt.widgets.Composite.resizeHandle(II)V (29 bytes) @ 0x00007f819ad26454 [0x00007f819ad263c0+0x0000000000000094]
J 7920 c1 org.eclipse.swt.widgets.Control.setBounds(IIIIZZ)I (841 bytes) @ 0x00007f819ab4ab14 [0x00007f819ab49a60+0x00000000000010b4]
J 7948 c1 org.eclipse.swt.widgets.Composite.setBounds(IIIIZZ)I (113 bytes) @ 0x00007f819abe5cec [0x00007f819abe57a0+0x000000000000054c]
j  org.eclipse.swt.widgets.Table.setBounds(IIIIZZ)I+10
j  org.eclipse.swt.widgets.Control.setSize(II)V+38
j  org.omnetpp.common.largetable.LargeTable.recomputeTableSize()V+50
j  org.omnetpp.common.largetable.LargeTable$12.controlResized(Lorg/eclipse/swt/events/ControlEvent;)V+4
J 10473 c1 org.eclipse.swt.widgets.TypedListener.handleEvent(Lorg/eclipse/swt/widgets/Event;)V (1291 bytes) @ 0x00007f819b6783dc [0x00007f819b6736c0+0x0000000000004d1c]
J 12078 c2 org.eclipse.swt.widgets.EventTable.sendEvent(Lorg/eclipse/swt/widgets/Event;)V (619 bytes) @ 0x00007f81a25bacb0 [0x00007f81a25babe0+0x00000000000000d0]
J 6686 c1 org.eclipse.swt.widgets.Display.sendEvent(Lorg/eclipse/swt/widgets/EventTable;Lorg/eclipse/swt/widgets/Event;)V (34 bytes) @ 0x00007f819b5ab944 [0x00007f819b5ab860+0x00000000000000e4]
J 7561 c1 org.eclipse.swt.widgets.Widget.sendEvent(ILorg/eclipse/swt/widgets/Event;Z)V (88 bytes) @ 0x00007f819acfb09c [0x00007f819acfab40+0x000000000000055c]
J 7598 c1 org.eclipse.swt.widgets.Widget.sendEvent(I)V (8 bytes) @ 0x00007f819b80a844 [0x00007f819b80a740+0x0000000000000104]
j  org.eclipse.swt.widgets.TableColumn.setWidthInPixels(I)V+184
j  org.eclipse.swt.widgets.TableColumn.setWidth(I)V+9
j  org.omnetpp.scave.editors.datatable.DataTable.initColumns()V+11
j  org.omnetpp.scave.editors.datatable.DataTable.<init>(Lorg/eclipse/swt/widgets/Composite;ILorg/omnetpp/scave/editors/datatable/PanelType;)V+110
j  org.omnetpp.scave.editors.datatable.FilteredDataPanel.initialize(Lorg/omnetpp/scave/editors/datatable/PanelType;)V+87
j  org.omnetpp.scave.editors.datatable.FilteredDataPanel.<init>(Lorg/eclipse/swt/widgets/Composite;ILorg/omnetpp/scave/editors/datatable/PanelType;)V+57
j  org.omnetpp.scave.editors.datatable.FilteredDataTabFolder.initialize()V+58
j  org.omnetpp.scave.editors.datatable.FilteredDataTabFolder.<init>(Lorg/eclipse/swt/widgets/Composite;I)V+22
j  org.omnetpp.scave.editors.ui.BrowseDataPage.initialize()V+62
j  org.omnetpp.scave.editors.ui.BrowseDataPage.<init>(Lorg/eclipse/swt/widgets/Composite;Lorg/omnetpp/scave/editors/ScaveEditor;)V+19
j  org.omnetpp.scave.editors.ScaveEditor.createBrowseDataPage()V+10
j  org.omnetpp.scave.editors.ScaveEditor.doCreatePages()V+21
j  org.omnetpp.scave.editors.ScaveEditor.createPages()V+12
j  org.eclipse.ui.part.MultiPageEditorPart.createPartControl(Lorg/eclipse/swt/widgets/Composite;)V+16
j  org.omnetpp.common.ui.MultiPageEditorPartExt.createPartControl(Lorg/eclipse/swt/widgets/Composite;)V+2
j  org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.createPartControl(Lorg/eclipse/ui/IWorkbenchPart;Lorg/eclipse/swt/widgets/Composite;)Z+65
j  org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor.createPartControl(Lorg/eclipse/ui/IWorkbenchPart;Lorg/eclipse/swt/widgets/Composite;)Z+3
j  org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.create()V+145
v  ~StubRoutines::call_stub
J 6454  jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; [email protected] (0 bytes) @ 0x00007f81a1fada37 [0x00007f81a1fad9c0+0x0000000000000077]
J 6453 c1 jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; [email protected] (137 bytes) @ 0x00007f819b2a9404 [0x00007f819b2a8a80+0x0000000000000984]
J 1219 c1 jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; [email protected] (10 bytes) @ 0x00007f819ab4debc [0x00007f819ab4ddc0+0x00000000000000fc]
J 6503 c1 org.eclipse.e4.core.internal.di.MethodRequestor.execute()Ljava/lang/Object; (189 bytes) @ 0x00007f819b53a144 [0x00007f819b5388a0+0x00000000000018a4]
j  org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(Ljava/lang/Class;Ljava/lang/Object;Ljava/lang/Class;Lorg/eclipse/e4/core/di/suppliers/PrimaryObjectSupplier;Lorg/eclipse/e4/core/di/suppliers/PrimaryObjectSupplier;Ljava/util/ArrayList;)V+339
j  org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(Ljava/lang/Class;Ljava/lang/Object;Ljava/lang/Class;Lorg/eclipse/e4/core/di/suppliers/PrimaryObjectSupplier;Lorg/eclipse/e4/core/di/suppliers/PrimaryObjectSupplier;Ljava/util/ArrayList;)V+42
j  org.eclipse.e4.core.internal.di.InjectorImpl.internalInject(Ljava/lang/Object;Lorg/eclipse/e4/core/di/suppliers/PrimaryObjectSupplier;Lorg/eclipse/e4/core/di/suppliers/PrimaryObjectSupplier;)V+174
j  org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(Ljava/lang/Class;Lorg/eclipse/e4/core/di/suppliers/PrimaryObjectSupplier;Lorg/eclipse/e4/core/di/suppliers/PrimaryObjectSupplier;)Ljava/lang/Object;+323
j  org.eclipse.e4.core.internal.di.InjectorImpl.make(Ljava/lang/Class;Lorg/eclipse/e4/core/di/suppliers/PrimaryObjectSupplier;)Ljava/lang/Object;+11
j  org.eclipse.e4.core.contexts.ContextInjectionFactory.make(Ljava/lang/Class;Lorg/eclipse/e4/core/contexts/IEclipseContext;)Ljava/lang/Object;+13
j  org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(Lorg/osgi/framework/Bundle;Lorg/eclipse/e4/core/contexts/IEclipseContext;Lorg/eclipse/e4/core/contexts/IEclipseContext;Lorg/eclipse/emf/common/util/URI;)Ljava/lang/Object;+169
j  org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(Ljava/lang/String;Lorg/eclipse/e4/core/contexts/IEclipseContext;Lorg/eclipse/e4/core/contexts/IEclipseContext;)Ljava/lang/Object;+90
j  org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(Ljava/lang/String;Lorg/eclipse/e4/core/contexts/IEclipseContext;)Ljava/lang/Object;+4
j  org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.createWidget(Lorg/eclipse/e4/ui/model/application/ui/MUIElement;Ljava/lang/Object;)Ljava/lang/Object;+132
j  org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createWidget(Lorg/eclipse/e4/ui/model/application/ui/MUIElement;Ljava/lang/Object;)Ljava/lang/Object;+21
j  org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(Lorg/eclipse/e4/ui/model/application/ui/MUIElement;Ljava/lang/Object;Lorg/eclipse/e4/core/contexts/IEclipseContext;)Ljava/lang/Object;+563
j  org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(Lorg/eclipse/e4/ui/model/application/ui/MUIElement;)Ljava/lang/Object;+168
j  org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$2.run()V+13
J 10640 c2 org.eclipse.core.runtime.SafeRunner.run(Lorg/eclipse/core/runtime/ISafeRunnable;)V (20 bytes) @ 0x00007f81a2434d44 [0x00007f81a2434d20+0x0000000000000024]
j  org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(Lorg/eclipse/e4/ui/model/application/ui/MUIElement;)Ljava/lang/Object;+15
j  org.eclipse.e4.ui.internal.workbench.PartServiceImpl.lambda$0(Lorg/osgi/service/event/Event;)V+183
j  org.eclipse.e4.ui.internal.workbench.PartServiceImpl$$Lambda$378+0x000000010049bc98.handleEvent(Lorg/osgi/service/event/Event;)V+5
J 6612 c1 org.eclipse.e4.ui.services.internal.events.UIEventHandler$$Lambda$320+0x00000001004e6000.run()V (12 bytes) @ 0x00007f819b58070c [0x00007f819b5805c0+0x000000000000014c]
J 6513 c1 org.eclipse.swt.widgets.Synchronizer.syncExec(Ljava/lang/Runnable;)V (311 bytes) @ 0x00007f819b53665c [0x00007f819b535ce0+0x000000000000097c]
J 6514 c1 org.eclipse.ui.internal.UISynchronizer.syncExec(Ljava/lang/Runnable;)V (143 bytes) @ 0x00007f819b53de1c [0x00007f819b53d0a0+0x0000000000000d7c]
J 6512 c1 org.eclipse.swt.widgets.Display.syncExec(Ljava/lang/Runnable;)V (102 bytes) @ 0x00007f819b5345e4 [0x00007f819b534120+0x00000000000004c4]
J 6610 c1 org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(Lorg/osgi/service/event/Event;)V (35 bytes) @ 0x00007f819b5819ec [0x00007f819b581440+0x00000000000005ac]
J 8034 c2 org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(Ljava/lang/Object;Ljava/lang/Object;ILjava/lang/Object;)V (19 bytes) @ 0x00007f81a20a1b68 [0x00007f81a20a1840+0x0000000000000328]
J 4474 c2 org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(Ljava/util/Set;Lorg/eclipse/osgi/framework/eventmgr/EventDispatcher;ILjava/lang/Object;)V (69 bytes) @ 0x00007f81a1dc6660 [0x00007f81a1dc61e0+0x0000000000000480]
J 2791 c1 org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ILjava/lang/Object;)V (81 bytes) @ 0x00007f819af2ddb4 [0x00007f819af2d660+0x0000000000000754]
J 5322 c1 org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(Lorg/osgi/service/event/Event;Z)V (230 bytes) @ 0x00007f819afe192c [0x00007f819afe09c0+0x0000000000000f6c]
J 6798 c1 org.eclipse.equinox.internal.event.EventComponent.sendEvent(Lorg/osgi/service/event/Event;)V (9 bytes) @ 0x00007f819b5fd10c [0x00007f819b5fd040+0x00000000000000cc]
J 6325 c1 org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(Lorg/eclipse/emf/common/notify/Notification;)V (61 bytes) @ 0x00007f819b4f035c [0x00007f819b4ef860+0x0000000000000afc]
J 3778 c1 org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(Lorg/eclipse/emf/common/notify/Notification;)V (44 bytes) @ 0x00007f819b171e64 [0x00007f819b171b60+0x0000000000000304]
j  org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElementGen(Lorg/eclipse/e4/ui/model/application/ui/MUIElement;)V+34
j  org.eclipse.e4.ui.model.application.ui.impl.ElementContainerImpl.setSelectedElement(Lorg/eclipse/e4/ui/model/application/ui/MUIElement;)V+87
j  org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer.lambda$4(Lorg/eclipse/swt/events/SelectionEvent;)V+29
j  org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer$$Lambda$406+0x000000010056a1d0.accept(Ljava/lang/Object;)V+8
j  org.eclipse.swt.events.SelectionListener$1.widgetSelected(Lorg/eclipse/swt/events/SelectionEvent;)V+5
J 10473 c1 org.eclipse.swt.widgets.TypedListener.handleEvent(Lorg/eclipse/swt/widgets/Event;)V (1291 bytes) @ 0x00007f819b677e84 [0x00007f819b6736c0+0x00000000000047c4]
J 10879 c1 org.eclipse.swt.widgets.EventTable.sendEvent(Lorg/eclipse/swt/widgets/Event;)V (619 bytes) @ 0x00007f819aeefd94 [0x00007f819aeef9a0+0x00000000000003f4]
J 6686 c1 org.eclipse.swt.widgets.Display.sendEvent(Lorg/eclipse/swt/widgets/EventTable;Lorg/eclipse/swt/widgets/Event;)V (34 bytes) @ 0x00007f819b5ab944 [0x00007f819b5ab860+0x00000000000000e4]
J 7561 c1 org.eclipse.swt.widgets.Widget.sendEvent(ILorg/eclipse/swt/widgets/Event;Z)V (88 bytes) @ 0x00007f819acfb09c [0x00007f819acfab40+0x000000000000055c]
J 11143 c1 org.eclipse.swt.widgets.Widget.notifyListeners(ILorg/eclipse/swt/widgets/Event;)V (23 bytes) @ 0x00007f819bab58e4 [0x00007f819bab5560+0x0000000000000384]
j  org.eclipse.swt.custom.CTabFolder.setSelection(IZ)V+57
j  org.eclipse.swt.custom.CTabFolder.onMouse(Lorg/eclipse/swt/widgets/Event;)V+561
j  org.eclipse.swt.custom.CTabFolder.lambda$0(Lorg/eclipse/swt/widgets/Event;)V+218
j  org.eclipse.swt.custom.CTabFolder$$Lambda$395+0x000000010056c908.handleEvent(Lorg/eclipse/swt/widgets/Event;)V+5
J 10879 c1 org.eclipse.swt.widgets.EventTable.sendEvent(Lorg/eclipse/swt/widgets/Event;)V (619 bytes) @ 0x00007f819aeefd94 [0x00007f819aeef9a0+0x00000000000003f4]
J 6686 c1 org.eclipse.swt.widgets.Display.sendEvent(Lorg/eclipse/swt/widgets/EventTable;Lorg/eclipse/swt/widgets/Event;)V (34 bytes) @ 0x00007f819b5ab944 [0x00007f819b5ab860+0x00000000000000e4]
J 10520 c1 org.eclipse.swt.widgets.Display.runDeferredEvents()Z (109 bytes) @ 0x00007f819b805114 [0x00007f819b804940+0x00000000000007d4]
J 8752 c1 org.eclipse.swt.widgets.Display.readAndDispatch()Z (88 bytes) @ 0x00007f819b85e74c [0x00007f819b85e2e0+0x000000000000046c]
j  org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run()V+564
j  org.eclipse.core.databinding.observable.Realm.runWithDefault(Lorg/eclipse/core/databinding/observable/Realm;Ljava/lang/Runnable;)V+12
j  org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(Lorg/eclipse/e4/ui/model/application/MApplicationElement;Lorg/eclipse/e4/core/contexts/IEclipseContext;)Ljava/lang/Object;+57
j  org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(Lorg/eclipse/e4/ui/model/application/MApplicationElement;)V+20
j  org.eclipse.ui.internal.Workbench.lambda$3(Lorg/eclipse/swt/widgets/Display;Lorg/eclipse/ui/application/WorkbenchAdvisor;[I)V+393
j  org.eclipse.ui.internal.Workbench$$Lambda$251+0x000000010028f7c8.run()V+12
j  org.eclipse.core.databinding.observable.Realm.runWithDefault(Lorg/eclipse/core/databinding/observable/Realm;Ljava/lang/Runnable;)V+12
j  org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Lorg/eclipse/swt/widgets/Display;Lorg/eclipse/ui/application/WorkbenchAdvisor;)I+16
j  org.eclipse.ui.PlatformUI.createAndRunWorkbench(Lorg/eclipse/swt/widgets/Display;Lorg/eclipse/ui/application/WorkbenchAdvisor;)I+2
j  org.eclipse.ui.internal.ide.application.IDEApplication.start(Lorg/eclipse/equinox/app/IApplicationContext;)Ljava/lang/Object;+113
j  org.eclipse.equinox.internal.app.EclipseAppHandle.run(Ljava/lang/Object;)Ljava/lang/Object;+138
j  org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(Ljava/lang/Object;)Ljava/lang/Object;+85
j  org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(Ljava/lang/Object;)Ljava/lang/Object;+79
j  org.eclipse.core.runtime.adaptor.EclipseStarter.run(Ljava/lang/Object;)Ljava/lang/Object;+99
j  org.eclipse.core.runtime.adaptor.EclipseStarter.run([Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Object;+132
v  ~StubRoutines::call_stub
j  jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+0 [email protected]
j  jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+133 [email protected]
j  jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+6 [email protected]
j  java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+59 [email protected]
j  org.eclipse.equinox.launcher.Main.invokeFramework([Ljava/lang/String;[Ljava/net/URL;)V+201
j  org.eclipse.equinox.launcher.Main.basicRun([Ljava/lang/String;)V+159
j  org.eclipse.equinox.launcher.Main.run([Ljava/lang/String;)I+4
j  org.eclipse.equinox.launcher.Main.main([Ljava/lang/String;)V+10
v  ~StubRoutines::call_stub

siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000000000000000

Let me know if you need any other part of that file.

@SyntevoAlex
Copy link
Member

Thanks for the Java stack.

For some reason, gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BOX_SHADOW) seems to return NULL:

'gtk/gtkcssshadowsvalue.c'
	Line 318
		void
		_gtk_css_shadows_value_get_extents (const GtkCssValue *shadows,
											GtkBorder         *border)
		{
		  guint i;
		  GtkBorder b = { 0 };
		  const GtkCssValue *shadow;
		  gdouble hoffset, voffset, spread, radius, clip_radius;

		  g_return_if_fail (shadows->class == &GTK_CSS_VALUE_SHADOWS);		// <--- Line 327
From GDB stack trace
	(border=0x7ffaeedf9940, shadows=0x0)
'gtk\gtkcssgadget.c'
	Line 792 (in 'gtk_css_gadget_allocate()')
		_gtk_css_shadows_value_get_extents (gtk_css_style_get_value (style, GTK_CSS_PROPERTY_BOX_SHADOW), &shadow);

I have checked crash database for our product (it's based on SWT without Eclipse) and it has exactly zero crash reports like this. So it seems that some special conditions are needed.

I guess that some repro steps would be needed to proceed here.

@torokati44
Copy link
Author

Alright, I wanted to spare you of it, but here is a reproduction procedure:

In a basic, fresh Ubuntu 23.04 installation (in a VM for example):

sudo apt install -y pkg-config make build-essential bison flex python3-pip
python3 -m pip install --break-system-packages numpy scipy pandas matplotlib posix_ipc

tar xzf 230627-3194d1c337-omnetpp-7.0.0pre2-linux-x86_64.tgz 
cd omnetpp-7.0.0pre2/

source setenv
./configure WITH_QTENV=no WITH_OSG=no WITH_OSGEARTH=no WITH_PYTHONSIM=no WITH_BACKTRACE=no
make utils

omnetpp
  • Click "Launch", keeping the default workspace location
  • Close the "Welcome" tab
  • In the dialog that pops up, uncheck "Install INET Framework" but keep "Import OMNeT++ programming examples" checked, click "OK"
  • Close the 3 introductory tabs ("Getting Started", "At a Glance", "OMNeT++ Samples")
  • Open the imported "resultfiles" project
  • Doubleclick the "Fifo.anf" file in it
  • This instantly crashed the JVM for me

@akurtakov
Copy link
Member

These steps are asking too much. It would be best to come up with simpler (ideally a pure Java/SWT snippet with main method) reproducer. Learning a whole new project details to debug an issue is not something that many will spend their time on.

@torokati44
Copy link
Author

These steps are asking too much.

I thought so too, but this is the best I have at the moment...

It would be best to come up with simpler (ideally a pure Java/SWT snippet with main method) reproducer.

Of course, and I was glad that I managed to make one for #678.
I will try to make one for this as well, but it appears to be a lot more difficult.

@torokati44
Copy link
Author

While I don't yet have a minimal reproducer, I got a message just before crashing that may or may not be relevant:
Gtk-CRITICAL **: 12:26:40.957: gtk_css_style_get_value: assertion '(((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) (style); GType __t = ((gtk_css_style_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; }))))' failed

@torokati44
Copy link
Author

torokati44 commented Jul 4, 2023

I have good news, and bad news.

The good news is that I managed to get a reproducer snippet that is completely independent of our product, and is only about 80 lines of code (of which only 20 is really interesting).

CrashyEditor.java
package crashyeditor;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.EditorPart;

public class CrashyEditor extends EditorPart {

    // -------- start debugging stuff --------

    static int callDepth = 0;

    void runWithLogging(String label, Runnable r) {
        System.out.println("  ".repeat(callDepth) + "> " + label + " (" + this + ")");
        callDepth += 1;
        r.run();
        callDepth -= 1;
        System.out.println("  ".repeat(callDepth) + "< " + label + " (" + this + ")");
    }

    // -------- end debugging stuff --------

    @Override
    public void createPartControl(Composite parent) {
        runWithLogging("createPartControl " + parent.getSize() + " " + parent.getLayout(), () -> {
            Composite composite = new Composite(parent, SWT.NONE);

            Table table = new Table(composite, SWT.NONE);
            table.setHeaderVisible(true);

            TableColumn column = new TableColumn(table, SWT.NONE);
            column.addControlListener(ControlListener
                    .controlResizedAdapter((e) -> runWithLogging("column.controlResized " + column.getWidth(), () -> {
                        table.setSize(20, 20);
                        composite.setSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
                    })));

            column.setWidth(10);
        });
    }

    // -------- start filler stuff --------

    @Override
    public void init(IEditorSite site, IEditorInput input) throws PartInitException {
        setSite(site);
        setInput(input);
    }

    @Override
    public void doSave(IProgressMonitor monitor) {
    }

    @Override
    public void doSaveAs() {
    }

    @Override
    public boolean isDirty() {
        return false;
    }

    @Override
    public boolean isSaveAsAllowed() {
        return false;
    }

    @Override
    public void setFocus() {
    }

    // -------- end filler stuff --------
}

The bad news is that this is still an Eclipse plugin, not a standalone SWT application. I tried really hard, but could not get this crash outside of Eclipse yet.

So the new reproduction procedure is:

I know this is still a lot more convoluted than simply running a short Java program, but I am really having a hard time further reducing it.

@torokati44
Copy link
Author

torokati44 commented Jul 5, 2023

Note that I have edited the above comment multiple times with newer and newer (more and more minimal) versions of CrashyEditor.zip.

@SyntevoAlex
Copy link
Member

I will try to have a look at this when I have time. Hopefully, but no promises, next week.

@SyntevoAlex
Copy link
Member

This is how the problem develops, SWT invalidates style at a wrong time:

at org.eclipse.swt.internal.gtk3.GTK3.gtk_style_context_invalidate(Native Method)
at org.eclipse.swt.widgets.Control.setBackgroundGdkRGBA(Control.java:5310)
at org.eclipse.swt.widgets.Control.setBackgroundGdkRGBA(Control.java:5289)
at org.eclipse.swt.widgets.Control._setBackground(Control.java:5252)
at org.eclipse.swt.widgets.Control.setBackground(Control.java:5228)
at org.eclipse.e4.ui.css.swt.helpers.CSSSWTColorHelper.setBackground(CSSSWTColorHelper.java:363)
at org.eclipse.e4.ui.css.swt.properties.css2.CSSPropertyBackgroundSWTHandler.applyCSSPropertyBackgroundColor(CSSPropertyBackgroundSWTHandler.java:79)
at org.eclipse.e4.ui.css.core.dom.properties.css2.AbstractCSSPropertyBackgroundHandler.applyCSSProperty(AbstractCSSPropertyBackgroundHandler.java:43)
at org.eclipse.e4.ui.css.swt.properties.css2.CSSPropertyBackgroundSWTHandler.applyCSSProperty(CSSPropertyBackgroundSWTHandler.java:43)
at org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine.applyCSSProperty(AbstractCSSEngine.java:746)
at org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine.applyStyleDeclaration(AbstractCSSEngine.java:552)
at org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine.applyStyles(AbstractCSSEngine.java:426)
at org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine.applyStyles(AbstractCSSEngine.java:374)
at org.eclipse.e4.ui.css.swt.engine.CSSSWTApplyStylesListener.lambda$0(CSSSWTApplyStylesListener.java:31)
at org.eclipse.e4.ui.css.swt.engine.CSSSWTApplyStylesListener$$Lambda$285/0x00007fffa23c5660.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5855)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5847)
at org.eclipse.swt.widgets.Display.runSkin(Display.java:5146)
at org.eclipse.swt.widgets.Composite.computeSizeInPixels(Composite.java:262)
at org.eclipse.swt.widgets.Control.computeSize(Control.java:838)
at org.eclipse.swt.widgets.Control.computeSize(Control.java:694)
at crashyeditor.CrashyEditor.lambda$2(CrashyEditor.java:42)
at crashyeditor.CrashyEditor$$Lambda$719/0x00007fffa26cca38.run(Unknown Source)
at crashyeditor.CrashyEditor.runWithLogging(CrashyEditor.java:23)
at crashyeditor.CrashyEditor.lambda$1(CrashyEditor.java:40)
at crashyeditor.CrashyEditor$$Lambda$718/0x00007fffa26cc800.accept(Unknown Source)
at org.eclipse.swt.events.ControlListener$2.controlResized(ControlListener.java:83)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:239)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5855)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1529)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1555)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1534)
at org.eclipse.swt.widgets.TableColumn.gtk_size_allocate(TableColumn.java:438)
at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:2518)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:6163)
at org.eclipse.swt.internal.gtk.OS.swt_fixed_resize(Native Method)
at org.eclipse.swt.widgets.Scrollable.resizeHandle(Scrollable.java:554)
at org.eclipse.swt.widgets.Composite.resizeHandle(Composite.java:1600)
at org.eclipse.swt.widgets.Control.setBounds(Control.java:1123)
at org.eclipse.swt.widgets.Composite.setBounds(Composite.java:1658)
at org.eclipse.swt.widgets.Table.setBounds(Table.java:3434)
at org.eclipse.swt.widgets.Control.setSize(Control.java:1477)
at crashyeditor.CrashyEditor.lambda$2(CrashyEditor.java:41)
at crashyeditor.CrashyEditor$$Lambda$719/0x00007fffa26cca38.run(Unknown Source)
at crashyeditor.CrashyEditor.runWithLogging(CrashyEditor.java:23)
at crashyeditor.CrashyEditor.lambda$1(CrashyEditor.java:40)
at crashyeditor.CrashyEditor$$Lambda$718/0x00007fffa26cc800.accept(Unknown Source)
at org.eclipse.swt.events.ControlListener$2.controlResized(ControlListener.java:83)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:239)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5855)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1529)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1555)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1534)
at org.eclipse.swt.widgets.TableColumn.setWidthInPixels(TableColumn.java:825)
at org.eclipse.swt.widgets.TableColumn.setWidth(TableColumn.java:772)
at crashyeditor.CrashyEditor.lambda$0(CrashyEditor.java:45)
at crashyeditor.CrashyEditor$$Lambda$717/0x00007fffa26c54d8.run(Unknown Source)
at crashyeditor.CrashyEditor.runWithLogging(CrashyEditor.java:23)
at crashyeditor.CrashyEditor.createPartControl(CrashyEditor.java:32)

That is, in order to create SWT snippet, display.addListener(SWT.Skin, e -> table.setBackgroundColor(...)) is needed.

However, even armed with this knowledge, I was still not able to make a snippet to reproduce. For some reason, SWT.Skin gets called at slightly wrong time for me.

@torokati44
Copy link
Author

I'm glad you were able to reproduce the crash at least with CrashyEditor.

However, even armed with this knowledge, I was still not able to make a snippet to reproduce.

Do you have any ideas for a simple workaround perhaps?

Can I further assist fixing this in any way?

@SyntevoAlex
Copy link
Member

I plan to spend some more time to investigate. Hopefully this week.

@SyntevoAlex
Copy link
Member

SyntevoAlex commented Aug 23, 2023

Spent some more time on it, still can't reproduce in a snippet.

My snippet does something slightly different compared to Eclipse, and debugging mixed Java/native callstack is hard. But I think I finally found how to walk both stacks in GDB.

Hopefully next time I will finally find how exactly Eclipse is triggering the style to be deallocated.

@SyntevoAlex
Copy link
Member

I reported a GTK bug: https://gitlab.gnome.org/GNOME/gtk/-/issues/6240

@SyntevoAlex
Copy link
Member

Even after making a native snippet that reproduces the problem, I still can't reproduce it in a pure SWT snippet.

The problem is quite elusive and depends on specific Control being contained in specific parent.

GTK bug is triggered when gtk_style_context_invalidate() is called in gtk_size_allocate() callback.

SWT uses gtk_style_context_invalidate() in:

  • Control.setBackground()
  • Control.setForeground()
  • Control.setFont()

SWT uses gtk_size_allocate() callbacks in:

  • ExpandItem
  • ExpandBar
  • Shell
  • TableColumn
  • TreeColumn

In your specific case, the chain is
TableColumn.setWidthInPixels() -> Table.setBounds() -> TableColumn.gtk_size_allocate() -> Control.computeSize() -> Composite.computeSizeInPixels() -> display.runSkin() -> Control.setBackground()

SyntevoAlex added a commit to syntevo/eclipse.platform.swt that referenced this issue Nov 28, 2023
GTK sources say:
  Deprecated: 3.12: Style contexts are invalidated automatically.

https://www.eclipse.org/swt/faq.php#gtkstartup says:
  Eclipse/SWT 4.16.x: GTK+ 3.20.0 and its dependencies
  Eclipse/SWT 4.15.x: GTK+ 3.14.0 and its dependencies

This means that it's been at least 3 years since SWT requires GTK 3.20.
Sounds safe to stop using the deprecated function now.

Hopefully fixes eclipse-platform#697
I couldn't reproduce it in SWT snippet, so I didn't test this with SWT.
But when I tested in native snippet, removing `gtk_style_context_invalidate()`
changed things a bit and crash no longer occurred.

Signed-off-by: Alexandr Miloslavskiy <[email protected]>
SyntevoAlex added a commit to syntevo/eclipse.platform.swt that referenced this issue Nov 28, 2023
GTK sources say:
  Deprecated: 3.12: Style contexts are invalidated automatically.

https://www.eclipse.org/swt/faq.php#gtkstartup says:
  Eclipse/SWT 4.16.x: GTK+ 3.20.0 and its dependencies
  Eclipse/SWT 4.15.x: GTK+ 3.14.0 and its dependencies

This means that it's been at least 3 years since SWT requires GTK 3.20.
Sounds safe to stop using the deprecated function now.

Hopefully fixes eclipse-platform#697
I couldn't reproduce it in SWT snippet, so I didn't test this with SWT.
But when I tested in native snippet, removing `gtk_style_context_invalidate()`
changed things a bit and crash no longer occurred.

Signed-off-by: Alexandr Miloslavskiy <[email protected]>
@SyntevoAlex
Copy link
Member

SyntevoAlex commented Nov 29, 2023

Finally managed to reproduce with SWT snippet

final Display display = new Display();
final Shell shell = new Shell(display);
shell.setLayout (new GridLayout(1, true));

Label hint = new Label(shell, 0);
hint.setText(
	"1. Run on Linux\n" +
	"2. Run with these to make crash easier to see:\n" +
	"   export G_SLICE=always-malloc\n" +
	"   export ALLOC_MMAP_THRESHOLD_=512\n" +
	"3. Click button many times\n" +
	"4. Issue #697: JVM will crash"
);

Button button = new Button(shell, SWT.PUSH);
button.setText("Test");
button.addListener(SWT.Selection, e -> {
	Composite parent = shell;

	Table table = new Table(parent, SWT.NONE);
	table.setHeaderVisible(true);

	TableColumn column = new TableColumn(table, SWT.NONE);
	column.addListener(SWT.Resize, e2 -> {
		table.setSize(20, 20);
		parent.setSize(parent.computeSize(SWT.DEFAULT, SWT.DEFAULT));
	});

	column.setWidth(10);
});

int numColor[] = new int[1];
display.addListener(SWT.Skin, e -> {
	numColor[0]++;

	int color1 = (0x30 + numColor[0]) % 256;
	int color2 = (0xD0 + numColor[0]) % 256;

	Color backColor  = new Color(color1, color1, color1);
	Color foreColor  = new Color(color2, color2, color2);
	shell.setBackground(backColor);
	shell.setForeground(foreColor);
});

shell.setSize(400, 300);
shell.open();

while (!shell.isDisposed()) {
	if (!display.readAndDispatch()) {
		display.sleep();
	}
}

display.dispose();

@SyntevoAlex SyntevoAlex reopened this Nov 29, 2023
@SyntevoAlex
Copy link
Member

GTK replied (interpretation mine) that while it's a bug, they don't find it worthy to fix it and would rather state that we shouldn't restyle or resize anything during TableColumn.gtk_size_allocate() callback.

In SWT terms it means to not resize anything during SWT.Resize for TableColumn. Using Display.asyncExec() should be safe.

@torokati44
Copy link
Author

Thank you for getting to the bottom of this!

@SyntevoAlex
Copy link
Member

Thank you too for your effort to provide a small reproducing example!
Without it, it would be a lot harder.

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 a pull request may close this issue.

3 participants