[GWT 2.8 SHNAPSHOT] missing stack trace for 'Should only call onDetach when the widget is attached to the browser's document'

205 views
Skip to first unread message

Hristo Stoyanov

unread,
Sep 26, 2016, 5:24:25 PM9/26/16
to GWT Users
Hi all,
I wonder if anyone can help me figure out what is causing this - I am getting java.lang.IllegalStateException: Should only call onDetach when the widget is attached to the browser's document . See below. I suspect this is a GWT exception of some kind, but the stack trace is obfuscated and I can not figure out where the problem is. I tried installing my exception handler with no success - the stack trace is still useless:

 Console.log("Exception logger INSTALLED!!!");
        GWT.setUncaughtExceptionHandler(e -> {
            GWT.log("Unhandled exception", e);
 });

This is happening with Errai 4 SNAPSHOT randomly, but if I figure out the stack trace I can get better understanding of what is going on. How do I get the stack trace ? How do I verify that the gwt Code server has all source maps it needs???

Thanks

================================================================================================================================

Current content widget vanished or changed. Not delivering pageHiding event to HomePage.
ErraiConsoleLogHandler.java:87 14:11:26 WARNING [DefaultNavigatingContainer] Got invalid page name "AboutPage". Redirecting to default page.
ErraiConsoleLogHandler.java:87 java.lang.IllegalStateException: Should only call onDetach when the widget is attached to the browser's document
at Unknown.nC_g$(myApp-0.js@8:16163)
at Unknown.TC_g$(myApp-0.js@9:16405)
at Unknown._C_g$(myApp-0.js@9:16452)
at Unknown.kLf_g$(myApp-0.js@9:47908)
at Unknown.WBe_g$(myApp-0.js@18:37314)
at Unknown.aCe_g$(myApp-0.js@14:37371)
at Unknown.nCe_g$(myApp-0.js@14:37481)
at Unknown.ZPj_g$(myApp-0.js@8:114529)
at Unknown.ZBe_g$(myApp-0.js@36:37344)
at Unknown.WPj_g$(myApp-0.js@16:114507)
at Unknown.aOj_g$(myApp-0.js@17:113981)
at Unknown.iAi_g$(myApp-0.js@3:88783)
at Unknown.jAi_g$(myApp-0.js@15:88755)
at Unknown.y2i_g$(myApp-0.js@32:98783)
at Unknown.A2i_g$(myApp-0.js@17:98822)
at Unknown.c6i_g$(myApp-0.js@45:99823)
at Unknown._5i_g$(myApp-0.js@10:99802)
at Unknown.KAi_g$(myApp-0.js@32:88955)
at Unknown.L6i_g$(myApp-0.js@16:100106)
at Unknown.B7i_g$(myApp-0.js@54:100343)
at Unknown.AJj_g$(myApp-0.js@225:112594)
at Unknown.PDj_g$(myApp-0.js@30:110774)
at Unknown.QDj_g$(myApp-0.js@8:110787)
at Unknown.SDj_g$(myApp-0.js@8:110800)
at Unknown.FDj_g$(myApp-0.js@10:110638)
at Unknown.Sii_g$(myApp-0.js@261:83179)
at Unknown.lambda_0_g$(myApp-0.js@27:96)

Paul Stockley

unread,
Sep 27, 2016, 9:05:37 AM9/27/16
to GWT Users
Is this in a production build or SDM? In SDM you can pass the flag -XmethodNameDisplayMode ABBREVIATED. Then in chrome you will see class/method names in the call stack

Paul Stockley

unread,
Sep 27, 2016, 9:12:44 AM9/27/16
to GWT Users
Sorry, I should also add if this is production, you can generate a symbol map file. Usually on my builds it is located under web-inf/deploy/<entry point>/<some hash>.symbolMap. You can search for the obfuscated function names e.g. nC_g$  You can also do this lookup at run-time. I would have to dig up the code because I can't remember the GWT class you use.

Hristo Stoyanov

unread,
Sep 27, 2016, 1:35:06 PM9/27/16
to GWT Users
Paul,
Thanks for reaching out. I only need the stack trace in SDM for now, and I am using the latest GWT 2.8-SNAPSHOT. 
I know about the -XmethodNameDisplayMode flag and tried all its options to no avail, which makes me think that the issue is somewhere else ...

I googled the exception root, and it seems to come from:

java.lang.IllegalStateException: Should only call onDetach when the widget is attached to the browser's document
at com.google.gwt.user.client.ui.Widget.onDetach

When you look at c.g.g.user.client.ui.Widget.onDetach(), one could question if it is really all that necessary to throw exception when the widget is not attached (instead of just do nothing), but that is beyond the point.

The real issue is that SDM (or Chrome Version 53.0.2785.116 m) fails to map the stack trace back to Java sources, making it impossible to trace issues like that. The obfuscated stack trace is not even clickable and i do not understand how it maps back to Java to do this manually . I can see all of my, generated and GWT source codes in the Chrome/Sources tab,  which makes me believe that all source maps are available to the SDM server.

Thanks!

Jens

unread,
Sep 27, 2016, 2:19:13 PM9/27/16
to GWT Users
Have you accidentally disabled source map support in Chrome Dev Tools settings? 

If nothing helps and to get your issue solved you can use -style PRETTY as SDM parameter. As far as I know  -XmethodNameDisplayMode ABBREVIATED is only used when setting a break point and looking at the call stack but not when printing stack traces to console.

-- J.

Hristo Stoyanov

unread,
Sep 27, 2016, 2:40:27 PM9/27/16
to GWT Users
Thanks Jens,
I have my  -style set to DETAILED for the SDM/Compiler, which should be more than enough.  When I do F1 in Chrome Dev Tools, I see these options checked:

Enable JavaScript source maps
Enable CSS source maps

Thomas Broyer

unread,
Sep 28, 2016, 2:15:29 AM9/28/16
to GWT Users
How about setting a breakpoint at the throw line in Widget onDetach then?

Hristo Stoyanov

unread,
Sep 28, 2016, 3:26:16 AM9/28/16
to GWT Users
Thomas,
Yes, that is what I ended up doing at the end ....
After some more digging though, I realised there maybe a reason why the stack trace comes like that:

https://github.com/Putnami/putnami-gradle-plugin/issues/49

Reply all
Reply to author
Forward
0 new messages