Skip to content

Race condition in t/issue32.t #60

@eserte

Description

@eserte

One of my smoker reported the following failure:

#   Failed test at t/issue32.t line 17.
#          got: 'Set-Cookie3: a="b;c;\"d"; path="/"; domain=example.com; path_spec; expires="2021-11-06 08:58:35Z"; version=0
# '
#     expected: 'Set-Cookie3: a="b;c;\"d"; path="/"; domain=example.com; path_spec; expires="2021-11-06 08:58:34Z"; version=0
# '
# Looks like you failed 1 test of 3.
t/issue32.t ............ 
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/3 subtests 

It's almost not reproducible unless an artifical delay is introduced in extract_cookies, e.g. like this:

--- ../lib/HTTP/Cookies.pm      2020-01-11 12:13:42.133285382 +0100
+++ lib/HTTP/Cookies.pm 2020-01-11 12:14:53.672458289 +0100
@@ -211,6 +211,7 @@
        # can for instance contain an unquoted "," in the expires
        # field, so we have to use this ad-hoc parser.
        my $now = time();
+sleep 1;
 
        # Build a hash of cookies that was present in Set-Cookie2
        # headers.  We need to skip them if we also find them in a

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions