This is the mail archive of the
java-discuss@sources.redhat.com
mailing list for the Java project.
Re: weird GC problem
- To: java-discuss at sources dot redhat dot com
- Subject: Re: weird GC problem
- From: Jeff Sturm <jeff dot sturm at appnet dot com>
- Date: Sat, 23 Dec 2000 18:38:49 -0500
- References: <3A445902.31BABB74@appnet.com>
Jeff Sturm wrote:
> I've been trying for a few days to track down a mysterious crash in some
> Java code, using a recent gcc snapshot. So far I haven't produced a
> simple test case... small classes never exhibit the problem.
Got it! Thanks to Tom and Bryce for the debugging tips.
It's not a case of premature finalization at all, rather its an ordinary
libgcj bug. Through careful debugging I discovered exactly two
FileDescriptor objects in memory with fd == 0. One was assigned to
FileDescriptor.in and is a live object. The other gets finalized,
closing stdin.
The challenge was figuring out where this imposter FileDescriptor came
from. The typical constructor performs a native open:
fd = open(path, mode);
Seemingly this will always return a valid fd, or -1. But if <path> does
not exist, open() throws a FileNotFoundException instead, so the
assignment above never takes place, and fd remains initialized to zero,
which is a valid file descriptor!
Patch coming soon...
Jeff