[DTrace-devel] [PATCH] test: fix exit race condition

Kris Van Hees kris.van.hees at oracle.com
Thu Apr 21 14:31:32 UTC 2022


I think that the subject is misleading.  This patch is not fixing a race
condition - it is merely handling modifying tests to handle the (apparently
valid) race condition related to exit().  So how about:

	test: handle concurrent firing probes with exit()

Other than that:

	Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>	

On Tue, Jan 04, 2022 at 12:53:25PM -0500, eugene.loh--- via DTrace-devel wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
> 
> A few tests have profile probes that emit an expected message and then
> exit.  The problem with this is that it is possible for two such probes,
> on different CPUs, to fire "concurrently."  DTrace says that when exit()
> occurs, other actions already in progress on other CPUs complete.
> 
> Fix the tests to allow for more than one instance of the expected
> message.  Note that this is a race condition.  The problem being fixed
> was observed only intermittently.  In some test runs, the failure was
> seen only 3% of the time with tst.ZeroProviderProbes.sh and only 0.06%
> of the time with tst.ZeroFunctionProbes.sh.
> 
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
> ---
>  test/unittest/dtrace-util/tst.ZeroFunctionProbes.r  | 1 +
>  test/unittest/dtrace-util/tst.ZeroFunctionProbes.sh | 2 +-
>  test/unittest/dtrace-util/tst.ZeroProviderProbes.r  | 1 +
>  test/unittest/dtrace-util/tst.ZeroProviderProbes.sh | 2 +-
>  4 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/test/unittest/dtrace-util/tst.ZeroFunctionProbes.r b/test/unittest/dtrace-util/tst.ZeroFunctionProbes.r
> index 0f2e1aac..ceb0beaa 100644
> --- a/test/unittest/dtrace-util/tst.ZeroFunctionProbes.r
> +++ b/test/unittest/dtrace-util/tst.ZeroFunctionProbes.r
> @@ -1 +1,2 @@
>  I am done
> +
> diff --git a/test/unittest/dtrace-util/tst.ZeroFunctionProbes.sh b/test/unittest/dtrace-util/tst.ZeroFunctionProbes.sh
> index 3e2221a0..8924bee5 100755
> --- a/test/unittest/dtrace-util/tst.ZeroFunctionProbes.sh
> +++ b/test/unittest/dtrace-util/tst.ZeroFunctionProbes.sh
> @@ -26,7 +26,7 @@ fi
>  dtrace=$1
>  
>  $dtrace $dt_flags -qZf wassup'{printf("Iamkool");}' \
> --qf read'{printf("I am done"); exit(0);}'
> +-qf read'{printf("I am done\n"); exit(0);}' | uniq
>  
>  status=$?
>  
> diff --git a/test/unittest/dtrace-util/tst.ZeroProviderProbes.r b/test/unittest/dtrace-util/tst.ZeroProviderProbes.r
> index 0f2e1aac..ceb0beaa 100644
> --- a/test/unittest/dtrace-util/tst.ZeroProviderProbes.r
> +++ b/test/unittest/dtrace-util/tst.ZeroProviderProbes.r
> @@ -1 +1,2 @@
>  I am done
> +
> diff --git a/test/unittest/dtrace-util/tst.ZeroProviderProbes.sh b/test/unittest/dtrace-util/tst.ZeroProviderProbes.sh
> index 63d1ab8b..a7f36959 100755
> --- a/test/unittest/dtrace-util/tst.ZeroProviderProbes.sh
> +++ b/test/unittest/dtrace-util/tst.ZeroProviderProbes.sh
> @@ -24,7 +24,7 @@ fi
>  dtrace=$1
>  
>  $dtrace $dt_flags -qZP wassup'{printf("Iamkool");}' \
> --qP profile'{printf("I am done"); exit(0);}'
> +-qP profile'{printf("I am done\n"); exit(0);}' | uniq
>  
>  status=$?
>  
> -- 
> 2.18.4
> 
> 
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel



More information about the DTrace-devel mailing list