You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Vasily Zakharov (JIRA)" <ji...@apache.org> on 2007/04/09 20:29:32 UTC

[jira] Updated: (HARMONY-3601) [classlib][awt][drlvm][netbeans] Toolkit.createImage() throws RTE: Not owner can't unlock resource

     [ https://issues.apache.org/jira/browse/HARMONY-3601?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vasily Zakharov updated HARMONY-3601:
-------------------------------------

    Component/s: App-Oriented Bug Reports
    Description: 
The following test calls java.awt.Toolkit.getDefaultToolkit().createImage() simultaneously from multiple threads:

public class Test {
    static final int NUM_THREADS = 5;
    static boolean success = true;

    public static void main(String args[]) throws Exception {
        Thread[] threads = new Thread[NUM_THREADS];

        for (int i = 0; i < NUM_THREADS; i++) {
            threads[i] = new Thread() {
                public void run() {
                    try {
                        java.awt.Toolkit.getDefaultToolkit().createImage(new java.net.URL("file://any/thing"));
                    } catch (Exception e) {
                        System.out.print("ERROR at " + Thread.currentThread() + ": ");
                        e.printStackTrace();
                        success = false;
                    }
                }
            };
        }
        for (int i = 0; i < NUM_THREADS; i++) {
            threads[i].start();
        }
        for (int i = 0; i < NUM_THREADS; i++) {
            while (true) {
                try {
                    threads[i].join();
                    break;
                } catch (InterruptedException e) {
                    // Ignore.
                }
            }
        }
        System.out.println(success ? "SUCCESS" : "FAIL");
    }
}

Output on RI:

SUCCESS

Output on Harmony/IBM VM:

SUCCESS:

Output on Harmony/DRL VM (both Jit and Interpreter):

ERROR at Thread[Thread-8,5,main]: java.lang.RuntimeException: Not owner can't unlock resource
        at org.apache.harmony.awt.wtk.Synchronizer.unlock(Synchronizer.java:120)
        at java.awt.Toolkit.unlockAWT(Toolkit.java:399)
        at java.awt.ToolkitImpl.createImage(ToolkitImpl.java:104)
        at TestUnlock$1.run(TestUnlock.java:14)
ERROR at Thread[Thread-7,5,main]: java.lang.RuntimeException: Not owner can't unlock resource
        at org.apache.harmony.awt.wtk.Synchronizer.unlock(Synchronizer.java:120)
        at java.awt.Toolkit.unlockAWT(Toolkit.java:399)
        at java.awt.ToolkitImpl.createImage(ToolkitImpl.java:104)
        at TestUnlock$1.run(TestUnlock.java:14)
ERROR at Thread[Thread-6,5,main]: java.lang.RuntimeException: Not owner can't unlock resource
        at org.apache.harmony.awt.wtk.Synchronizer.unlock(Synchronizer.java:120)
        at java.awt.Toolkit.unlockAWT(Toolkit.java:399)
        at java.awt.ToolkitImpl.createImage(ToolkitImpl.java:104)
        at TestUnlock$1.run(TestUnlock.java:14)
FAIL

The problem only occurs on DRL VM, but I'm not sure whether this is a DRL VM or AWT issue, and I have no idea how to fix it.

The problem was discovered while trying to run Netbeans on Harmony.


  was:
The following test calls java.awt.Toolkit.getDefaultToolkit().createImage() simultaneously from multiple threads:

public class TestUnlock {
    static final int NUM_THREADS = 5;
    static boolean success = true;

    public static void main(String args[]) throws Exception {
        Thread[] threads = new Thread[NUM_THREADS];

        for (int i = 0; i < NUM_THREADS; i++) {
            threads[i] = new Thread() {
                public void run() {
                    try {
                        java.awt.Toolkit.getDefaultToolkit().createImage(new java.net.URL("file://any/thing"));
                    } catch (Exception e) {
                        System.out.print("ERROR at " + Thread.currentThread() + ": ");
                        e.printStackTrace();
                        success = false;
                    }
                }
            };
        }
        for (int i = 0; i < NUM_THREADS; i++) {
            threads[i].start();
        }
        for (int i = 0; i < NUM_THREADS; i++) {
            while (true) {
                try {
                    threads[i].join();
                    break;
                } catch (InterruptedException e) {
                    // Ignore.
                }
            }
        }
        System.out.println(success ? "SUCCESS" : "FAIL");
    }
}

Output on RI:

SUCCESS

Output on Harmony/IBM VM:

SUCCESS:

Output on Harmony/DRL VM (both Jit and Interpreter):

ERROR at Thread[Thread-8,5,main]: java.lang.RuntimeException: Not owner can't unlock resource
        at org.apache.harmony.awt.wtk.Synchronizer.unlock(Synchronizer.java:120)
        at java.awt.Toolkit.unlockAWT(Toolkit.java:399)
        at java.awt.ToolkitImpl.createImage(ToolkitImpl.java:104)
        at TestUnlock$1.run(TestUnlock.java:14)
ERROR at Thread[Thread-7,5,main]: java.lang.RuntimeException: Not owner can't unlock resource
        at org.apache.harmony.awt.wtk.Synchronizer.unlock(Synchronizer.java:120)
        at java.awt.Toolkit.unlockAWT(Toolkit.java:399)
        at java.awt.ToolkitImpl.createImage(ToolkitImpl.java:104)
        at TestUnlock$1.run(TestUnlock.java:14)
ERROR at Thread[Thread-6,5,main]: java.lang.RuntimeException: Not owner can't unlock resource
        at org.apache.harmony.awt.wtk.Synchronizer.unlock(Synchronizer.java:120)
        at java.awt.Toolkit.unlockAWT(Toolkit.java:399)
        at java.awt.ToolkitImpl.createImage(ToolkitImpl.java:104)
        at TestUnlock$1.run(TestUnlock.java:14)
FAIL

The problem only occurs on DRL VM, but I'm not sure whether this is a DRL VM or AWT issue, and I have no idea how to fix it.

The problem was discovered while trying to run Netbeans on Harmony.



> [classlib][awt][drlvm][netbeans] Toolkit.createImage() throws RTE: Not owner can't unlock resource
> --------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-3601
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3601
>             Project: Harmony
>          Issue Type: Bug
>          Components: App-Oriented Bug Reports, Classlib, DRLVM
>            Reporter: Vasily Zakharov
>
> The following test calls java.awt.Toolkit.getDefaultToolkit().createImage() simultaneously from multiple threads:
> public class Test {
>     static final int NUM_THREADS = 5;
>     static boolean success = true;
>     public static void main(String args[]) throws Exception {
>         Thread[] threads = new Thread[NUM_THREADS];
>         for (int i = 0; i < NUM_THREADS; i++) {
>             threads[i] = new Thread() {
>                 public void run() {
>                     try {
>                         java.awt.Toolkit.getDefaultToolkit().createImage(new java.net.URL("file://any/thing"));
>                     } catch (Exception e) {
>                         System.out.print("ERROR at " + Thread.currentThread() + ": ");
>                         e.printStackTrace();
>                         success = false;
>                     }
>                 }
>             };
>         }
>         for (int i = 0; i < NUM_THREADS; i++) {
>             threads[i].start();
>         }
>         for (int i = 0; i < NUM_THREADS; i++) {
>             while (true) {
>                 try {
>                     threads[i].join();
>                     break;
>                 } catch (InterruptedException e) {
>                     // Ignore.
>                 }
>             }
>         }
>         System.out.println(success ? "SUCCESS" : "FAIL");
>     }
> }
> Output on RI:
> SUCCESS
> Output on Harmony/IBM VM:
> SUCCESS:
> Output on Harmony/DRL VM (both Jit and Interpreter):
> ERROR at Thread[Thread-8,5,main]: java.lang.RuntimeException: Not owner can't unlock resource
>         at org.apache.harmony.awt.wtk.Synchronizer.unlock(Synchronizer.java:120)
>         at java.awt.Toolkit.unlockAWT(Toolkit.java:399)
>         at java.awt.ToolkitImpl.createImage(ToolkitImpl.java:104)
>         at TestUnlock$1.run(TestUnlock.java:14)
> ERROR at Thread[Thread-7,5,main]: java.lang.RuntimeException: Not owner can't unlock resource
>         at org.apache.harmony.awt.wtk.Synchronizer.unlock(Synchronizer.java:120)
>         at java.awt.Toolkit.unlockAWT(Toolkit.java:399)
>         at java.awt.ToolkitImpl.createImage(ToolkitImpl.java:104)
>         at TestUnlock$1.run(TestUnlock.java:14)
> ERROR at Thread[Thread-6,5,main]: java.lang.RuntimeException: Not owner can't unlock resource
>         at org.apache.harmony.awt.wtk.Synchronizer.unlock(Synchronizer.java:120)
>         at java.awt.Toolkit.unlockAWT(Toolkit.java:399)
>         at java.awt.ToolkitImpl.createImage(ToolkitImpl.java:104)
>         at TestUnlock$1.run(TestUnlock.java:14)
> FAIL
> The problem only occurs on DRL VM, but I'm not sure whether this is a DRL VM or AWT issue, and I have no idea how to fix it.
> The problem was discovered while trying to run Netbeans on Harmony.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.