Random "elem is null" errors on Firefox 3

239 views
Skip to first unread message

dunha...@gmail.com

unread,
Aug 4, 2008, 5:20:29 PM8/4/08
to Google Web Toolkit
We've got a large, complex application running on GWT 1.4.62 and,
since the release of Firefox 3, have been getting sporadic errors
related to the "element" field of UIObject suddenly becoming null.

I've spent quite a bit of time trying to figure this one out. It looks
like it might be a memory management bug in Firefox. This occurs both
on OSX and Windows platforms, but only on Firefox 3 and not
predictably.

The issue usually appears as a "elem is null" error or a message about
"initWidget()" not being called. The client-side stack traces vary,
but the issue always seems to occur within a constructor. I'm see this
most frequently in "Image", but that is probably because we construct
those often.

The most telling stack trace occurs in the constructor of Label(). On
a couple of occasions I've gotten the "elem is null" exception within
the call to "setStyleName()" in the empty constructor for "Label" -
immediately following a successful call to "sinkEvents()", which also
uses the "element" field.

So far, I haven't managed to build a standalone test case in
javascript which reproduces this problem, and I can't find anything
similar in GWT or Firefox's bug tracking system.

Has anyone else seen this issue?

A sample stack trace follows:

Unexpected Exception:
com.google.gwt.core.client.JavaScriptException: JavaScript TypeError
exception: elem is null
Client: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:
1.9.0.1) Gecko/2008070206 Firefox/3.0.1
com_google_gwt_user_client_impl_DOMImpl_
$setElementProperty__Lcom_google_gwt_user_client_impl_DOMImpl_2Lcom_google_gwt_user_client_Element_2Ljava_lang_String_2Ljava_lang_String_2([object
Object],null,"className","gwt-
Label")@06CC8328D418285354A99083BE5A99B0.cache.html:11293

com_google_gwt_user_client_DOM_setElementProperty__Lcom_google_gwt_user_client_Element_2Ljava_lang_String_2Ljava_lang_String_2(null,"className","gwt-
Label")@06CC8328D418285354A99083BE5A99B0.cache.html:10698

com_google_gwt_user_client_ui_UIObject_setStyleName__Lcom_google_gwt_user_client_Element_2Ljava_lang_String_2(null,"gwt-
Label")@06CC8328D418285354A99083BE5A99B0.cache.html:1823
com_google_gwt_user_client_ui_UIObject_
$setStyleName__Lcom_google_gwt_user_client_ui_UIObject_2Ljava_lang_String_2([object
Object],"gwt-Label")@06CC8328D418285354A99083BE5A99B0.cache.html:1769

com_google_gwt_user_client_ui_UIObject_setStyleName__Ljava_lang_String_2("gwt-
Label")@06CC8328D418285354A99083BE5A99B0.cache.html:1874
com_google_gwt_user_client_ui_Label_
$Label__Lcom_google_gwt_user_client_ui_Label_2([object
Object])@06CC8328D418285354A99083BE5A99B0.cache.html:9481
com_google_gwt_user_client_ui_Label_
$Label__Lcom_google_gwt_user_client_ui_Label_2Ljava_lang_String_2([object
Object],"All Breakdown
Pages")@06CC8328D418285354A99083BE5A99B0.cache.html:9486

George Georgovassilis

unread,
Aug 5, 2008, 3:27:10 AM8/5/08
to Google Web Toolkit
A frequent cause is caching: for instance, if you assign a URL to an
Image and the content of the URL is in the cache already, the browser
may fire the onLoad event immediately...

On Aug 4, 11:20 pm, "dunhamst...@gmail.com" <dunhamst...@gmail.com>
wrote:

dunha...@gmail.com

unread,
Aug 5, 2008, 6:00:37 PM8/5/08
to Google Web Toolkit


On Aug 5, 12:27 am, George Georgovassilis <g.georgovassi...@gmail.com>
wrote:
> A frequent cause is caching: for instance, if you assign a URL to an
> Image and the content of the URL is in the cache already, the browser
> may fire the onLoad event immediately...

Unfortunately, this issue occurs in the constructor of Label(), and
various other places in addition to the constructor for Image.


And now we just got a mysterious exception in
ClickListener.addClickListener(). This one looks particularly
ominous.

The exception I got was: "JavaScript TypeError exception:
this.clickListeners_0 is null" at line 10004.

GWT's Java code reads:

public void addClickListener(ClickListener listener) {
if (clickListeners == null) {
clickListeners = new ClickListenerCollection();
}
clickListeners.add(listener);
}

The generated javascript is:

function addClickListener_7(listener){
if (this.clickListeners_0 === null) {
this.clickListeners_0 = $ClickListenerCollection(new
ClickListenerCollection());
}
this.clickListeners_0.add_3(listener);
<--- Line 10004
}
...
function $ClickListenerCollection(this$static){
$ArrayList(this$static);
return this$static;
}


It looks like firefox is loosing the value during the "return" from
the constructor, or it is just dropping out of the hash table of
"this".

spoonrkaer

unread,
Aug 6, 2008, 5:08:55 PM8/6/08
to Google Web Toolkit
I've spent a great deal of time developing a java web application that
I just launched. On FF3 I get random null errors. They seem to pop up
randomly every 5 or 6 page loads, no matter which page I'm on, and
there is never any meaningful error message, although the null
exception is actually being logged in the catalina.out on the server,
which is just strange. I can usually just refresh the page and it
won't appear, sometimes it will appear on the same page just in a
different spot. It really makes no sense. Safari loads much faster and
doesn't have the same errors appearing, and neither did older versions
of FF.

dunha...@gmail.com

unread,
Aug 7, 2008, 8:13:20 PM8/7/08
to Google Web Toolkit
ok, one more datapoint.

While trying to debug and work around this issue, I ended up with the
following (generated) JS code:

function $missingElement(this$static){
var el, msg;
el = createDiv();
this$static.element = el;
msg = 'FF3: Created missing element ' + el + ' ' + this
$static.element;
log_0(msg, $Error(new Error_0(), msg));
return this$static.element;
}

And eventually I got this exception: "FF3: Created missing element
[object HTMLDivElement] null"

So something is definitely wrong with Firefox 3. I'll file a bug
report with them tomorrow.

Alan_C

unread,
Sep 27, 2008, 4:12:28 PM9/27/08
to Google Web Toolkit
I'm seeing a very similar problem running Firefox 3.0.2.

Here's the JS snippet that is dying (line 28630):

function $Image_1(this$static, url, left, top, width, height){
28628 $clinit_505();
28629 this$static.state = $Image$ClippedState(new Image
$ClippedState(), this$static, url, left, top, width, height);
28630 this$static.element['className'] = 'gwt-Image';
28631 return this$static;
28632}

In Firebug, inspecting this$static, everything looks fine, with
'className' assigned "" going into $Image_1(). The resulting error
generated is " this$static.element is null".

Does anyone know a solution / workaround to this problem? I just
downloaded FF 3.0.3 today, haven't seen the error yet though.

Thanks
Alan

On Aug 7, 5:13 pm, "dunhamst...@gmail.com" <dunhamst...@gmail.com>
wrote:

Sumit Chandel

unread,
Sep 30, 2008, 9:51:18 AM9/30/08
to Google-We...@googlegroups.com
Hi Steve,

Could you link the thread or issue report you've started to report the problem back to the folks at Mozilla? It would be interesting to track the issue, especially for other community members who might run into the same problem.

From the snippet of code you've traced down, it seems like this is an FF3 issue rather than an issue related to GWT, but it would be interesting to track just to make sure.

Cheers,
-Sumit Chandel

bjorn

unread,
Oct 22, 2008, 9:16:45 AM10/22/08
to Google Web Toolkit
Hi, we're (unfortunately) seeing the issue in FF 3.0.3.

Did anyone succeed in filing this bug in bugzilla.mozilla.org? I have
searched for the string 'null' with

Product = Core
Component = JavaScript Engine
Severity = Blocker + Critical + Major

but found nothing that I think matches this problem. Please tell me if
I am searching in the wrong place here, otherwise I will try to file a
bug with Mozilla based on sample code in this thread.

Björn
Reply all
Reply to author
Forward
0 new messages