[jbosstools-issues] [JBoss JIRA] Issue Comment Edited: (JBIDE-9339) VPE has very-very bad exceptions catch/handle logic

Denis Golovin (JIRA) jira-events at lists.jboss.org
Fri Jul 15 18:50:24 EDT 2011


    [ https://issues.jboss.org/browse/JBIDE-9339?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12614591#comment-12614591 ] 

Denis Golovin edited comment on JBIDE-9339 at 7/15/11 6:49 PM:
---------------------------------------------------------------

It looks like exceptions get lost when they thrown in thread called from swt callback. As a solution all such entries should call code inside Safe runner and report exception to eclipse log in exceptionHandler method.

As example here is a patch that would get exception reported in error log:

{noformat}Index: src/org/jboss/tools/vpe/editor/VpeEditorPart.java
===================================================================
--- src/org/jboss/tools/vpe/editor/VpeEditorPart.java	(revision 32928)
+++ src/org/jboss/tools/vpe/editor/VpeEditorPart.java	(working copy)
@@ -17,6 +17,8 @@
 import org.eclipse.core.commands.IHandler;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.SafeRunner;
 import org.eclipse.jface.action.IMenuListener;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.StyledText;
@@ -796,9 +798,20 @@
 		visualEditor.setEditorLoadWindowListener(new EditorLoadWindowListener() {
 			public void load() {
 				visualEditor.setEditorLoadWindowListener(null);
-				VpeController vpeController = new VpeController(
+				final VpeController vpeController = new VpeController(
 						VpeEditorPart.this);
-				vpeController.init(sourceEditor, visualEditor, bundleMap);
+				SafeRunner.run(
+						new ISafeRunnable() {
+							@Override
+							public void run() throws Exception {
+								vpeController.init(sourceEditor, visualEditor, bundleMap);							}
+							
+							@Override
+							public void handleException(Throwable exception) {
+								VpePlugin.reportProblem(exception);
+							}
+					}
+				);
 			}
 		}); 		
{noformat}

Not sure if it would fix JVM error mentioned above.

      was (Author: dgolovin):
    It looks like exceptions get lost when they thrown in thread called from swt callback. As a solution all such entries should call code inside Safe runner and report exception to eclipse log in exceptionHandler method.

As example here is a patch that would get exception reported in error log:

{noformat}Index: src/org/jboss/tools/vpe/editor/VpeEditorPart.java
===================================================================
--- src/org/jboss/tools/vpe/editor/VpeEditorPart.java	(revision 32928)
+++ src/org/jboss/tools/vpe/editor/VpeEditorPart.java	(working copy)
@@ -17,6 +17,8 @@
 import org.eclipse.core.commands.IHandler;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.ISafeRunnable;
+import org.eclipse.core.runtime.SafeRunner;
 import org.eclipse.jface.action.IMenuListener;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.StyledText;
@@ -796,9 +798,20 @@
 		visualEditor.setEditorLoadWindowListener(new EditorLoadWindowListener() {
 			public void load() {
 				visualEditor.setEditorLoadWindowListener(null);
-				VpeController vpeController = new VpeController(
+				final VpeController vpeController = new VpeController(
 						VpeEditorPart.this);
-				vpeController.init(sourceEditor, visualEditor, bundleMap);
+				SafeRunner.run(
+						new ISafeRunnable() {
+							@Override
+							public void run() throws Exception {
+								vpeController.init(sourceEditor, visualEditor, bundleMap);							}
+							
+							@Override
+							public void handleException(Throwable exception) {
+								VpePlugin.reportProblem(exception);
+							}
+					}
+				);
 			}
 		}); 		
{noformat}
  
> VPE has very-very bad exceptions catch/handle logic
> ---------------------------------------------------
>
>                 Key: JBIDE-9339
>                 URL: https://issues.jboss.org/browse/JBIDE-9339
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: Visual Page Editor core, Visual Page Editor Templates
>    Affects Versions: 3.3.0.M3
>            Reporter: Vitali Yemialyanchyk
>            Assignee: Denis Golovin
>            Priority: Trivial
>             Fix For: 3.3.0.M3
>
>         Attachments: hs_err_pid9748.log, JBIDE-9339_20110713.patch, screenshot-1.jpg
>
>
> Guys I can not imagine how you handle/find such real life issues in VPE like I get last time. Now I know this is my issue in my plugable VPE template (it was NPE exception) - but how I find this?! This is a really epic story. No exceptions in Error Log - just Eclipse "graceful" crash with this log in console:
> >>>
> Configuration location:
>     file:/C:/_ws/xx_vpe/.metadata/.plugins/org.eclipse.pde.core/New_configuration/
> Configuration file:
>     file:/C:/_ws/xx_vpe/.metadata/.plugins/org.eclipse.pde.core/New_configuration/config.ini loaded
> Install location:
>     file:/C:/Bin/eclipse_3.7/
> Framework located:
>     file:/C:/Bin/eclipse_3.7/plugins/org.eclipse.osgi_3.7.0.v20110613.jar
> Loading extension: reference:file:javax.transaction_1.1.1.v201105210645.jar
> 	eclipse.properties not found
> Framework classpath:
>     file:/C:/Bin/eclipse_3.7/plugins/org.eclipse.osgi_3.7.0.v20110613.jar
>     file:/C:/Bin/eclipse_3.7/plugins/
>     file:/C:/Bin/eclipse_3.7/plugins/javax.transaction_1.1.1.v201105210645.jar
> Splash location:
>     C:\Bin\eclipse_3.7\plugins\org.eclipse.platform_3.7.0.v201106131736\splash.bmp
> Debug options:
>     file:/C:/_ws/xx_vpe/.metadata/.plugins/org.eclipse.pde.core/New_configuration/.options loaded
> Time to load bundles: 94
> Starting application: 6839
> !SESSION 2011-07-13 19:56:53.561 -----------------------------------------------
> eclipse.buildId=I20110613-1736
> java.version=1.6.0_24
> java.vendor=Sun Microsystems Inc.
> BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
> Framework arguments:  -product org.eclipse.sdk.ide
> Command-line arguments:  -product org.eclipse.sdk.ide -data C:\_ws\xx_vpe/../runtime-New_configuration -dev file:C:/_ws/xx_vpe/.metadata/.plugins/org.eclipse.pde.core/New_configuration/dev.properties -debug C:\_ws\xx_vpe\.metadata\.plugins\org.eclipse.pde.core\New_configuration/.options -os win32 -ws win32 -arch x86 -consoleLog
> !ENTRY org.eclipse.mylyn.tasks.ui 2 0 2011-07-13 19:57:06.090
> !MESSAGE No search provider was registed. Tasks search is not available.
> Application Started: 29190
> #
> # A fatal error has been detected by the Java Runtime Environment:
> #
> #  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x642c902e, pid=9748, tid=9460
> #
> # JRE version: 6.0_24-b07
> # Java VM: Java HotSpot(TM) Client VM (19.1-b02 mixed mode, sharing windows-x86 )
> # Problematic frame:
> # C  [js3250.dll+0x4902e]
> #
> # An error report file with more information is saved as:
> # C:\Bin\eclipse_3.7\hs_err_pid9748.log
> #
> # If you would like to submit a bug report, please visit:
> #   http://java.sun.com/webapps/bugreport/crash.jsp
> # The crash happened outside the Java Virtual Machine in native code.
> # See problematic frame for where to report the bug.
> #
> >>>

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jbosstools-issues mailing list