Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 May 2000 22:25:00 -0600 (MDT)
From:      Nate Williams <nate@yogotech.com>
To:        Sean Reilly <sreilly@seanreilly.com>
Cc:        freebsd-java@FreeBSD.ORG
Subject:   Re: problem in 1.1.8
Message-ID:  <200005190425.WAA28735@nomad.yogotech.com>
In-Reply-To: <Pine.BSF.4.10.10005181934260.61564-100000@seanreilly.com>
References:  <Pine.BSF.4.10.10005181934260.61564-100000@seanreilly.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> I'm running into a problem on 4.0-RELEASE with the 1.1.8 JDK port. My
> program freezes shortly after startup while trying to load an image as a
> splash window.  Hitting Ctrl-\ results in the thread dump below.  Is the
> X11Graphics.finalize supposed to be called from within String.<init> or am
> I reading this wrong?

"finalize" should *NEVER* be called from external threads, and is the
domain of the GC thread.   Are you calling finalize by hand?

> Any insight as to how I can avoid this is appreciated.

See above.  How are you loading the image?  Can you give a bit more
details as to what exactly the program is doing.

> ^\SIGQUIT   3*   quit
> 
> Full thread dump:
>         sun.awt.AWTFinalizer.run(AWTFinalizer.java:40)
>     "Image Animator 0" (TID:0x2869aab0, sys_thread_t:0x29507f00, state:MW)
> prio=3
>         sun.awt.image.ImageDecoder.close(ImageDecoder.java:163)

Image Animator 0 is callig close and is waiting on the monitor.

>     "main" (TID:0x2866f0b0, sys_thread_t:0x8124a00, state:MW) prio=5
>         sun.awt.motif.X11Graphics.finalize(X11Graphics.java:109)
>         java.lang.String.<init>(String.java)
>         java.io.DataInputStream.readUTF(DataInputStream.java)
>         java.io.DataInputStream.readUTF(DataInputStream.java)

And the main thread is calling finalize, which is weird.

>     sun.awt.image.GifImageDecoder@2869AE78/286FB0E8: owner "Image Animator
> 0" (0x29507f00, 1 entry)
>     sun.awt.motif.MToolkit@286900B0/286DDD28: <unowned>
>         Waiting to be notified:
>             "AWT-Motif" (0x294e4f00)
>     java.lang.Class@28699CD0/286F5140: owner "AWT-EventQueue-0"
> (0x294a2f00, 1 entry)
>     java.lang.Class@2869AE80/286FB070: owner "Image Animator 0"
> (0x29507f00, 1 entry)
>     java.lang.Class@28699EB8/286F58C8: owner "main" (0x8124a00, 1 entry)
>     sun.awt.AWTFinalizer@2869AFC8/286DE6B0: <unowned>
>         Waiting to be notified:
>             "AWT-Finalizer" (0x29528f00)
>     <unknown key> (0x29452f00): <unowned>
>         Waiting to be notified:
>             "Async Garbage Collector" (0x29452f00)

Interesting.  Why is readObject() calling the GC?  You're not making any
explicity calls to the garbage collector, are you?

> Registered Monitor Dump:
>     Thread queue lock: <unowned>
>     Name and type hash table lock: <unowned>
>     String intern lock: <unowned>
>     JNI pinning lock: <unowned>
>     JNI global reference lock: <unowned>
>     BinClass lock: <unowned>
>     Class loading lock: owner "AWT-EventQueue-0" (0x294a2f00, 1 entry)
>         Waiting to enter:
>             "main" (0x8124a00)
>             "Image Animator 0" (0x29507f00)

Ahh, this is a clue.  It turns out that there are races in the Java
imaging code (which is a complete mess), and you may have stumbled on
them.  Sometimes moving the code around and/or adding sleeps in places
causes the races to go away.  *ESPECIALLY* when dealing with object
serialization.

You aren't using any static class locks by chance are you?

ie;

class foo {
    static synchronized void foo() {
        // Do something in here.
    }





Nate


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-java" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200005190425.WAA28735>