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
Invalid JSON in FileCookieJar #1883
Comments
Concurrent writes might lead to invalid JSON being saved in the cookie jar. Hopefully fixes guzzle#1883 .
This exact same thing happened to me too. Also the extra |
I'm not sure I tried it on a production system, maybe you can try it? |
I'm monitoring if it happens again (only happened once so far) and will try it if that's the case. |
I think #2335 should fix this issue. |
It's a backport of #1884 that I wrote a long time ago, so I think the issue is fixed. Let's close this and see if people reopen. |
Actual Behavior
Invalid json is saved in the file used as backend for
FileCookieJar
. I have had this issue in the past with what might be another version, I remember there were 2 extra brackets at the end of the file. I experienced the issue today again, but I arrived too late to see the invalid contents, which had already been replaced (which kind of makes me think that there might have been many concurrent writes). I know it was invalid because I got: Unable to parse JSON data: JSON_ERROR_SYNTAX - Syntax error, malformed JSON and it came from here.Expected Behavior
A cookie jar containing valid JSON
Steps to Reproduce
I'm not sure how to reproduce this, I think it might happen with many concurrent writes.
Possible Solutions
Just prevent concurrent writes:
The text was updated successfully, but these errors were encountered: