Hi,

I just re-opened Derby-205 with a patch to solve this problem.  See
comments there. Kathey included a caveat for this phenomenon in her
list of "things to watch out for when making patches" in another
thread.

Dag

>>>>> "A" == Army  <[EMAIL PROTECTED]> wrote:
A> 
A> As part of the patch for DERBY-205, a new test called 
"lang/errorStream.java" 
A> was added to the Derby test package (svn revision 179584).
A> 
A> When I run this test against a local codeline, I seem to be seeing 
intermittent 
A> failures because two lines in the output file are printed out of order.
A> 
A> 23a24
A>  > xxxxxxFILTERED-TIMESTAMPxxxxxGMT Thread[main,5,main] 
A> java.lang.NoSuchFieldException: nonExistingFieldStream
A> 25d25
A> < xxxxxxFILTERED-TIMESTAMPxxxxxGMT Thread[main,5,main] 
A> java.lang.NoSuchFieldException: nonExistingFieldStream
A> 
A> The Derby harness takes output from System.err and System.out and prints 
them 
A> both to the test output file, so usually, when diffs like this occur, it's 
A> because the two streams (System.out and System.err) are overlapping.
A> 
A> With that in mind I started looking at the errorStream.java test and I 
noticed 
A> that, for the negative test cases (ex. "checkWrongField"), since the target 
A> stream/method/file doesn't exist (which is intentional), the default error 
A> stream ends up being System.err (at least, that's what the comments at the 
top 
A> of the test say).  At the same time, the call to shutdown Derby in these 
same 
A> test cases leads to a "shutdown ok" message being printed to System.out.
A> 
A> My theory, then, is that the error messages from the negative test cases 
(which 
A> are going to System.err) are overlapping arbitrarily with the "shutdown ok" 
A> message (which is going to System.out) and the result is an intermittent 
diff 
A> (because the overlapping output isn't consistent).  At least, that would 
explain 
A> the intermittent diff that I'm seeing.
A> 
A> As a proof of concept, I changed the "System.out" that is in the 
shutdownDerby() 
A> method to be "System.err", thus forcing both the negative test case messages 
and 
A> the "shutdown ok" messages to the same stream, which in turn means that they 
A> will always show up in the same order w.r.t each other, and thus the 
A> intermittent diff _should_ go away.
A> 
A> After making this change, the intermittent diff that I was seeing did in 
fact go 
A> away--but then I saw another one caused by the "Test errorStream finished 
A> successfully" message.  The same theory applies there: this message is 
printed 
A> to System.out right after the final derbyShutdown() method is called, and 
since 
A> I changed the "shutdown ok" message to print to System.err, that means that 
it 
A> was intermittently overlapping with the "finished successfully" message.  I 
then 
A> fixed this problem by changing the "finished successfully" method to print 
to 
A> System.err, as well.
A> 
A> All of that said, I think I've found the cause of the problem (System.err 
and 
A> System.out are overlapping), but I'm not sure what the best solution is.  It 
A> seems like changing the "shutdown ok", "finished successfully", and "Test 
A> errorStream starting" (just to be safe) messages to use System.err would 
solve 
A> the problem, but that's not a very intuitive solution.  A better fix would 
be to 
A> somehow change the 'default error stream' (for cases when an error 
A> file/method/field doesn't exist) to be System.out--but is that even 
possible??
A> 
A> If anyone has any input here, please do speak up (it's quite possible I'm 
A> missing something).  Otherwise, though it's not very intuitive, we might 
need to 
A> change the above-mentioned messages to all print to System.err in order to 
avoid 
A> the intermittent diff(s)...
A> 
A> Comments?
A> Army
A> 
-- 
Dag H. Wanvik
Sun Microsystems, Web Services, Database Technology Group
Haakon VII gt. 7b, N-7485 Trondheim, Norway
Tel: x43496/+47 73842196, Fax:  +47 73842101

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
NOTICE: This email message is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact
the sender by reply email and destroy all copies of the original
message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

Reply via email to