)]}' { "commit": "f01914949b6130466357ee17eebc63d7dd0b7a62", "tree": "6fc5bc99826269d6b8bed94fff2e081b2b419bd7", "parents": [ "6311437cf425a3e3b523aa5c532689833c14a5b4" ], "author": { "name": "Hugo Arès", "email": "hugo.ares@ericsson.com", "time": "Thu Aug 27 13:57:39 2015 -0400" }, "committer": { "name": "Hugo Arès", "email": "hugo.ares@ericsson.com", "time": "Thu Aug 27 14:25:26 2015 -0400" }, "message": "Use atomic move to rename the session file\n\nWhen a session is written to disk, it\u0027s done in a temporary file and\nthen renamed (moved) to its final name. This rename was done in 2\noperations (or 3 if file already exist and need to be deleted first),\ncopy then delete.\n\nMake use of the ATOMIC_MOVE option to prevent multiple operations but\nmainly to fix a concurrency issue which leads to a NoSuchFileException.\n\nWhen user is first login in, it\u0027s not possible to have 2 concurrent\nrequests trying to write the same session file but when session is one\nhour old or reached half of its max age, the next http request will\nrefresh the session. Then it\u0027s possible that 2 (or more) concurrent\nrequests end up trying to rename their temp file to the same session\nfile.\n\nSince the move was not an atomic operation, the first request was\ndeleting session file in order to rename its temp file but right after\nthe delete and before the temp one was renamed, the second request also\nwas also trying to delete the session file and it was failing with\nNoSuchFileException.\n\nChange-Id: I8b045244e4fb3062401ce916d7cae33f255413bf\n", "tree_diff": [ { "type": "modify", "old_id": "23aa194f59be0be69d4532d39e097de241100a9e", "old_mode": 33188, "old_path": "src/main/java/com/googlesource/gerrit/plugins/websession/flatfile/FlatFileWebSessionCache.java", "new_id": "8d12bb2526099ca50e3e495b95059568fc8d5891", "new_mode": 33188, "new_path": "src/main/java/com/googlesource/gerrit/plugins/websession/flatfile/FlatFileWebSessionCache.java" } ] }