public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: "ovidr at users dot sourceforge dot net" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug libgcj/18187] New: ava.util.WeakHashMap$WeakEntrySet.next() throws NoSuchElementException during GC
Date: Wed, 27 Oct 2004 19:44:00 -0000	[thread overview]
Message-ID: <20041027194432.18187.ovidr@users.sourceforge.net> (raw)

During garbage collection, the WeakHashMap will throw a NoSuchElementException 
when performing the methods: 

.keySet().toArray()
.clear();

and maybe more.  Sun's java does not.

Here is an example:

gcc version 4.0.0 20041014 (experimental)
gcj -main=WH WH.java

import java.util.*;

public class WH {

  public static void main(String[] s) {

    Thread t = new Thread() {
      public void run() {
        while (true) {
          System.gc();
          try {
            Thread.sleep(1000);
          } catch (Exception e) {
          }
        }
      }
    };

    WeakHashMap w = new WeakHashMap();
    for (int i = 0; i < 10000; i++)
      w.put(new WH(), null);

    t.setDaemon(true);
    t.start();

    try {
      w.clear();
    } catch (NoSuchElementException n) {
      System.out.println("From .clear(): ");
      n.printStackTrace();
    }

    for (int i = 0; i < 10000; i++)
      w.put(new WH(), null);

    try {
    for (int i = 0; i < 1000; i++)
      System.out.print("["+w.keySet().toArray().length+"]");

    } catch (NoSuchElementException n) {
      System.out.println("iFrom .toArray():");
      n.printStackTrace();
    }

  }

}

-- 
           Summary: ava.util.WeakHashMap$WeakEntrySet.next() throws
                    NoSuchElementException during GC
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libgcj
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ovidr at users dot sourceforge dot net
                CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
                    dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18187


             reply	other threads:[~2004-10-27 19:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-27 19:44 ovidr at users dot sourceforge dot net [this message]
2004-10-27 19:46 ` [Bug libgcj/18187] " pinskia at gcc dot gnu dot org
2004-10-28 14:26 ` [Bug libgcj/18187] java.util.WeakHashMap$WeakEntrySet.next() " pinskia at gcc dot gnu dot org
2004-10-28 14:26 ` pinskia at gcc dot gnu dot org
2004-10-28 14:26 ` pinskia at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041027194432.18187.ovidr@users.sourceforge.net \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=java-prs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).