Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 25241 invoked from network); 6 Mar 2008 17:04:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Mar 2008 17:04:52 -0000 Received: (qmail 20161 invoked by uid 500); 6 Mar 2008 17:04:48 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 20125 invoked by uid 500); 6 Mar 2008 17:04:47 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 20116 invoked by uid 99); 6 Mar 2008 17:04:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Mar 2008 09:04:47 -0800 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [69.147.64.94] (HELO smtp121.sbc.mail.sp1.yahoo.com) (69.147.64.94) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 06 Mar 2008 17:04:00 +0000 Received: (qmail 75059 invoked from network); 6 Mar 2008 17:04:20 -0000 Received: from unknown (HELO ?192.168.254.144?) (ddebrunner@sbcglobal.net@75.24.208.212 with plain) by smtp121.sbc.mail.sp1.yahoo.com with SMTP; 6 Mar 2008 17:04:19 -0000 X-YMail-OSG: f_9smhgVM1lbf82l_fmvZmRNB7aJdoIuT7Z43TRarea4iloLFv7MKiCfr5DZRr7WOfURNIemNx3HbCDjP31vkan_e0c1Hp29iHd8MD3Snp01dFWCmu0u7HPlswOW X-Yahoo-Newman-Property: ymail-3 Message-ID: <47D02416.9030104@apache.org> Date: Thu, 06 Mar 2008 09:04:22 -0800 From: Daniel John Debrunner User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: derby-dev Subject: NetworkServerTestSetup issues with starting server as a separate process Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org I hit very strange timeouts waiting for the network server to start when running the jmx management suite. The test does this: 1) start network server within same vm 2) run some tests 3) stop network server 4) start network server as separate process 5) run some tests 6) stop network server The test was failing in step 4, waiting for the server to come up. These timeouts have been blamed in the past on TCP/IP behaviour, delay on the socket becoming free again. I don't see how this can be the case as I could run this test multiple times, right after each other and steps 1-3 always worked and step 4 always failed, thus showing the 1527 port was available for re-use. Indeed when this complete suite runs successfully the network server is started and stopped over 20 times in 12 seconds, seemingly showing there's no issue in re-using a port. Even stranger was on the same machine one codeline was not having any issues while another was seeing the timeout. The timeouts continued after a re-boot and then after I added some debugging they went away and have not re-appeared. Looking at the separate process code in NetworkServerTestSetup it does have some issues, one coding and one design: - The streams for the processed are not handled correctly which can cause the process to block, which would cause a timeout. Thus if for some reason the server does produce more output than normal it could hang thus leading to timeouts. Since the streams are not handled correctly the extra output is never seen making debugging this intermittent problem hard. - The server is booted without setting derby.system.home. For the vm running the junit tests derby.system.home=${user.dir}/system. Since d.s.h is not set the server is running with a system home of user.dir. I think this explains the wombat database appearing in the current directory when running junit tests. I'm not sure if this intended when this decorator was added, the concept of the system folder was to have all Derby databases beneath that folder. Of course if d.s.h is set to ${user.dir}/system for the spawned server then we have two jvms accessing the same system and poentially the same databases. There are three possible solutions to this: a) Set d.s.h to ${user.dir}/system but shutdown Derby in the test vm before starting the separate server. b) Set d.s.h to ${user.dir}/ns (a different sub-folder) and ensure tests wrapped in this decorator only use databases under d.s.h. c) Leave it as-is, d.s.h defaults to ${user.dir} which leaves a wombat in the current folder. Wiki page on junit folders ... http://wiki.apache.org/db-derby/DerbyJunitTestConfiguration?#head-af5a240fccda5c96f104776dfbd20a8cabde55e0 Dan.