Re: Odd test failures

2014-09-01 Thread Dawid Weiss
 Thanks Dawid! So my take-away is that  this is just pilot error on my part,
 not something intrinsic to the code.

I don't know enough about the code to say for sure, but to me that
FaultyIndexInput's count field should be reset before each test
(shouldn't propagate from test to test, effectively making each test
rely on the number of tests before it). As for the exception itself,
I've no idea -- didn't look at the code; I think it may be assuming
only one iteration.

Dawid


 Erick


 On Sun, Aug 31, 2014 at 12:46 PM, Dawid Weiss dawid.we...@cs.put.poznan.pl
 wrote:

 It's because the exception is triggered in a static class
 FaultyIndexInput (initialized in a static context
 TestFieldsReader#beforeClass). When you ask for -Dtests.iters, only
 the tests (methods) are duplicated, the static context remains the
 same. So the count variable in FaultyIndexInput is actually
 propagated from test to test and each repetition is not really atomic/
 isolated from others (search for one of recent e-mail to Ryan, it
 contains a deeper information on why and how this works).

 You can repeat the failure if you repeat exactly the same seed for
 each repetition (including test methods):

 ant test  -Dtestcase=TestFieldsReader
 -Dtests.seed=DFB0B84C4D087DFD:1DE75618D1B7C867 -Dtests.slow=true
 -Dtests.locale=sr_ME -Dtests.timezone=Asia/Kashgar
 -Dtests.file.encoding=UTF-8 -Dtests.iters=10

 This yields:

 Tests with failures:
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#1
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#2
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#3
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#4
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#5
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#6
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#7
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#8
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#9
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}

 Note I included per-method seed in the -Dtests.seed. Also, #0
 iteration *does pass*; the remaining ones fail because of what I said
 above.

 Dawid

 On Sun, Aug 31, 2014 at 6:20 AM, Erick Erickson erickerick...@gmail.com
 wrote:
  I'm seeing the fairly easily-reproducible error below on trunk.
  Unfortunately it doesn't reproduce with the seed. I'm wondering if
  anyone
  has an inkling what's going on here?
 
  I did manage to notice that I screwed up the command I was _intending_
  and
  actually issued the command below, although I have a hard time imagining
  that's the problem, unless it's something like running tests.iters on
  the
  full suite makes this happen. No wonder -Dtests.iters=100 didn't
  finish...
  Siii.
 
  ant -Dtestcasae=TestDistributedSearch -Dtests.iters=10 test
 
  Note I spelled 'testcase' as 'testcasae'...
 
 
  Stack trace:
 
 [junit4] Suite: org.apache.lucene.index.TestFieldsReader
 
 [junit4]   2 NOTE: reproduce with: ant test
  -Dtestcase=TestFieldsReader
  -Dtests.method=testExceptions -Dtests.seed=DFB0B84C4D087DFD
  -Dtests.slow=true -Dtests.locale=sr_ME -Dtests.timezone=Asia/Kashgar
  -Dtests.file.encoding=UTF-8
 
 [junit4] ERROR   0.10s J2 | TestFieldsReader.testExceptions {#1
  seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]} 
 
 [junit4] Throwable #1: java.io.IOException: Simulated network
  outage
 
 [junit4] at
  __randomizedtesting.SeedInfo.seed([DFB0B84C4D087DFD:1DE75618D1B7C867]:0)
 
 [junit4] at
 
  org.apache.lucene.index.TestFieldsReader$FaultyIndexInput.simOutage(TestFieldsReader.java:156)
 
 [junit4] at
 
  org.apache.lucene.index.TestFieldsReader$FaultyIndexInput.readInternal(TestFieldsReader.java:161)
 
 [junit4] at
 
  org.apache.lucene.store.BufferedIndexInput.refill(BufferedIndexInput.java:342)
 
 [junit4] at
 
  org.apache.lucene.store.BufferedIndexInput.readBytes(BufferedIndexInput.java:140)
 
 [junit4] at
 
  org.apache.lucene.store.BufferedIndexInput.readBytes(BufferedIndexInput.java:116)
 
 [junit4] at
 
  org.apache.lucene.store.BufferedChecksumIndexInput.readBytes(BufferedChecksumIndexInput.java:49)
 
 [junit4] at
  org.apache.lucene.store.DataInput.readString(DataInput.java:234)
 
 [junit4] at
 
  org.apache.lucene.store.DataInput.readStringStringMap(DataInput.java:263)
 
 [junit4] at
 
  org.apache.lucene.codecs.lucene46.Lucene46FieldInfosReader.read(Lucene46FieldInfosReader.java:93)
 
 [junit4] at
 
  

Re: Odd test failures

2014-09-01 Thread Dawid Weiss
Hi Erick,

I filed LUCENE-5916 and attached a patch. Check it out and commit it
in -- I would like you to understand on a concrete example why the
patched code will work and the previous code didn't. :)

Dawid


On Mon, Sep 1, 2014 at 8:24 AM, Dawid Weiss
dawid.we...@cs.put.poznan.pl wrote:
 Thanks Dawid! So my take-away is that  this is just pilot error on my part,
 not something intrinsic to the code.

 I don't know enough about the code to say for sure, but to me that
 FaultyIndexInput's count field should be reset before each test
 (shouldn't propagate from test to test, effectively making each test
 rely on the number of tests before it). As for the exception itself,
 I've no idea -- didn't look at the code; I think it may be assuming
 only one iteration.

 Dawid


 Erick


 On Sun, Aug 31, 2014 at 12:46 PM, Dawid Weiss dawid.we...@cs.put.poznan.pl
 wrote:

 It's because the exception is triggered in a static class
 FaultyIndexInput (initialized in a static context
 TestFieldsReader#beforeClass). When you ask for -Dtests.iters, only
 the tests (methods) are duplicated, the static context remains the
 same. So the count variable in FaultyIndexInput is actually
 propagated from test to test and each repetition is not really atomic/
 isolated from others (search for one of recent e-mail to Ryan, it
 contains a deeper information on why and how this works).

 You can repeat the failure if you repeat exactly the same seed for
 each repetition (including test methods):

 ant test  -Dtestcase=TestFieldsReader
 -Dtests.seed=DFB0B84C4D087DFD:1DE75618D1B7C867 -Dtests.slow=true
 -Dtests.locale=sr_ME -Dtests.timezone=Asia/Kashgar
 -Dtests.file.encoding=UTF-8 -Dtests.iters=10

 This yields:

 Tests with failures:
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#1
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#2
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#3
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#4
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#5
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#6
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#7
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#8
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#9
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}

 Note I included per-method seed in the -Dtests.seed. Also, #0
 iteration *does pass*; the remaining ones fail because of what I said
 above.

 Dawid

 On Sun, Aug 31, 2014 at 6:20 AM, Erick Erickson erickerick...@gmail.com
 wrote:
  I'm seeing the fairly easily-reproducible error below on trunk.
  Unfortunately it doesn't reproduce with the seed. I'm wondering if
  anyone
  has an inkling what's going on here?
 
  I did manage to notice that I screwed up the command I was _intending_
  and
  actually issued the command below, although I have a hard time imagining
  that's the problem, unless it's something like running tests.iters on
  the
  full suite makes this happen. No wonder -Dtests.iters=100 didn't
  finish...
  Siii.
 
  ant -Dtestcasae=TestDistributedSearch -Dtests.iters=10 test
 
  Note I spelled 'testcase' as 'testcasae'...
 
 
  Stack trace:
 
 [junit4] Suite: org.apache.lucene.index.TestFieldsReader
 
 [junit4]   2 NOTE: reproduce with: ant test
  -Dtestcase=TestFieldsReader
  -Dtests.method=testExceptions -Dtests.seed=DFB0B84C4D087DFD
  -Dtests.slow=true -Dtests.locale=sr_ME -Dtests.timezone=Asia/Kashgar
  -Dtests.file.encoding=UTF-8
 
 [junit4] ERROR   0.10s J2 | TestFieldsReader.testExceptions {#1
  seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]} 
 
 [junit4] Throwable #1: java.io.IOException: Simulated network
  outage
 
 [junit4] at
  __randomizedtesting.SeedInfo.seed([DFB0B84C4D087DFD:1DE75618D1B7C867]:0)
 
 [junit4] at
 
  org.apache.lucene.index.TestFieldsReader$FaultyIndexInput.simOutage(TestFieldsReader.java:156)
 
 [junit4] at
 
  org.apache.lucene.index.TestFieldsReader$FaultyIndexInput.readInternal(TestFieldsReader.java:161)
 
 [junit4] at
 
  org.apache.lucene.store.BufferedIndexInput.refill(BufferedIndexInput.java:342)
 
 [junit4] at
 
  org.apache.lucene.store.BufferedIndexInput.readBytes(BufferedIndexInput.java:140)
 
 [junit4] at
 
  org.apache.lucene.store.BufferedIndexInput.readBytes(BufferedIndexInput.java:116)
 
 [junit4] at
 
  org.apache.lucene.store.BufferedChecksumIndexInput.readBytes(BufferedChecksumIndexInput.java:49)
 
 [junit4] at
  org.apache.lucene.store.DataInput.readString(DataInput.java:234)
 
 [junit4] at
 
  

Re: Odd test failures

2014-09-01 Thread Ramkumar R. Aiyengar
Just curious, is there any case where you might genuinely need non-final
static members in a test class? I guess it wouldn't catch all cases, but
something in setup/teardown which bans that using introspection might catch
at least the obvious cases..
On 1 Sep 2014 14:01, Dawid Weiss dawid.we...@cs.put.poznan.pl wrote:

 Hi Erick,

 I filed LUCENE-5916 and attached a patch. Check it out and commit it
 in -- I would like you to understand on a concrete example why the
 patched code will work and the previous code didn't. :)

 Dawid


 On Mon, Sep 1, 2014 at 8:24 AM, Dawid Weiss
 dawid.we...@cs.put.poznan.pl wrote:
  Thanks Dawid! So my take-away is that  this is just pilot error on my
 part,
  not something intrinsic to the code.
 
  I don't know enough about the code to say for sure, but to me that
  FaultyIndexInput's count field should be reset before each test
  (shouldn't propagate from test to test, effectively making each test
  rely on the number of tests before it). As for the exception itself,
  I've no idea -- didn't look at the code; I think it may be assuming
  only one iteration.
 
  Dawid
 
 
  Erick
 
 
  On Sun, Aug 31, 2014 at 12:46 PM, Dawid Weiss 
 dawid.we...@cs.put.poznan.pl
  wrote:
 
  It's because the exception is triggered in a static class
  FaultyIndexInput (initialized in a static context
  TestFieldsReader#beforeClass). When you ask for -Dtests.iters, only
  the tests (methods) are duplicated, the static context remains the
  same. So the count variable in FaultyIndexInput is actually
  propagated from test to test and each repetition is not really atomic/
  isolated from others (search for one of recent e-mail to Ryan, it
  contains a deeper information on why and how this works).
 
  You can repeat the failure if you repeat exactly the same seed for
  each repetition (including test methods):
 
  ant test  -Dtestcase=TestFieldsReader
  -Dtests.seed=DFB0B84C4D087DFD:1DE75618D1B7C867 -Dtests.slow=true
  -Dtests.locale=sr_ME -Dtests.timezone=Asia/Kashgar
  -Dtests.file.encoding=UTF-8 -Dtests.iters=10
 
  This yields:
 
  Tests with failures:
- org.apache.lucene.index.TestFieldsReader.testExceptions {#1
  seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
- org.apache.lucene.index.TestFieldsReader.testExceptions {#2
  seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
- org.apache.lucene.index.TestFieldsReader.testExceptions {#3
  seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
- org.apache.lucene.index.TestFieldsReader.testExceptions {#4
  seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
- org.apache.lucene.index.TestFieldsReader.testExceptions {#5
  seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
- org.apache.lucene.index.TestFieldsReader.testExceptions {#6
  seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
- org.apache.lucene.index.TestFieldsReader.testExceptions {#7
  seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
- org.apache.lucene.index.TestFieldsReader.testExceptions {#8
  seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
- org.apache.lucene.index.TestFieldsReader.testExceptions {#9
  seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
 
  Note I included per-method seed in the -Dtests.seed. Also, #0
  iteration *does pass*; the remaining ones fail because of what I said
  above.
 
  Dawid
 
  On Sun, Aug 31, 2014 at 6:20 AM, Erick Erickson 
 erickerick...@gmail.com
  wrote:
   I'm seeing the fairly easily-reproducible error below on trunk.
   Unfortunately it doesn't reproduce with the seed. I'm wondering if
   anyone
   has an inkling what's going on here?
  
   I did manage to notice that I screwed up the command I was
 _intending_
   and
   actually issued the command below, although I have a hard time
 imagining
   that's the problem, unless it's something like running tests.iters on
   the
   full suite makes this happen. No wonder -Dtests.iters=100 didn't
   finish...
   Siii.
  
   ant -Dtestcasae=TestDistributedSearch -Dtests.iters=10 test
  
   Note I spelled 'testcase' as 'testcasae'...
  
  
   Stack trace:
  
  [junit4] Suite: org.apache.lucene.index.TestFieldsReader
  
  [junit4]   2 NOTE: reproduce with: ant test
   -Dtestcase=TestFieldsReader
   -Dtests.method=testExceptions -Dtests.seed=DFB0B84C4D087DFD
   -Dtests.slow=true -Dtests.locale=sr_ME -Dtests.timezone=Asia/Kashgar
   -Dtests.file.encoding=UTF-8
  
  [junit4] ERROR   0.10s J2 | TestFieldsReader.testExceptions {#1
   seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]} 
  
  [junit4] Throwable #1: java.io.IOException: Simulated network
   outage
  
  [junit4] at
  
 __randomizedtesting.SeedInfo.seed([DFB0B84C4D087DFD:1DE75618D1B7C867]:0)
  
  [junit4] at
  
  
 org.apache.lucene.index.TestFieldsReader$FaultyIndexInput.simOutage(TestFieldsReader.java:156)
  
  [junit4] at
  
  
 org.apache.lucene.index.TestFieldsReader$FaultyIndexInput.readInternal(TestFieldsReader.java:161)
  
  [junit4] at
  
  
 org.apache.lucene.store.BufferedIndexInput.refill(BufferedIndexInput.java:342)
  
  

Re: Odd test failures

2014-09-01 Thread Erick Erickson
Awww, man, do I have to? I didn't write the test, I just accidentally
tripped it by messing up the tests command ;)..

Seriously, thanks! It's always a Good Thing to dive a little deeper,
I'll try to get my head around it today.

Erick


On Mon, Sep 1, 2014 at 6:00 AM, Dawid Weiss dawid.we...@cs.put.poznan.pl
wrote:

 Hi Erick,

 I filed LUCENE-5916 and attached a patch. Check it out and commit it
 in -- I would like you to understand on a concrete example why the
 patched code will work and the previous code didn't. :)

 Dawid


 On Mon, Sep 1, 2014 at 8:24 AM, Dawid Weiss
 dawid.we...@cs.put.poznan.pl wrote:
  Thanks Dawid! So my take-away is that  this is just pilot error on my
 part,
  not something intrinsic to the code.
 
  I don't know enough about the code to say for sure, but to me that
  FaultyIndexInput's count field should be reset before each test
  (shouldn't propagate from test to test, effectively making each test
  rely on the number of tests before it). As for the exception itself,
  I've no idea -- didn't look at the code; I think it may be assuming
  only one iteration.
 
  Dawid
 
 
  Erick
 
 
  On Sun, Aug 31, 2014 at 12:46 PM, Dawid Weiss 
 dawid.we...@cs.put.poznan.pl
  wrote:
 
  It's because the exception is triggered in a static class
  FaultyIndexInput (initialized in a static context
  TestFieldsReader#beforeClass). When you ask for -Dtests.iters, only
  the tests (methods) are duplicated, the static context remains the
  same. So the count variable in FaultyIndexInput is actually
  propagated from test to test and each repetition is not really atomic/
  isolated from others (search for one of recent e-mail to Ryan, it
  contains a deeper information on why and how this works).
 
  You can repeat the failure if you repeat exactly the same seed for
  each repetition (including test methods):
 
  ant test  -Dtestcase=TestFieldsReader
  -Dtests.seed=DFB0B84C4D087DFD:1DE75618D1B7C867 -Dtests.slow=true
  -Dtests.locale=sr_ME -Dtests.timezone=Asia/Kashgar
  -Dtests.file.encoding=UTF-8 -Dtests.iters=10
 
  This yields:
 
  Tests with failures:
- org.apache.lucene.index.TestFieldsReader.testExceptions {#1
  seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
- org.apache.lucene.index.TestFieldsReader.testExceptions {#2
  seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
- org.apache.lucene.index.TestFieldsReader.testExceptions {#3
  seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
- org.apache.lucene.index.TestFieldsReader.testExceptions {#4
  seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
- org.apache.lucene.index.TestFieldsReader.testExceptions {#5
  seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
- org.apache.lucene.index.TestFieldsReader.testExceptions {#6
  seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
- org.apache.lucene.index.TestFieldsReader.testExceptions {#7
  seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
- org.apache.lucene.index.TestFieldsReader.testExceptions {#8
  seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
- org.apache.lucene.index.TestFieldsReader.testExceptions {#9
  seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
 
  Note I included per-method seed in the -Dtests.seed. Also, #0
  iteration *does pass*; the remaining ones fail because of what I said
  above.
 
  Dawid
 
  On Sun, Aug 31, 2014 at 6:20 AM, Erick Erickson 
 erickerick...@gmail.com
  wrote:
   I'm seeing the fairly easily-reproducible error below on trunk.
   Unfortunately it doesn't reproduce with the seed. I'm wondering if
   anyone
   has an inkling what's going on here?
  
   I did manage to notice that I screwed up the command I was
 _intending_
   and
   actually issued the command below, although I have a hard time
 imagining
   that's the problem, unless it's something like running tests.iters on
   the
   full suite makes this happen. No wonder -Dtests.iters=100 didn't
   finish...
   Siii.
  
   ant -Dtestcasae=TestDistributedSearch -Dtests.iters=10 test
  
   Note I spelled 'testcase' as 'testcasae'...
  
  
   Stack trace:
  
  [junit4] Suite: org.apache.lucene.index.TestFieldsReader
  
  [junit4]   2 NOTE: reproduce with: ant test
   -Dtestcase=TestFieldsReader
   -Dtests.method=testExceptions -Dtests.seed=DFB0B84C4D087DFD
   -Dtests.slow=true -Dtests.locale=sr_ME -Dtests.timezone=Asia/Kashgar
   -Dtests.file.encoding=UTF-8
  
  [junit4] ERROR   0.10s J2 | TestFieldsReader.testExceptions {#1
   seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]} 
  
  [junit4] Throwable #1: java.io.IOException: Simulated network
   outage
  
  [junit4] at
  
 __randomizedtesting.SeedInfo.seed([DFB0B84C4D087DFD:1DE75618D1B7C867]:0)
  
  [junit4] at
  
  
 org.apache.lucene.index.TestFieldsReader$FaultyIndexInput.simOutage(TestFieldsReader.java:156)
  
  [junit4] at
  
  
 org.apache.lucene.index.TestFieldsReader$FaultyIndexInput.readInternal(TestFieldsReader.java:161)
  
  [junit4] at
  
  
 org.apache.lucene.store.BufferedIndexInput.refill(BufferedIndexInput.java:342)
  

Re: Odd test failures

2014-09-01 Thread Dawid Weiss
 Just curious, is there any case where you might genuinely need non-final
 static members in a test class?

To be honest you shouldn't have any static initializers at all,
including final fields (unless they're really immutable, simple data
types). The reason for this is that static initializers (including
those for final field assignments) are invoked when the class is
initialized and this may be happening outside of the scope of the test
runner. @BeforeClass or class rules are the way to properly
initialize before-test-suite things.

D.

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



Re: Odd test failures

2014-09-01 Thread Dawid Weiss
 Awww, man, do I have to? I didn't write the test, I just accidentally
 tripped it by messing up the tests command ;)..

Stop moaning, soldier! :)

 Seriously, thanks! It's always a Good Thing to dive a little deeper,
 I'll try to get my head around it today.

You don't *have to*, but it wouldn't hurt if there were two people who
actually understand what happened there. :)

And more seriously, if you could at least commit it to trunk and
backport to 4x it'd still be helpful -- I'll be away (from Lucene)
tomorrow.

Dawid

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



Re: Odd test failures

2014-09-01 Thread Erick Erickson
Dawid:

Sorry, I didn't make it clear that I intended to commit it to both trunk
and 4.x, running full test suite now.

I looked it over and I see what you were talking about. I hadn't looked
before, my error invoking the tests and producing this error was getting in
the way of my _real_ test and I didn't have the energy.

You're totally right, static member vars for _anything_ but simple
immutable data is usually A Bad Thing.

Thanks again!
Erick



On Mon, Sep 1, 2014 at 12:56 PM, Dawid Weiss dawid.we...@cs.put.poznan.pl
wrote:

  Awww, man, do I have to? I didn't write the test, I just accidentally
  tripped it by messing up the tests command ;)..

 Stop moaning, soldier! :)

  Seriously, thanks! It's always a Good Thing to dive a little deeper,
  I'll try to get my head around it today.

 You don't *have to*, but it wouldn't hurt if there were two people who
 actually understand what happened there. :)

 And more seriously, if you could at least commit it to trunk and
 backport to 4x it'd still be helpful -- I'll be away (from Lucene)
 tomorrow.

 Dawid

 -
 To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
 For additional commands, e-mail: dev-h...@lucene.apache.org




Re: Odd test failures

2014-09-01 Thread Dawid Weiss
No big deal, Erick. Thanks for catching this, it wasn't a trivial issue!

Dawid

On Mon, Sep 1, 2014 at 10:16 PM, Erick Erickson erickerick...@gmail.com wrote:
 Dawid:

 Sorry, I didn't make it clear that I intended to commit it to both trunk and
 4.x, running full test suite now.

 I looked it over and I see what you were talking about. I hadn't looked
 before, my error invoking the tests and producing this error was getting in
 the way of my _real_ test and I didn't have the energy.

 You're totally right, static member vars for _anything_ but simple immutable
 data is usually A Bad Thing.

 Thanks again!
 Erick



 On Mon, Sep 1, 2014 at 12:56 PM, Dawid Weiss dawid.we...@cs.put.poznan.pl
 wrote:

  Awww, man, do I have to? I didn't write the test, I just accidentally
  tripped it by messing up the tests command ;)..

 Stop moaning, soldier! :)

  Seriously, thanks! It's always a Good Thing to dive a little deeper,
  I'll try to get my head around it today.

 You don't *have to*, but it wouldn't hurt if there were two people who
 actually understand what happened there. :)

 And more seriously, if you could at least commit it to trunk and
 backport to 4x it'd still be helpful -- I'll be away (from Lucene)
 tomorrow.

 Dawid

 -
 To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
 For additional commands, e-mail: dev-h...@lucene.apache.org



-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



Re: Odd test failures

2014-09-01 Thread Ramkumar R. Aiyengar
On Mon, Sep 1, 2014 at 8:54 PM, Dawid Weiss dawid.we...@cs.put.poznan.pl
wrote:

 To be honest you shouldn't have any static initializers at all,
 including final fields (unless they're really immutable, simple data
 types). The reason for this is that static initializers (including
 those for final field assignments) are invoked when the class is
 initialized and this may be happening outside of the scope of the test
 runner. @BeforeClass or class rules are the way to properly
 initialize before-test-suite things.


I was trying to see if I hack something to see if this can be checked and
realized there's a StaticFieldsInvariantRule set up in LuceneTestCase which
was checking for memory leaks on exactly such fields. So I am guessing we
are still using them a bit :) (and a quick grep confirms the same..)


Re: Odd test failures

2014-09-01 Thread Dawid Weiss
Yes. It's hard to ban it completely; unless it's a constant primitive
an assignment to a field will be moved to a static initializer. I
would personally disallow it, but I can also feel the pain others must
feel when they're forced to @BeforeClass every single thing, however
trivial...

Dawid

On Mon, Sep 1, 2014 at 10:44 PM, Ramkumar R. Aiyengar
andyetitmo...@gmail.com wrote:

 On Mon, Sep 1, 2014 at 8:54 PM, Dawid Weiss dawid.we...@cs.put.poznan.pl
 wrote:

 To be honest you shouldn't have any static initializers at all,
 including final fields (unless they're really immutable, simple data
 types). The reason for this is that static initializers (including
 those for final field assignments) are invoked when the class is
 initialized and this may be happening outside of the scope of the test
 runner. @BeforeClass or class rules are the way to properly
 initialize before-test-suite things.


 I was trying to see if I hack something to see if this can be checked and
 realized there's a StaticFieldsInvariantRule set up in LuceneTestCase which
 was checking for memory leaks on exactly such fields. So I am guessing we
 are still using them a bit :) (and a quick grep confirms the same..)

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



Re: Odd test failures

2014-08-31 Thread Dawid Weiss
It's because the exception is triggered in a static class
FaultyIndexInput (initialized in a static context
TestFieldsReader#beforeClass). When you ask for -Dtests.iters, only
the tests (methods) are duplicated, the static context remains the
same. So the count variable in FaultyIndexInput is actually
propagated from test to test and each repetition is not really atomic/
isolated from others (search for one of recent e-mail to Ryan, it
contains a deeper information on why and how this works).

You can repeat the failure if you repeat exactly the same seed for
each repetition (including test methods):

ant test  -Dtestcase=TestFieldsReader
-Dtests.seed=DFB0B84C4D087DFD:1DE75618D1B7C867 -Dtests.slow=true
-Dtests.locale=sr_ME -Dtests.timezone=Asia/Kashgar
-Dtests.file.encoding=UTF-8 -Dtests.iters=10

This yields:

Tests with failures:
  - org.apache.lucene.index.TestFieldsReader.testExceptions {#1
seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
  - org.apache.lucene.index.TestFieldsReader.testExceptions {#2
seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
  - org.apache.lucene.index.TestFieldsReader.testExceptions {#3
seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
  - org.apache.lucene.index.TestFieldsReader.testExceptions {#4
seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
  - org.apache.lucene.index.TestFieldsReader.testExceptions {#5
seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
  - org.apache.lucene.index.TestFieldsReader.testExceptions {#6
seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
  - org.apache.lucene.index.TestFieldsReader.testExceptions {#7
seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
  - org.apache.lucene.index.TestFieldsReader.testExceptions {#8
seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
  - org.apache.lucene.index.TestFieldsReader.testExceptions {#9
seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}

Note I included per-method seed in the -Dtests.seed. Also, #0
iteration *does pass*; the remaining ones fail because of what I said
above.

Dawid

On Sun, Aug 31, 2014 at 6:20 AM, Erick Erickson erickerick...@gmail.com wrote:
 I'm seeing the fairly easily-reproducible error below on trunk.
 Unfortunately it doesn't reproduce with the seed. I'm wondering if anyone
 has an inkling what's going on here?

 I did manage to notice that I screwed up the command I was _intending_ and
 actually issued the command below, although I have a hard time imagining
 that's the problem, unless it's something like running tests.iters on the
 full suite makes this happen. No wonder -Dtests.iters=100 didn't finish...
 Siii.

 ant -Dtestcasae=TestDistributedSearch -Dtests.iters=10 test

 Note I spelled 'testcase' as 'testcasae'...


 Stack trace:

[junit4] Suite: org.apache.lucene.index.TestFieldsReader

[junit4]   2 NOTE: reproduce with: ant test  -Dtestcase=TestFieldsReader
 -Dtests.method=testExceptions -Dtests.seed=DFB0B84C4D087DFD
 -Dtests.slow=true -Dtests.locale=sr_ME -Dtests.timezone=Asia/Kashgar
 -Dtests.file.encoding=UTF-8

[junit4] ERROR   0.10s J2 | TestFieldsReader.testExceptions {#1
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]} 

[junit4] Throwable #1: java.io.IOException: Simulated network outage

[junit4] at
 __randomizedtesting.SeedInfo.seed([DFB0B84C4D087DFD:1DE75618D1B7C867]:0)

[junit4] at
 org.apache.lucene.index.TestFieldsReader$FaultyIndexInput.simOutage(TestFieldsReader.java:156)

[junit4] at
 org.apache.lucene.index.TestFieldsReader$FaultyIndexInput.readInternal(TestFieldsReader.java:161)

[junit4] at
 org.apache.lucene.store.BufferedIndexInput.refill(BufferedIndexInput.java:342)

[junit4] at
 org.apache.lucene.store.BufferedIndexInput.readBytes(BufferedIndexInput.java:140)

[junit4] at
 org.apache.lucene.store.BufferedIndexInput.readBytes(BufferedIndexInput.java:116)

[junit4] at
 org.apache.lucene.store.BufferedChecksumIndexInput.readBytes(BufferedChecksumIndexInput.java:49)

[junit4] at
 org.apache.lucene.store.DataInput.readString(DataInput.java:234)

[junit4] at
 org.apache.lucene.store.DataInput.readStringStringMap(DataInput.java:263)

[junit4] at
 org.apache.lucene.codecs.lucene46.Lucene46FieldInfosReader.read(Lucene46FieldInfosReader.java:93)

[junit4] at
 org.apache.lucene.index.SegmentReader.readFieldInfos(SegmentReader.java:216)

[junit4] at
 org.apache.lucene.index.SegmentReader.init(SegmentReader.java:97)

[junit4] at
 org.apache.lucene.index.StandardDirectoryReader$1.doBody(StandardDirectoryReader.java:59)

[junit4] at
 org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:795)

[junit4] at
 org.apache.lucene.index.StandardDirectoryReader.open(StandardDirectoryReader.java:50)

[junit4] at
 org.apache.lucene.index.DirectoryReader.open(DirectoryReader.java:64)

[junit4] at
 org.apache.lucene.index.TestFieldsReader.testExceptions(TestFieldsReader.java:209)

[junit4] at java.lang.Thread.run(Thread.java:745)

 [junit4]   2 NOTE: reproduce 

Re: Odd test failures

2014-08-31 Thread Erick Erickson
Thanks Dawid! So my take-away is that  this is just pilot error on my part,
not something intrinsic to the code.

Erick


On Sun, Aug 31, 2014 at 12:46 PM, Dawid Weiss dawid.we...@cs.put.poznan.pl
wrote:

 It's because the exception is triggered in a static class
 FaultyIndexInput (initialized in a static context
 TestFieldsReader#beforeClass). When you ask for -Dtests.iters, only
 the tests (methods) are duplicated, the static context remains the
 same. So the count variable in FaultyIndexInput is actually
 propagated from test to test and each repetition is not really atomic/
 isolated from others (search for one of recent e-mail to Ryan, it
 contains a deeper information on why and how this works).

 You can repeat the failure if you repeat exactly the same seed for
 each repetition (including test methods):

 ant test  -Dtestcase=TestFieldsReader
 -Dtests.seed=DFB0B84C4D087DFD:1DE75618D1B7C867 -Dtests.slow=true
 -Dtests.locale=sr_ME -Dtests.timezone=Asia/Kashgar
 -Dtests.file.encoding=UTF-8 -Dtests.iters=10

 This yields:

 Tests with failures:
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#1
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#2
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#3
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#4
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#5
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#6
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#7
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#8
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}
   - org.apache.lucene.index.TestFieldsReader.testExceptions {#9
 seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]}

 Note I included per-method seed in the -Dtests.seed. Also, #0
 iteration *does pass*; the remaining ones fail because of what I said
 above.

 Dawid

 On Sun, Aug 31, 2014 at 6:20 AM, Erick Erickson erickerick...@gmail.com
 wrote:
  I'm seeing the fairly easily-reproducible error below on trunk.
  Unfortunately it doesn't reproduce with the seed. I'm wondering if anyone
  has an inkling what's going on here?
 
  I did manage to notice that I screwed up the command I was _intending_
 and
  actually issued the command below, although I have a hard time imagining
  that's the problem, unless it's something like running tests.iters on the
  full suite makes this happen. No wonder -Dtests.iters=100 didn't
 finish...
  Siii.
 
  ant -Dtestcasae=TestDistributedSearch -Dtests.iters=10 test
 
  Note I spelled 'testcase' as 'testcasae'...
 
 
  Stack trace:
 
 [junit4] Suite: org.apache.lucene.index.TestFieldsReader
 
 [junit4]   2 NOTE: reproduce with: ant test
 -Dtestcase=TestFieldsReader
  -Dtests.method=testExceptions -Dtests.seed=DFB0B84C4D087DFD
  -Dtests.slow=true -Dtests.locale=sr_ME -Dtests.timezone=Asia/Kashgar
  -Dtests.file.encoding=UTF-8
 
 [junit4] ERROR   0.10s J2 | TestFieldsReader.testExceptions {#1
  seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]} 
 
 [junit4] Throwable #1: java.io.IOException: Simulated network
 outage
 
 [junit4] at
  __randomizedtesting.SeedInfo.seed([DFB0B84C4D087DFD:1DE75618D1B7C867]:0)
 
 [junit4] at
 
 org.apache.lucene.index.TestFieldsReader$FaultyIndexInput.simOutage(TestFieldsReader.java:156)
 
 [junit4] at
 
 org.apache.lucene.index.TestFieldsReader$FaultyIndexInput.readInternal(TestFieldsReader.java:161)
 
 [junit4] at
 
 org.apache.lucene.store.BufferedIndexInput.refill(BufferedIndexInput.java:342)
 
 [junit4] at
 
 org.apache.lucene.store.BufferedIndexInput.readBytes(BufferedIndexInput.java:140)
 
 [junit4] at
 
 org.apache.lucene.store.BufferedIndexInput.readBytes(BufferedIndexInput.java:116)
 
 [junit4] at
 
 org.apache.lucene.store.BufferedChecksumIndexInput.readBytes(BufferedChecksumIndexInput.java:49)
 
 [junit4] at
  org.apache.lucene.store.DataInput.readString(DataInput.java:234)
 
 [junit4] at
  org.apache.lucene.store.DataInput.readStringStringMap(DataInput.java:263)
 
 [junit4] at
 
 org.apache.lucene.codecs.lucene46.Lucene46FieldInfosReader.read(Lucene46FieldInfosReader.java:93)
 
 [junit4] at
 
 org.apache.lucene.index.SegmentReader.readFieldInfos(SegmentReader.java:216)
 
 [junit4] at
  org.apache.lucene.index.SegmentReader.init(SegmentReader.java:97)
 
 [junit4] at
 
 org.apache.lucene.index.StandardDirectoryReader$1.doBody(StandardDirectoryReader.java:59)
 
 [junit4] at
 
 org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:795)
 
 [junit4] at
 
 

Odd test failures

2014-08-30 Thread Erick Erickson
I'm seeing the fairly easily-reproducible error below on trunk.
Unfortunately it doesn't reproduce with the seed. I'm wondering if anyone
has an inkling what's going on here?

I did manage to notice that I screwed up the command I was _intending_ and
actually issued the command below, although I have a hard time imagining
that's the problem, unless it's something like running tests.iters on the
full suite makes this happen. No wonder -Dtests.iters=100 didn't finish...
Siii.

ant -Dtestcasae=TestDistributedSearch -Dtests.iters=10 test

Note I spelled 'testcase' as 'testcasae'...


Stack trace:

   [junit4] Suite: org.apache.lucene.index.TestFieldsReader

   [junit4]   2 NOTE: reproduce with: ant test
 -Dtestcase=TestFieldsReader -Dtests.method=testExceptions
-Dtests.seed=DFB0B84C4D087DFD -Dtests.slow=true -Dtests.locale=sr_ME
-Dtests.timezone=Asia/Kashgar -Dtests.file.encoding=UTF-8

   [junit4] ERROR   0.10s J2 | TestFieldsReader.testExceptions {#1
seed=[DFB0B84C4D087DFD:1DE75618D1B7C867]} 

   [junit4] Throwable #1: java.io.IOException: Simulated network outage

   [junit4] at
__randomizedtesting.SeedInfo.seed([DFB0B84C4D087DFD:1DE75618D1B7C867]:0)

   [junit4] at
org.apache.lucene.index.TestFieldsReader$FaultyIndexInput.simOutage(TestFieldsReader.java:156)

   [junit4] at
org.apache.lucene.index.TestFieldsReader$FaultyIndexInput.readInternal(TestFieldsReader.java:161)

   [junit4] at
org.apache.lucene.store.BufferedIndexInput.refill(BufferedIndexInput.java:342)

   [junit4] at
org.apache.lucene.store.BufferedIndexInput.readBytes(BufferedIndexInput.java:140)

   [junit4] at
org.apache.lucene.store.BufferedIndexInput.readBytes(BufferedIndexInput.java:116)

   [junit4] at
org.apache.lucene.store.BufferedChecksumIndexInput.readBytes(BufferedChecksumIndexInput.java:49)

   [junit4] at
org.apache.lucene.store.DataInput.readString(DataInput.java:234)

   [junit4] at
org.apache.lucene.store.DataInput.readStringStringMap(DataInput.java:263)

   [junit4] at
org.apache.lucene.codecs.lucene46.Lucene46FieldInfosReader.read(Lucene46FieldInfosReader.java:93)

   [junit4] at
org.apache.lucene.index.SegmentReader.readFieldInfos(SegmentReader.java:216)

   [junit4] at
org.apache.lucene.index.SegmentReader.init(SegmentReader.java:97)

   [junit4] at
org.apache.lucene.index.StandardDirectoryReader$1.doBody(StandardDirectoryReader.java:59)

   [junit4] at
org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:795)

   [junit4] at
org.apache.lucene.index.StandardDirectoryReader.open(StandardDirectoryReader.java:50)

   [junit4] at
org.apache.lucene.index.DirectoryReader.open(DirectoryReader.java:64)

   [junit4] at
org.apache.lucene.index.TestFieldsReader.testExceptions(TestFieldsReader.java:209)

   [junit4] at java.lang.Thread.run(Thread.java:745)
[junit4]   2 NOTE: reproduce with: ant test  -Dtestcase=TestFieldsReader
-Dtests.method=testExceptions -Dtests.seed=DFB0B84C4D087DFD
-Dtests.slow=true -Dtests.locale=sr_ME -Dtests.timezone=Asia/Kashgar
-Dtests.file.encoding=UTF-8
   [junit4] ERROR   0.13s J2 | TestFieldsReader.testExceptions {#2
seed=[DFB0B84C4D087DFD:930EC0C4807380AC]} 
   [junit4] Throwable #1: java.io.IOException: Simulated network outage