You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@hop.apache.org by "haoruiqian (via GitHub)" <gi...@apache.org> on 2025/05/15 05:33:52 UTC

[D] "Invalid thread access" exception in a previously opened Hop web page after opening the same Hop web page in another tab (hop)

GitHub user haoruiqian created a discussion: "Invalid thread access" exception in a previously opened Hop web page after opening the same Hop web page in another tab

I open the Hop web page in two browser tabs, and when I double-click the Relational Database Connection to create a new metadata in the previously opened tab, it throws an exception about the "Invalid thread access" error. No exception when doing the same operation on the newly opened tab.
<img width="1501" alt="Screenshot 2025-05-15 at 13 24 40" src="https://github.com/user-attachments/assets/3ad4fd21-a3d8-4f86-ab46-fff1380ce883" />


The error details message is
```
org.eclipse.swt.SWTException: Invalid thread access
	at org.eclipse.swt.SWT.error(SWT.java:3753)
	at org.eclipse.swt.SWT.error(SWT.java:3676)
	at org.eclipse.swt.SWT.error(SWT.java:3647)
	at org.eclipse.swt.widgets.Widget.error(Widget.java:1018)
	at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:956)
	at org.eclipse.swt.custom.CTabFolder.getItemCount(CTabFolder.java:304)
	at org.eclipse.swt.custom.CTabItem.<init>(CTabItem.java:99)
	at org.apache.hop.ui.hopgui.perspective.metadata.MetadataPerspective.addEditor(MetadataPerspective.java:379)
	at org.apache.hop.ui.core.metadata.MetadataManager.newMetadataWithEditor(MetadataManager.java:473)
	at org.apache.hop.ui.hopgui.perspective.metadata.MetadataPerspective.onNewMetadata(MetadataPerspective.java:542)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at org.apache.hop.ui.core.gui.BaseGuiWidgets.lambda$getListener$1(BaseGuiWidgets.java:213)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:109)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:687)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:594)
	at org.eclipse.swt.widgets.Display.executeNextEvent(Display.java:1216)
	at org.eclipse.swt.widgets.Display.runPendingMessages(Display.java:1197)
	at org.eclipse.swt.widgets.Display.safeReadAndDispatch(Display.java:1180)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1172)
	at org.eclipse.rap.rwt.application.AbstractEntryPoint.createUI(AbstractEntryPoint.java:69)
	at org.eclipse.rap.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:177)
	at org.eclipse.rap.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:290)
	at java.base/java.lang.Thread.run(Thread.java:840)
	at org.eclipse.rap.rwt.internal.lifecycle.UIThread.run(UIThread.java:107)

```

Any idea about why it happened? I also tried with two different browsers and can reproduce it too.

GitHub link: https://github.com/apache/hop/discussions/5317

----
This is an automatically sent email for users@hop.apache.org.
To unsubscribe, please send an email to: users-unsubscribe@hop.apache.org


Re: [D] "Invalid thread access" exception in a previously opened Hop web page after opening the same Hop web page in another tab (hop)

Posted by "hansva (via GitHub)" <gi...@apache.org>.
GitHub user hansva added a comment to the discussion: "Invalid thread access" exception in a previously opened Hop web page after opening the same Hop web page in another tab

The issue is the same for all our perspectives, The application was never written as a multi-session application; it is a single-user desktop application. It could be a considerable amount of work to get this done. I am not against it so feel free to do a proposal or create pull requests.

GitHub link: https://github.com/apache/hop/discussions/5317#discussioncomment-13167176

----
This is an automatically sent email for users@hop.apache.org.
To unsubscribe, please send an email to: users-unsubscribe@hop.apache.org


Re: [D] "Invalid thread access" exception in a previously opened Hop web page after opening the same Hop web page in another tab (hop)

Posted by "haoruiqian (via GitHub)" <gi...@apache.org>.
GitHub user haoruiqian added a comment to the discussion: "Invalid thread access" exception in a previously opened Hop web page after opening the same Hop web page in another tab

Update:
I've found the root cause. `MetadataPerspective` instance is static and shared with all the UI sessions. Each time a new UI session is initiated, a new MetadataPerspective is constructed and set to the static `instance` variable, see https://github.com/apache/hop/blob/release/2.13.0/ui/src/main/java/org/apache/hop/ui/hopgui/perspective/metadata/MetadataPerspective.java#L138. Then, all other UI sessions will use this new MetadataPerspective instance and will cause the issue.

I can store the MetadataPerspective instance in a ThreadLocal variable so each UI session thread will have its own instance. Does anyone see any potential issues with this solution?

GitHub link: https://github.com/apache/hop/discussions/5317#discussioncomment-13164926

----
This is an automatically sent email for users@hop.apache.org.
To unsubscribe, please send an email to: users-unsubscribe@hop.apache.org