I also have a testcase that triggers the problem pretty reliably (at
least on my system). Problem is, it can't be 100% reliable, and it
likely depends on system setup (i.e. fonts installed). Find the testcase
attached.

/Roman

Am Montag, den 03.05.2010, 19:01 -0700 schrieb joe.da...@oracle.com:
> On 5/3/2010 6:35 PM, Martin Buchholz wrote:
> > Hi Roman,
> >
> > I can confirm that your fix addresses the hang
> > in my hacky test case FontDeadlock.java,
> > so we at Google will use your fix for openjdk6,
> > and would like to see it in openjdk6 proper.
> >
> > Joe, could you give this fix a thumbs up?
> >   
> 
> Hmm.  Is this is noreg-hard and your hacky test is too hacky to check in 
> as a regression test?
> 
> I'm inclined to let this go in, but want to make sure there is 
> appropriate test coverage.
> 
> -Joe
> 
> > Roman, please commit this to openjdk6
> > (or I can do it for you, if you prefer).
> >
> > Martin
> >
> > On Wed, Mar 3, 2010 at 12:33, Igor Nekrestyanov
> > <igor.nekrestya...@sun.com> wrote:
> >   
> >> Fix is ok with me.
> >>
> >> Here is the process description for openjdk6 -
> >> http://j2se.sfbay/web/bin/view/CoreTech/OpenJDK6
> >>
> >> -igor
> >>
> >> On 3/3/10 7:01 AM, Roman Kennke wrote:
> >>     
> >>> This is the fix for the deadlock problem in
> >>> SunGraphicsEnvironment/FontManager backported to OpenJDK6. It is
> >>> slightly different from the OpenJDK7 version due to the restructured
> >>> font manager, but the basic idea is the same: instead of sync'ing on 2
> >>> different lock objects (with the potential of entering the monitors in
> >>> the wrong order) we only sync on one (the FontManager class in this
> >>> case, was the FontManager instance in JDK7).
> >>>
> >>> http://cr.openjdk.java.net/~rkennke/6892485/webrev.02/
> >>>
> >>> Ok to push?
> >>>
> >>> Also, is there any additional stuff that needs to be done for pushing to
> >>> OpenJDK6, I never did that and I see that there are not team
> >>> repositories. When I have 2 ok's, should I push directly to the
> >>> jdk6/jdk6-gate/jdk repository?
> >>>
> >>> Thanks, Roman
> >>>
> >>>
> >>>       
> >>     

import java.util.*;
import java.util.concurrent.*;
import java.awt.*;

public class FontDeadlock {
    static String[] fontNames = {
        "SansSerif.plain",
        "AR PL UMing HK",
        "Sharjah",
        "Metal",
        "Comic Sans MS",
        "Century Schoolbook L Italic",
        "Nimbus Sans L Bold Condensed Italic",
        "DialogInput.bolditalic",
        "Nimbus Mono L Regular Oblique",
        "Graph",
        "URW Gothic L Book Oblique",
        "Tlwg Typewriter",
        "DejaVu Sans Mono Bold Oblique",
        "Winks",
        "Petra",
        "Waree Bold",
        "DejaVu Sans Condensed",
        "Loma Bold",
        "Dimnah",
        "Bitstream Vera Serif Bold",
        "Sawasdee Bold",
        "AnjaliOldLipi",
        "Lucida Sans Regular",
        "Bitstream Vera Sans Bold Oblique",
        "DejaVu Serif Italic",
        "Garuda Bold",
        "Norasi",
        "AR PL UKai CN",
        "Verdana",
        "DejaVu Serif Condensed Oblique",
        "Khalid",
        "Free Monospaced Bold Oblique",
        "SansSerif.italic",
        "Swift",
        "AlYarmook",
        "Courier New Bold Italic",
        "Nimbus Roman No9 L Medium Italic",
        "utkal medium",
        "AlBattar",
        "Trebuchet MS",
        "Monospaced.italic",
        "DejaVu Sans Condensed Bold",
        "Lucida Sans Oblique",
        "Arial Bold",
        "Haramain",
        "URW Palladio L Bold Italic",
        "Tlwg Typewriter Mono Oblique",
        "Nimbus Roman No9 L Medium",
        "Courier 10 Pitch Bold Italic",
        "Junkyard",
        "Garuda Bold Oblique",
        "Lucida Sans Typewriter Oblique",
        "Nice",
        "Waree",
        "Furat",
        "Un Batang Bold",
        "Free Monospaced Bold",
        "Tlwg Typist",
        "Tlwg Typist Bold Oblique",
        "Mashq",
        "Trebuchet MS Bold",
        "Courier New",
        "Andale Mono",
        "Dialog.bold",
        "Bitstream Charter",
        "Verdana Bold Italic",
        "Lohit Hindi",
        "AR PL UKai TW MBE",
        "Free Sans Bold Oblique",
        "Free Serif Bold Italic",
        "AR PL UMing CN",
        "Courier New Bold",
        "Nimbus Roman No9 L Regular Italic",
        "VL Gothic Regular",
        "Sindbad",
        "Hani",
        "progenisis",
        "Bitstream Vera Sans Mono Bold",
        "Nimbus Sans L Bold Condensed",
        "Webdings",
        "Dialog.italic",
        "Lucida Sans Typewriter Bold Oblique",
        "DejaVu Serif Condensed",
        "Norasi Oblique",
        "Standard Symbols L",
        "Tlwg Typewriter Bold Oblique",
        "Vemana2000",
        "Nimbus Sans L Bold",
        "DejaVu Sans Condensed Bold Oblique",
        "AR PL UMing TW MBE",
        "URW Gothic L Demi Oblique",
        "Dialog.bolditalic",
        "URW Bookman L Light",
        "El Abogado Loco",
        "AlManzomah",
        "URW Palladio L Italic",
        "AR PL UMing TW",
        "DejaVu Serif Bold Italic",
        "Free Sans Oblique",
        "Comic Sans MS Bold",
        "Dialog.plain",
        "Tlwg Mono Oblique",
        "DejaVu Serif Condensed Bold Italic",
        "Tarablus",
        "Century Schoolbook L Bold",
        "Free Sans",
        "Times New Roman Bold Italic",
        "MalOtf",
        "AlMohanad",
        "Lucida Sans Typewriter Bold",
        "Waree Oblique",
        "AlHor",
        "URW Bookman L Demi Bold Italic",
        "DejaVu Sans Mono Bold",
        "SteveHand",
        "Waree Bold Oblique",
        "Garuda Oblique",
        "Mashq Bold",
        "Nimbus Mono L Bold",
        "Lucida Bright Demibold",
        "Nagham",
        "Verdana Bold",
        "flatline",
        "Lucida Bright Regular",
        "Rehan",
        "AR PL UKai TW",
        "Arial Bold Italic",
        "Impact",
        "Mukti Narrow Bold",
        "DejaVu Sans Mono",
        "Times New Roman Bold",
        "Loma",
        "Nimbus Sans L Regular Condensed",
        "DejaVu Sans Oblique",
        "It wasn't me",
        "Georgia Bold",
        "Ouhod Bold",
        "Monospaced.bolditalic",
        "Cortoba",
        "Dustismo",
        "Bitstream Charter Bold",
        "Serif.bolditalic",
        "Courier 10 Pitch Bold",
        "DejaVu Serif Condensed Bold",
        "Free Monospaced Oblique",
        "DialogInput.bold",
        "Dustismo Roman Italic",
        "Shado",
        "Lohit Gujarati",
        "Kayrawan",
        "Bitstream Vera Serif",
        "DejaVu Sans",
        "AlMothnna Bold",
        "OpenSymbol",
        "Lucida Sans Demibold",
        "Bitstream Charter Bold Italic",
        "Nimbus Roman No9 L Regular",
        "Japan",
        "URW Palladio L Bold",
        "Georgia Italic",
        "Norasi Bold",
        "Bitstream Vera Sans",
        "Times New Roman Italic",
        "Lucida Bright Italic",
        "URW Gothic L Book",
        "Lucida Bright Demibold Italic",
        "Tholoth",
        "Penguin Attack",
        "Norasi Bold Italic",
        "Nimbus Mono L Regular",
        "Kochi Mincho",
        "URW Bookman L Demi Bold",
        "SansSerif.bold",
        "Tlwg Typewriter Bold",
        "Lucida Sans Typewriter Regular",
        "Phetsarath OT",
        "Norasi Italic",
        "Times New Roman",
        "Un Batang",
        "DejaVu Sans Condensed Oblique",
        "Dustismo  Bold Italic",
        "SansSerif.bolditalic",
        "Courier New Italic",
        "AlArabiya",
        "Serif.bold",
        "Free Serif Bold",
        "Free Serif",
        "Mallige Bold",
        "Bitstream Vera Sans Mono",
        "Un Dotum",
        "Free Monospaced",
        "DejaVu Sans Bold",
        "Serif.italic",
        "Loma Oblique",
        "Tlwg Typist Bold",
        "Kochi Gothic",
        "VL PGothic Regular",
        "Trebuchet MS Bold Italic",
        "Electron",
        "Nimbus Sans L Bold Italic",
        "Sawasdee Oblique",
        "Norasi Bold Oblique",
        "Rasheeq Bold",
        "Free Sans Bold",
        "Ostorah",
        "DejaVu Serif Condensed Bold Oblique",
        "Dustismo Roman Bold Italic",
        "Georgia",
        "Nada",
        "DejaVu Sans ExtraLight",
        "DejaVu Sans Mono Oblique",
        "URW Chancery L Medium Italic",
        "Nimbus Sans L Regular",
        "Georgia Bold Italic",
        "Nimbus Mono L Bold Oblique",
        "Serif.plain",
        "Arial",
        "Lohit Tamil",
        "Sawasdee Bold Oblique",
        "Lohit Punjabi",
        "Bitstream Vera Sans Oblique",
        "Tlwg Mono Bold",
        "Granada",
        "Balker",
        "AR PL UKai HK",
        "Dingbats ",
        "Bitstream Vera Sans Bold",
        "DejaVu Serif Bold",
        "Dustismo  Italic",
        "Salem",
        "Tlwg Mono Bold Oblique",
        "DialogInput.plain",
        "Jet",
        "DejaVu Serif Oblique",
        "Dustismo Roman Bold",
        "URW Palladio L Roman",
        "DialogInput.italic",
        "DejaVu Sans Bold Oblique",
        "AlMateen Bold",
        "DejaVu Serif Italic Condensed",
        "Hor",
        "Free Serif Italic",
        "Mukti Narrow",
        "Courier 10 Pitch",
        "Arab",
        "Loma Bold Oblique",
        "Bitstream Charter Italic",
        "Bitstream Vera Sans Mono Oblique",
        "Wargames",
        "URW Gothic L Demi",
        "Marked Fool",
        "Trebuchet MS Italic",
        "Arial Italic",
        "Un Dotum Bold",
        "Tlwg Typist Oblique",
        "Rachana_w01",
        "Domestic Manners",
        "Nimbus Sans L Regular Condensed Italic",
        "Garuda",
        "Dustismo Roman",
        "Sawasdee",
        "Dustismo  Bold",
        "Verdana Italic",
        "Courier 10 Pitch Italic",
        "Monospaced.bold",
        "DejaVu Serif",
        "Tlwg Mono",
        "Monospaced.plain",
        "Nimbus Sans L Regular Italic",
        "Mallige Normal",
        "Delphine",
        "Century Schoolbook L Roman",
        "Bitstream Vera Sans Mono Bold Oblique",
        "DejaVu Serif Bold Oblique",
        "Lucida Sans Demibold Oblique",
        "URW Bookman L Light Italic",
        "Purisa",
        "Arial Black",
    };
    public static void main(String[] args) throws Throwable {
//         final Font[] fonts = GraphicsEnvironment
//             .getLocalGraphicsEnvironment()
//             .getAllFonts();
        final int count = 100;
        final CountDownLatch startingGate = new CountDownLatch(1);
        Collections.shuffle(Arrays.asList(fontNames));
        //System.out.println(Font.decode("Tholoth"));
        final java.util.List<Thread> threads = new ArrayList<Thread>();
        for (int i = 0; i < count; i++) {
            threads.add(new Thread() { public void run() {
                try {
                startingGate.await();
//                 String[] copy = fontNames.clone();
//                 Collections.shuffle(Arrays.asList(copy));
                for (String name : fontNames) {
                    Font font = Font.decode(name + "-ITALIC");
                    if (font == null) throw new Error();
//                 Font[] copy = fonts.clone();
//                 Collections.shuffle(Arrays.asList(copy));
		    System.out.println(font.getFontName());
		 }
                } catch (Throwable t) { throw new Error(t); }
            }});
        }
        startingGate.countDown();
        for (Thread thread : threads) thread.start();
        for (Thread thread : threads) thread.join();
        //System.out.println(Arrays.toString(fonts));
    }
}

Attachment: runfontdeadlock.sh
Description: application/shellscript

Reply via email to