From owner-freebsd-testing@freebsd.org Wed Apr 26 02:22:55 2017 Return-Path: Delivered-To: freebsd-testing@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7CDC4D4FCB3; Wed, 26 Apr 2017 02:22:55 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qk0-x232.google.com (mail-qk0-x232.google.com [IPv6:2607:f8b0:400d:c09::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3EF8EA49; Wed, 26 Apr 2017 02:22:55 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-qk0-x232.google.com with SMTP id f76so81246756qke.2; Tue, 25 Apr 2017 19:22:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=+cf7DkfaPGHK/kZGSh4y+qCLx/Juvh2LAkdfUwudXfA=; b=dsnPJYgd1wdKa/olZOJEvon/YuzMXAce1KHuUx8+iF6HfYWvw7dtGgtphv7ZUQyGug VUSqXs0Igll3clIQrEQ3SUuwC+xEOjhx2EaRmWVj6yEyx9rJR+KqOhtYQkx2RhukxRZN GhNb4yCYeu/ltVIkI19H1Cb5+mXkgyd/hUP5g9gizWg0GgrLZlLFddxRCW0wNdONr9D/ DgEvgcSBrcABAxv4XQGMy+WMWBnNk53f4slkIBn6pJvU7qdb4A9m2ae/P7J7YQV1YnCB Tfs5gBBa6smz/PkDaNELHc1iBUQWJmdOccydJBN4J9ZdQHEi8VkKtum0dycsRswoUnKL SAnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=+cf7DkfaPGHK/kZGSh4y+qCLx/Juvh2LAkdfUwudXfA=; b=NI6YIwjPKSLzEocOdU0vDwJUU0ZfL1PmIl9nEBeXHhESQ4N6tfS0ToxB1PBJiRbFfB veZzDbZUxAiIXtKBeYu45/KdN15aAJ0+NqVfrPkRI10ra8Tzrvg4pH58vCBg+UTd/IEl wRSF6rTi9FGS/BK53q2KQ3Bjm8WYXGYSOs6p9zUmjk/Ql5QZsW6KG9Vq7iADbiMLObor BjYp8zDR6BRqZUOOxx7Rs63o6TvMr4mM6cupCaHa/4MvojgGC9eE2St0daf8Ajnz5WTg EXWauDTNf/G9pifa+QubZK0hi1DNWJGDywDOWkIqNtVJm891Nlv9E9etdMRT94jvKGPv aHSg== X-Gm-Message-State: AN3rC/5wlSbANhOrcZp4yfoFptEFM6F6enGRdChQRyx7Buu2Klnm6HrC RjvEsY9mVEz1WUVev1PExewx0mexXmll X-Received: by 10.55.127.199 with SMTP id a190mr21761429qkd.123.1493173374248; Tue, 25 Apr 2017 19:22:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.93.83 with HTTP; Tue, 25 Apr 2017 19:22:53 -0700 (PDT) In-Reply-To: <20170425230247.GA8201@spindle.one-eyed-alien.net> References: <20170425230247.GA8201@spindle.one-eyed-alien.net> From: Ngie Cooper Date: Tue, 25 Apr 2017 19:22:53 -0700 Message-ID: Subject: Re: racy tests To: Brooks Davis Cc: "freebsd-hackers@freebsd.org" , Alan Somers , "bdrewery@freebsd.org" , "freebsd-testing@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-testing@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Testing on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 02:22:55 -0000 On Tue, Apr 25, 2017 at 4:02 PM, Brooks Davis wrote: > I've been running the FreeBSD test suite for mips64 under qemu. As a > result, I'm seeing some tests fail due to assumptions about timing producing > test races. For example one of the pwait tests does this: > > timeout_many_body() > { > sleep 1 & > p1=$! > > sleep 5 & > p5=$! > > sleep 10 & > p10=$! > > atf_check \ > -o empty \ > -e empty \ > -s exit:124 \ > timeout --preserve-status 7.5 pwait -t 6 $p1 $p5 $p10 > } > > Under emulation, particularly if the host disks are busy, it's easily > possible for the first sleep to exit before pwait actually runs. > In practice, we could probably get away with cranking up the times a > fair bit, but that would make the test slow and the race would still > exist. > > Any thoughts about the right solution? Something not time based would > be ideal, but then it seems like we'd need a parallel process to kill > some of the waited for victims we quickly end up with something more > complicated than pwait that also needs testing... (Adding bdrewery@, testing@) I need to think about this a bit. The issue might be that we're using the wrong timer for sleep(1)/need to account for being interrupted. Needless to say, emulation really screws up timing assumptions because virtual clocks don't function like hardware clocks. Thanks, -Ngie From owner-freebsd-testing@freebsd.org Thu Apr 27 12:47:09 2017 Return-Path: Delivered-To: freebsd-testing@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B735ED51C21; Thu, 27 Apr 2017 12:47:09 +0000 (UTC) (envelope-from alfred@freebsd.org) Received: from elvis.mu.org (elvis.mu.org [IPv6:2001:470:1f05:b76::196]) by mx1.freebsd.org (Postfix) with ESMTP id A762489; Thu, 27 Apr 2017 12:47:09 +0000 (UTC) (envelope-from alfred@freebsd.org) Received: from Alfreds-MacBook-Pro-2.local (unknown [IPv6:2601:645:8003:a4d6:7598:6ebc:285c:5f89]) by elvis.mu.org (Postfix) with ESMTPSA id 08E4B346DE24; Thu, 27 Apr 2017 05:47:09 -0700 (PDT) Subject: Re: racy tests To: Ngie Cooper , Brooks Davis References: <20170425230247.GA8201@spindle.one-eyed-alien.net> Cc: "freebsd-testing@freebsd.org" , "freebsd-hackers@freebsd.org" , Alan Somers , "bdrewery@freebsd.org" From: Alfred Perlstein Organization: FreeBSD Message-ID: <878d2f79-df2d-0c6c-bd21-c0e663160f45@freebsd.org> Date: Thu, 27 Apr 2017 05:47:11 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-testing@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Testing on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 12:47:09 -0000 Can't something similar to this be done? .(05:40:37)(bright@elvis.mu.org) ~ % mkfifo derp .(05:43:46)(bright@elvis.mu.org) ~ % cat derp & [1] 59244 .(05:43:53)(bright@elvis.mu.org) ~ % ( pwait $! && echo "$?" > ex_status )& [2] 59263 .(05:44:28)(bright@elvis.mu.org) ~ % echo "hi" >> derp && echo "exit status: $(cat ex_status)" hi [2] + done ( pwait $! && echo "$?" > ex_status; ) [1] + done cat derp exit status: 0 Make a fifo, lodge a cat(1) process waiting for data, pwait in the background and stuff pwait's status into a file, then unstick the cat(1) by writing to the fifo, and then read the exit status from pwait from the file? \m/ -Alfred On 4/25/17 7:22 PM, Ngie Cooper wrote: > On Tue, Apr 25, 2017 at 4:02 PM, Brooks Davis wrote: >> I've been running the FreeBSD test suite for mips64 under qemu. As a >> result, I'm seeing some tests fail due to assumptions about timing producing >> test races. For example one of the pwait tests does this: >> >> timeout_many_body() >> { >> sleep 1 & >> p1=$! >> >> sleep 5 & >> p5=$! >> >> sleep 10 & >> p10=$! >> >> atf_check \ >> -o empty \ >> -e empty \ >> -s exit:124 \ >> timeout --preserve-status 7.5 pwait -t 6 $p1 $p5 $p10 >> } >> >> Under emulation, particularly if the host disks are busy, it's easily >> possible for the first sleep to exit before pwait actually runs. >> In practice, we could probably get away with cranking up the times a >> fair bit, but that would make the test slow and the race would still >> exist. >> >> Any thoughts about the right solution? Something not time based would >> be ideal, but then it seems like we'd need a parallel process to kill >> some of the waited for victims we quickly end up with something more >> complicated than pwait that also needs testing... > (Adding bdrewery@, testing@) > I need to think about this a bit. The issue might be that we're using > the wrong timer for sleep(1)/need to account for being interrupted. > > Needless to say, emulation really screws up timing assumptions because > virtual clocks don't function like hardware clocks. > > Thanks, > -Ngie > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > From owner-freebsd-testing@freebsd.org Thu Apr 27 15:29:30 2017 Return-Path: Delivered-To: freebsd-testing@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E345D53480; Thu, 27 Apr 2017 15:29:30 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mailout.stack.nl (mailout05.stack.nl [IPv6:2001:610:1108:5010::202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mailout.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 6A57EC0E; Thu, 27 Apr 2017 15:29:30 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mailout.stack.nl (Postfix) with ESMTP id 39F9E6E; Thu, 27 Apr 2017 17:29:27 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 23C8128497; Thu, 27 Apr 2017 17:29:27 +0200 (CEST) Date: Thu, 27 Apr 2017 17:29:27 +0200 From: Jilles Tjoelker To: Alfred Perlstein Cc: Ngie Cooper , Brooks Davis , "freebsd-testing@freebsd.org" , "freebsd-hackers@freebsd.org" , Alan Somers , "bdrewery@freebsd.org" Subject: Re: racy tests Message-ID: <20170427152926.GA88843@stack.nl> References: <20170425230247.GA8201@spindle.one-eyed-alien.net> <878d2f79-df2d-0c6c-bd21-c0e663160f45@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <878d2f79-df2d-0c6c-bd21-c0e663160f45@freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: freebsd-testing@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Testing on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 15:29:30 -0000 On Thu, Apr 27, 2017 at 05:47:11AM -0700, Alfred Perlstein wrote: > Can't something similar to this be done? > .(05:40:37)(bright@elvis.mu.org) > ~ % mkfifo derp > .(05:43:46)(bright@elvis.mu.org) > ~ % cat derp & > [1] 59244 > .(05:43:53)(bright@elvis.mu.org) > ~ % ( pwait $! && echo "$?" > ex_status )& > [2] 59263 > .(05:44:28)(bright@elvis.mu.org) > ~ % echo "hi" >> derp && echo "exit status: $(cat ex_status)" > hi > [2] + done ( pwait $! && echo "$?" > ex_status; ) > [1] + done cat derp > exit status: 0 > Make a fifo, lodge a cat(1) process waiting for data, pwait in the > background and stuff pwait's status into a file, then unstick the > cat(1) by writing to the fifo, and then read the exit status from > pwait from the file? Fifos are indeed a good idea. They are used various times in the /bin/sh tests, which should not wait for any sleeps in successful test runs (my main motivation for this is to be able to run the whole suite in a few seconds). In this case, however, the -t option being tested is inherently related to time. It would be possible to cheat by passing a very long timeout and cut it short by sending SIGALRM using kill (which depends on the concrete implementation). -- Jilles Tjoelker From owner-freebsd-testing@freebsd.org Thu Apr 27 15:36:03 2017 Return-Path: Delivered-To: freebsd-testing@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72C0CD53775; Thu, 27 Apr 2017 15:36:03 +0000 (UTC) (envelope-from alfred@freebsd.org) Received: from elvis.mu.org (elvis.mu.org [IPv6:2001:470:1f05:b76::196]) by mx1.freebsd.org (Postfix) with ESMTP id 6265D10DE; Thu, 27 Apr 2017 15:36:03 +0000 (UTC) (envelope-from alfred@freebsd.org) Received: from [IPv6:2601:645:8003:a4d6:957:888b:2ca8:bdba] (unknown [IPv6:2601:645:8003:a4d6:957:888b:2ca8:bdba]) by elvis.mu.org (Postfix) with ESMTPSA id 8383F346DE24; Thu, 27 Apr 2017 08:35:57 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (1.0) Subject: Re: racy tests From: Alfred Perlstein X-Mailer: iPhone Mail (14E304) In-Reply-To: <20170427152926.GA88843@stack.nl> Date: Thu, 27 Apr 2017 08:35:57 -0700 Cc: Ngie Cooper , Brooks Davis , "freebsd-testing@freebsd.org" , "freebsd-hackers@freebsd.org" , Alan Somers , "bdrewery@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <9478F48E-4619-49F2-A9D8-34335C4A13AA@freebsd.org> References: <20170425230247.GA8201@spindle.one-eyed-alien.net> <878d2f79-df2d-0c6c-bd21-c0e663160f45@freebsd.org> <20170427152926.GA88843@stack.nl> To: Jilles Tjoelker X-BeenThere: freebsd-testing@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Testing on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 15:36:03 -0000 > On Apr 27, 2017, at 8:29 AM, Jilles Tjoelker wrote: >=20 >> On Thu, Apr 27, 2017 at 05:47:11AM -0700, Alfred Perlstein wrote: >> Can't something similar to this be done? >=20 >> .(05:40:37)(bright@elvis.mu.org) >> ~ % mkfifo derp >> .(05:43:46)(bright@elvis.mu.org) >> ~ % cat derp & >> [1] 59244 >> .(05:43:53)(bright@elvis.mu.org) >> ~ % ( pwait $! && echo "$?" > ex_status )& >> [2] 59263 >> .(05:44:28)(bright@elvis.mu.org) >> ~ % echo "hi" >> derp && echo "exit status: $(cat ex_status)" >> hi >> [2] + done ( pwait $! && echo "$?" > ex_status; ) >> [1] + done cat derp >> exit status: 0 >=20 >> Make a fifo, lodge a cat(1) process waiting for data, pwait in the >> background and stuff pwait's status into a file, then unstick the >> cat(1) by writing to the fifo, and then read the exit status from >> pwait from the file? >=20 > Fifos are indeed a good idea. They are used various times in the /bin/sh > tests, which should not wait for any sleeps in successful test runs (my > main motivation for this is to be able to run the whole suite in a few > seconds). >=20 > In this case, however, the -t option being tested is inherently related > to time. It would be possible to cheat by passing a very long timeout > and cut it short by sending SIGALRM using kill (which depends on the > concrete implementation). Makes sense. I was worried this was the case but I couldn't find any useful d= ocs on atf commands via google and man(3) on a 10.3 system. Thank you, your i= dea makes sense.=20 >=20 > --=20 > Jilles Tjoelker >=20