help understanding complicated client logs

636 views
Skip to first unread message

rjcarr

unread,
Jan 17, 2015, 2:43:22 AM1/17/15
to google-we...@googlegroups.com
I have a fairly large GWT application that works fine until it is behind SSL.  When that happens whenever the page is reloaded on about the 5th try (but it doesn't seem to have a pattern) I'll get an error that is something like:

    __gwt$exception: <skipped>: Cannot read property 'Z' of null

Since it is intermittent it is likely reloaded to the load order of resources.  My guess is SSL slows things down enough that in some cases something breaks.  But what?  So I made a detailed build to see if I could get more information.  What is produced doesn't make sense to me but hoping to someone it does.

I tried putting SSL on my workstation but I couldn't reproduce the problem.  My guess is things are too fast.  So, the only way I can reproduce is by contacting a remote server, where I don't have a development environment to debug.

Anything look interesting?  Any guidance is appreciated!

com.google.gwt.logging.client.LogConfiguration
SEVERE: (TypeError) 
 __gwt$exception: <skipped>: Cannot read property 'com_google_gwt_user_client_ui_UIObject_element' of nullcom.google.gwt.core.client.JavaScriptException: (TypeError) 
 __gwt$exception: <skipped>: Cannot read property 'com_google_gwt_user_client_ui_UIObject_element' of null
at Unknown.com_google_gwt_user_client_ui_AbsolutePanel_$add__Lcom_google_gwt_user_client_ui_AbsolutePanel_2Lcom_google_gwt_user_client_ui_Widget_2V
at Unknown.com_google_gwt_core_client_impl_SchedulerImpl_runScheduledTasks__Lcom_google_gwt_core_client_JsArray_2Lcom_google_gwt_core_client_JsArray_2Lcom_google_gwt_core_client_JsArray_2
at Unknown.com_google_gwt_core_client_impl_SchedulerImpl_$flushPostEventPumpCommands__Lcom_google_gwt_core_client_impl_SchedulerImpl_2V
at Unknown.com_google_gwt_core_client_impl_SchedulerImpl$Flusher_execute__Z
at Unknown.com_google_gwt_core_client_impl_SchedulerImpl_execute__Lcom_google_gwt_core_client_Scheduler$RepeatingCommand_2Z
at Unknown.com_google_gwt_core_client_impl_Impl_apply__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2
at Unknown.com_google_gwt_core_client_impl_Impl_entry0__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2
at Unknown.anonymous
 com_google_gwt_logging_client_ConsoleLogHandler_publish__Ljava_util_logging_LogRecord_2V com_google_gwt_logging_impl_LoggerImplRegular_$log__Lcom_google_gwt_logging_impl_LoggerImplRegular_2Ljava_util_logging_LogRecord_2V com_google_gwt_logging_impl_LoggerImplRegular_$log__Lcom_google_gwt_logging_impl_LoggerImplRegular_2Ljava_util_logging_Level_2Ljava_lang_String_2Ljava_lang_Throwable_2V java_util_logging_Logger_$log__Ljava_util_logging_Logger_2Ljava_util_logging_Level_2Ljava_lang_String_2Ljava_lang_Throwable_2V4 com_google_gwt_core_client_impl_Impl_reportUncaughtException__Ljava_lang_Throwable_2V com_google_gwt_core_client_impl_SchedulerImpl_runScheduledTasks__Lcom_google_gwt_core_client_JsArray_2Lcom_google_gwt_core_client_JsArray_2Lcom_google_gwt_core_client_JsArray_248 com_google_gwt_core_client_impl_SchedulerImpl_$flushPostEventPumpCommands__Lcom_google_gwt_core_client_impl_SchedulerImpl_2V com_google_gwt_core_client_impl_SchedulerImpl$Flusher_execute__Z4 com_google_gwt_core_client_impl_SchedulerImpl_execute__Lcom_google_gwt_core_client_Scheduler$RepeatingCommand_2Z2 com_google_gwt_core_client_impl_Impl_apply__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_24 com_google_gwt_core_client_impl_Impl_entry0__Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_2Ljava_lang_Object_24 (anonymous function)

Jens

unread,
Jan 17, 2015, 7:46:24 AM1/17/15
to google-we...@googlegroups.com
You can test it locally if you use Chrome DevTools. When you open DevTools you can click on the small mobile device icon on the left side right next to the search icon. Once you have done that you should see a new dark toolbar at the top of your page which has a Network drop down which allows you to emulate slower network conditions in Chrome.

Given your stack trace it seems like you called AbsolutePanel.add(childWidget) somewhere but your instance of AbsolutePanel was null.

For your understanding how to read these stack frames:

__gwt$exception: <skipped>: Cannot read property 'com_google_gwt_user_client_ui_UIObject_element' of null
   at Unknown.com_google_gwt_user_client_ui_AbsolutePanel_$add__Lcom_google_gwt_user_client_ui_AbsolutePanel_2Lcom_google_gwt_user_client_ui_Widget_2V

First line is the JavaScript exception message which says you have tried to access UIObject.element but UIObject was null. Since UIObject has a getElement() method that means your java code did call "null.getElement()". At the next line you see that this happened in AbsolutePanel.$add(AbsolutePanel, Widget). This method has been generated by the GWT compiler and is a static version of AbsolutePanel.add(Widget). These generated static methods are marked with "$" by GWT. Given the implementation of AbsolutePanel.add(Widget) it seems like your instance of AbsolutePanel was null.

Your code did something like:

AbsolutePanel myPanel = null; // somehow the variable was null
myPanel.add(child);

with AbsolutePanel.add() being implemented as:

public void add(Widget w) {
   super.add(w, getElement());
}

GWT compiler changed your method call to a static method call

AbsolutePanel.$add(myPanel, w);

And the implementation of $add is probably similar to

public static void $add(AbsolutePanel instance, Widget w) {
  ComplexPanel.$add(w, instance.getElement());
}

The bold code causes the exception. Since getElement() and the element field are defined on UiObject the exception message says you have tried to access UiObject.element with UiObject being null.

-- J.

Robert J. Carr

unread,
Jan 17, 2015, 3:28:10 PM1/17/15
to google-we...@googlegroups.com
Thanks so much for the detailed response.  And I'll give those dev tool suggestions a try.

And what you say makes sense about dereferencing a null, but it doesn't explain how it would work most of the time, but sometimes it doesn't.  If the code is dereferencing null it should always be an error, right?

Anyway, thanks again, you've given me some things to try.


--
You received this message because you are subscribed to a topic in the Google Groups "Google Web Toolkit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/PFyayaTVYbA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-web-tool...@googlegroups.com.
To post to this group, send email to google-we...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Jens

unread,
Jan 17, 2015, 5:03:01 PM1/17/15
to google-we...@googlegroups.com
 If the code is dereferencing null it should always be an error, right?

Not really. Maybe a field becomes null while a server request is in progress and when the request finishes the onSuccess callback tries to use that field without any checks.

-- J.

Robert J. Carr

unread,
Jan 17, 2015, 8:55:12 PM1/17/15
to google-we...@googlegroups.com
Thanks, true I guess, I'll try to sort it out. I was able to use the throttling to reproduce the problem as you suggested so thanks! Unfortunately dev mode isn't working for me so now I have to go figure out super dev mode I guess. 

Thanks again for the help. You certainly gave me a start!
--

Robert J. Carr

unread,
Jan 20, 2015, 5:46:01 PM1/20/15
to google-we...@googlegroups.com
Just following up on this.  It turns out the problem was that I have some native javascript that builds some elements after the page loads and these elements are referenced in the gwt (that's where the null panel was showing up).  Even though this panel is referenced in a deferred block the page may still take longer to load than that and the elements aren't yet created.

I tried fixing this by dynamically loading the gwt nocache file in my native javascript with something like this:

var gwt = document.createElement("script");
gwt.setAttribute("type", "text/javascript");
gwt.setAttribute("src", "gwt/gwt.nocache.js");
document.body.appendChild(gwt);

But either the browser or gwt didn't like it (I got various errors that I couldn't figure out).

So, I ended up creating a timer that keeps checking the availability of that panel and only proceeds after it's been created.  Seems strange I can't control when the GWT files get loaded, but this will work as a backup.

Thanks again for the help!

Reply all
Reply to author
Forward
0 new messages