Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70134 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64326 invoked from network); 14 Nov 2013 21:27:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Nov 2013 21:27:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.48 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.215.48 mail-la0-f48.google.com Received: from [209.85.215.48] ([209.85.215.48:54760] helo=mail-la0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EE/62-53459-42045825 for ; Thu, 14 Nov 2013 16:27:01 -0500 Received: by mail-la0-f48.google.com with SMTP id n7so2093763lam.35 for ; Thu, 14 Nov 2013 13:26:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=c7j6QvtdxQDQrA8Hcf7faz32wzKxHlzpXbztG5+WBYc=; b=w/Hj0KcvmZEgzXjN5moaEZ2oJYahshFtlvo2+j9rSIXVdIIYF1iDKC0cF8Ax79Q7Q4 HNkaJ+QPyq03Hk34Px71yE7Am3KpXOh+a0zMrSLR/p5WsEpP6LVnVfYsAA46Z4OabqTM 31cOzPsdKfiflKkOLdtvO6vD/OLvD36pXq1HkFvqdIRi9rVBpt+IstcFE6B4uUMrtKJm Ac8eeKl4xyRdta4tlLaBgFGB+4G2g73QS/sz5ym+trrrFNPRzBqJjOAvbvnxrZJeNtlJ hohJqWHx4DRqBBAlMzE/WI6UBK83jIZrJfTMntb2zwO0cSSz/+x5oCeMGqWIJgfWUZ6L +uIg== X-Received: by 10.112.159.231 with SMTP id xf7mr1921637lbb.18.1384464417959; Thu, 14 Nov 2013 13:26:57 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.112.154.201 with HTTP; Thu, 14 Nov 2013 13:26:17 -0800 (PST) In-Reply-To: <52853E69.5040104@sugarcrm.com> References: <5285390D.6000106@sugarcrm.com> <52853E69.5040104@sugarcrm.com> Date: Fri, 15 Nov 2013 06:26:17 +0900 X-Google-Sender-Auth: 5CspbnobVt18M0oyMgZ2hJHptNA Message-ID: To: Stas Malyshev Cc: Adam Harvey , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a11c3c4fed6341104eb29bdbb Subject: Re: [PHP-DEV] Session cache, lock and write From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a11c3c4fed6341104eb29bdbb Content-Type: text/plain; charset=UTF-8 Hi Stas, On Fri, Nov 15, 2013 at 6:19 AM, Stas Malyshev wrote: > > I think you've wrote this before I sent new mail. For files save handler, > > when session.lock=Off, it will be > > > > open-and-lock -> read session data -> close-and-unlock -> > > script executed > > -> open-and-lock -> write session data -> close-and-unlock > > I don't think this is a very good idea, since what happens if somebody > else changed the state while script was executing? That change would be > killed by the write. The lock is not for writing, the lock is for data > consistency between reading in writing. If you gave up the lock, you > should not write afterwards because your data may be stale. > > > would not be a problem with write short circuit, since unchanged session > > data is not written to session storage. User has to know what session > > module is doing well to avoid problems, though. > > That's exactly the problem. Using this method would mean anything you > write to a session can magically vanish and you wouldn't have any idea > why, just because some other script was executing at the same time and > have overwritten your data. "Read and never write" is OK, but read and > then write without locking is very dangerous. I agree. This behavior could be dangerous just like SQL without transaction. Therefore, only users know what they are doing should use. It's dangerous, but if user know what they are doing, it could be safe and application runs faster. This should be documented well. IMO. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a11c3c4fed6341104eb29bdbb--