Hmmmmm, I agree there shouldn't be any *good* reason for a race condition to exist, it should all be single-threaded anyway. That said, one difference is certainly that the original Locale is stored in a *static* var rather than a class var. I have no objection to moving the save/restore to @Before and @After rather than @BeforeClass and @AfterClass and making the original Locale not be static.
I'd be interested if that makes your problem go away, and if it does why. And whether you'd get the same results if we synchronized get/set of the original Locale..... And if this made a difference, it would worry me... Erick On Fri, Dec 11, 2009 at 9:26 AM, Robert Muir <rcm...@gmail.com> wrote: > Erick I will play with it some more and see if i can recreate this behavior > somehow. > I do not see a problem with the code, and think that if there is a race, > there should have been one before with the old LocalizedTestCase (as the > behavior is the same, we are changing a system-wide static) > > The only small difference is that this happens @BeforeClass with the new > one, versus @Before with the old one? > > > On Fri, Dec 11, 2009 at 9:05 AM, Erick Erickson > <erickerick...@gmail.com>wrote: > >> So I ran this test suite from Idea a dozen times or so and no problem. >> >> Then I ran it a couple of thousand times through Ant via a shell >> script. No problem. >> >> So I'm tending toward thinking it's an Eclipse issue, what do >> you think? >> >> Erick >> >> >> On Thu, Dec 10, 2009 at 4:23 PM, Erick Erickson >> <erickerick...@gmail.com>wrote: >> >>> I'll give this a whirl tonight. The reason I was wondering what language >>> is to insure that my machine *also* tests the offending locale..... >>> >>> A bit of a nit, the flaw in the approach with LocalizedTestCase is >>> that *every* test in the class is run against *all* locales...... >>> To change this, as I understand it, we'd need to break the tests >>> out into a separate class....... >>> >>> Intermittent errors often smell like a race condition, so I'll be >>> on the lookout for one. >>> >>> But I also wonder if you'd ever get this error running outside >>> of Eclipse. >>> >>> I really, really, really hate ones like this. Let's say you have a script >>> that runs 1,000 times flawlessly from the shell. What does that prove? >>> <nasty grin>. >>> >>> But maybe if I relentlessly press the test button on that class it'll >>> happen >>> to me too.... >>> >>> FWIW >>> Erick >>> >>> On Thu, Dec 10, 2009 at 3:30 PM, Robert Muir <rcm...@gmail.com> wrote: >>> >>>> i just right clicked TestQueryParser and said 'run as junit test' >>>> >>>> i could not tell which locales failed, (just testing your original >>>> patch, no modifications) >>>> the way they are shown instead is like an array of 135 elements... >>>> [0]: testCJK[0] (0.000s) >>>> testSimple[0] (0.001s) >>>> ... >>>> [1]: testCJK[1] (0.000s) >>>> ... >>>> [135] testCJK[135] >>>> >>>> the only tests that failed were the localized methods like the date >>>> stuff, where its going to create an 'expected' localized string and then >>>> compare against that. >>>> it makes me suspect that somehow there is some race, and the default >>>> locale is actually changing as the test is running, or something crazy like >>>> this?! >>>> >>>> >>>> >>>> On Thu, Dec 10, 2009 at 3:23 PM, Erick Erickson < >>>> erickerick...@gmail.com> wrote: >>>> >>>>> Yep, that sure makes me nervous too. I've never seen a failure in >>>>> IntelliJ or from a >>>>> shell window. >>>>> >>>>> How often do you need to run it to see an error? And what language is >>>>> it using? >>>>> And what test? >>>>> >>>>> I can try this in my IntelliJ setup and see if I can reproduce it. Note >>>>> I'm running >>>>> on a Macbook Pro... >>>>> >>>>> I wonder if a repeating script would show an intermittent error........ >>>>> >>>>> Erick >>>>> >>>>> >>>>> On Thu, Dec 10, 2009 at 3:10 PM, Robert Muir (JIRA) >>>>> <j...@apache.org>wrote: >>>>> >>>>>> >>>>>> [ >>>>>> https://issues.apache.org/jira/browse/LUCENE-2122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12788884#action_12788884] >>>>>> >>>>>> Robert Muir commented on LUCENE-2122: >>>>>> ------------------------------------- >>>>>> >>>>>> Hi Erick, I played with this patch some and (not intentionally trying) >>>>>> I would get random test failures for TestQueryParser under eclipse... its >>>>>> not really something I am able to repeat though. >>>>>> >>>>>> maybe some race condition (I do not know how eclipse executes >>>>>> parameterized tests).... ? >>>>>> >>>>>> if it is a problem with my IDE that is one thing, just makes me a >>>>>> little nervous right now. trying to think what could cause this.... >>>>>> >>>>>> > Use JUnit4 capabilites for more thorough Locale testing for classes >>>>>> deriving from LocalizedTestCase >>>>>> > >>>>>> --------------------------------------------------------------------------------------------------- >>>>>> > >>>>>> > Key: LUCENE-2122 >>>>>> > URL: >>>>>> https://issues.apache.org/jira/browse/LUCENE-2122 >>>>>> > Project: Lucene - Java >>>>>> > Issue Type: Improvement >>>>>> > Components: Other >>>>>> > Affects Versions: 3.1 >>>>>> > Reporter: Erick Erickson >>>>>> > Assignee: Robert Muir >>>>>> > Priority: Minor >>>>>> > Fix For: 3.1 >>>>>> > >>>>>> > Attachments: LUCENE-2122-r2.patch, LUCENE-2122-r3.patch, >>>>>> LUCENE-2122-r4.patch, LUCENE-2122.patch >>>>>> > >>>>>> > >>>>>> > Use the @Parameterized capabilities of Junit4 to allow more >>>>>> extensive testing of Locales. >>>>>> >>>>>> -- >>>>>> This message is automatically generated by JIRA. >>>>>> - >>>>>> You can reply to this email to add a comment to the issue online. >>>>>> >>>>>> >>>>>> --------------------------------------------------------------------- >>>>>> To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org >>>>>> For additional commands, e-mail: java-dev-h...@lucene.apache.org >>>>>> >>>>>> >>>>> >>>> >>>> >>>> -- >>>> Robert Muir >>>> rcm...@gmail.com >>>> >>> >>> >> > > > -- > Robert Muir > rcm...@gmail.com >