Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70123 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46478 invoked from network); 14 Nov 2013 19:59:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Nov 2013 19:59:57 -0000 Authentication-Results: pb1.pair.com header.from=adam@adamharvey.name; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=adam@adamharvey.name; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain adamharvey.name designates 209.85.219.50 as permitted sender) X-PHP-List-Original-Sender: adam@adamharvey.name X-Host-Fingerprint: 209.85.219.50 mail-oa0-f50.google.com Received: from [209.85.219.50] ([209.85.219.50:41840] helo=mail-oa0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 67/11-40965-CBB25825 for ; Thu, 14 Nov 2013 14:59:57 -0500 Received: by mail-oa0-f50.google.com with SMTP id k1so2822979oag.37 for ; Thu, 14 Nov 2013 11:59:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamharvey.name; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=NFpMPFbGU7Za6X6NjXVScD4sIvVyo0jNwX/9qsvoGnY=; b=xY8RuOewDHSk1exUFJoOFacsgmClSTCZlDxI/RYtk2mOFAJL1oskuHAhq07HdEVq/B f+tSWvjSDmos68IffpaAKBWkD1dpdqReW1oSTrrl8CcyvE0dIQ8pt1gHH0AmAag59a2V DGL4x4sl2MZzoB8ttdj8wYsAJjY4CR8nJ+C3c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=NFpMPFbGU7Za6X6NjXVScD4sIvVyo0jNwX/9qsvoGnY=; b=JRA3X4fEpW6yTtmXbf8heKAInHlZE9TnbZxr1F65X7LRFWWpGwylTezMg3lYGM/yfp p/gwVasyArR5j/ybYp5vEOCkai8ujUg1fmNTWYuVUSOiDkn32kb47fr3jRZIYQ0gZvzl t0EZCCjVYomaCctk5XuPp84R00nZZuotgnPOBRJtNDZr6QOVPwMlA9d5fqbOr57zACDi hVIxI+ZmboJXk2IBZ8n2UHDgfLwKk0WlpA9lWGZ6vPi9QudKAwg6iyEBu/ZdkUwNGkit pFsYUZ+3S2fgY2DiS/VeOa/JJevasRjtdH+YWmwbteysDbxMgl0J5XXLfyVvwcB+If4g 289w== X-Gm-Message-State: ALoCoQk0el2yxwbtwnCz2ItGJhdwhQ4alq9tLrrTZ38fNv4aw8UafAtI13TX+YH1yFagxnGQ3W03 X-Received: by 10.60.157.2 with SMTP id wi2mr3236238oeb.35.1384459193246; Thu, 14 Nov 2013 11:59:53 -0800 (PST) MIME-Version: 1.0 Sender: adam@adamharvey.name Received: by 10.76.178.161 with HTTP; Thu, 14 Nov 2013 11:59:32 -0800 (PST) In-Reply-To: References: Date: Thu, 14 Nov 2013 11:59:32 -0800 X-Google-Sender-Auth: e7zjocO3FcBqSPd-9Y5Y6xTByVo Message-ID: To: Yasuo Ohgaki Cc: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Session cache, lock and write From: aharvey@php.net (Adam Harvey) On 14 November 2013 11:42, Yasuo Ohgaki wrote: > It can ignore writing session data when session data is not changed. > It also can remove reading session data by caching as most web > servers support keep alive. Current session save handlers lock > session data, but it could be unlocked. How do you propose to check if session data was changed? For scalar types it's pretty easy, but it's possible for objects to alter their properties (including the ones they're persisting) on __wakeup() =E2=80=94 = I presume it would effectively be a comparison of what's about to be written versus what was read initially when it comes time to write the session? > Session module could have ini settings > - session.lock =3D On/Off (On by default. Some save handlers already hav= e > this) I've got some concerns on this. I agree that it's a real issue =E2=80=94 we= do get support issues in ##php caused by people attempting to concurrently access open file sessions, for instance =E2=80=94 but I'm worr= ied that this might be a shoot-yourself-in-the-foot option if we're not careful. I'm thinking mostly of the files handler here: I presume there would still be locking around initial read and write operations? Also, as you note, there also isn't any requirement for session handlers to implement locking right now: if I'm implementing a custom session handler that doesn't require locking, do I just ignore this setting if it's not relevant? It seems slightly odd having it in the session.* namespace if it's really only relevant for files. I wonder if a better approach would be to implement an improved files handler (under a different name) that had options for locking, caching and the like. Say it was called "awesome_files"[0]; you might have options like this: session.save_handler =3D awesome_files session.awesome_files.lock =3D On/Off I'd love to have a more flexible files handler, but I don't think we want to overspecialise the session implementation around it. Adam