From c5f92afc3be50dfe1463e61f704387f6e5e5b8e2 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sun, 28 Aug 2016 13:44:04 -0700 Subject: [PATCH] Set the WRITE_SYNC flag for SessionBackend writes Session writes should be seen in all datacenters so users do not randomly end up logged on the next page view on a GET request after login. Sticky DC cookies help, but not for cross domain redirects or page views. Change-Id: Id533fa1b867680e6386060efa4878ad1b4638c18 --- includes/session/SessionBackend.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/session/SessionBackend.php b/includes/session/SessionBackend.php index 264e1ae0ef..0439b36d48 100644 --- a/includes/session/SessionBackend.php +++ b/includes/session/SessionBackend.php @@ -716,6 +716,8 @@ final class SessionBackend { } } + $flags = $this->persist ? 0 : CachedBagOStuff::WRITE_CACHE_ONLY; + $flags |= CachedBagOStuff::WRITE_SYNC; // write to all datacenters $this->store->set( wfMemcKey( 'MWSession', (string)$this->id ), [ @@ -723,7 +725,7 @@ final class SessionBackend { 'metadata' => $metadata, ], $metadata['expires'], - $this->persist ? 0 : CachedBagOStuff::WRITE_CACHE_ONLY + $flags ); $this->metaDirty = false; -- 2.20.1