Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Race condition in t/issue32.t #60

Open
eserte opened this issue Jan 11, 2020 · 1 comment
Open

Race condition in t/issue32.t #60

eserte opened this issue Jan 11, 2020 · 1 comment

Comments

@eserte
Copy link
Contributor

eserte commented Jan 11, 2020

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
@skaji
Copy link
Member

skaji commented Jan 13, 2020

Currently HTTP-Cookies does not store expires. Instead, convert it into max-age, and stores max-age.

To fix this race, I think we should store expires too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants