Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:86758 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88536 invoked from network); 19 Jun 2015 13:32:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jun 2015 13:32:42 -0000 Authentication-Results: pb1.pair.com smtp.mail=are.you.winning@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=are.you.winning@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.177 as permitted sender) X-PHP-List-Original-Sender: are.you.winning@gmail.com X-Host-Fingerprint: 209.85.212.177 mail-wi0-f177.google.com Received: from [209.85.212.177] ([209.85.212.177:33581] helo=mail-wi0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CB/D1-11390-9F914855 for ; Fri, 19 Jun 2015 09:32:41 -0400 Received: by wibee9 with SMTP id ee9so9823781wib.0 for ; Fri, 19 Jun 2015 06:32:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:content-type; bh=tRUAfjPhTACvJZciguGKmqtj88r/1H7D/SEpGY+db8A=; b=cWXbVfI2HXnM+B1zyfUYlYlrUW+6lNJsVdXtJqLru5Jf+M9BWeb+Fmomlu6viCXTV2 NoFADe9BrW3r1zFpVw6B5Nrg9zATGTkkOYJykG7cdtieFNYe7l9pzCi9S39tvjZXOsTE 6hxEdA//WCRNocyfijWqb5X9W+miZU8BGY6bh4/wUaOcpSn2f+xAJE5scJHFhARjRL3K A5Ze3o6B6ObtZS63QWrm5QS1YEShv6IJ8DBANCcIw8KY4/mIPh0m9ExmZiTgSTXpJHt/ JBkoT5yRy0Yg2KOljKGzzMI/XP78PYFjl8msJu6eF1JqxpuarWYyBwUA0OlD5ooJdbDJ Q4ew== MIME-Version: 1.0 X-Received: by 10.180.105.129 with SMTP id gm1mr6462867wib.51.1434720758487; Fri, 19 Jun 2015 06:32:38 -0700 (PDT) Sender: are.you.winning@gmail.com Received: by 10.180.186.103 with HTTP; Fri, 19 Jun 2015 06:32:38 -0700 (PDT) In-Reply-To: <55840E5D.1090809@php.net> References: <55840E5D.1090809@php.net> Date: Fri, 19 Jun 2015 14:32:38 +0100 X-Google-Sender-Auth: 2Bs5SI_vE06NjlCD2lhIoJWoFv8 Message-ID: To: PHP Internals List Content-Type: multipart/alternative; boundary=f46d04182626295fbe0518def58d Subject: Re: [PHP-DEV] PHP-FPM: How to clear the realpath cache on deployment? From: cw@daverandom.com (Chris Wright) --f46d04182626295fbe0518def58d Content-Type: text/plain; charset=UTF-8 On 19 June 2015 at 13:43, Sebastian Bergmann wrote: > Scenario: nginx + PHP-FPM / FastCGI. > > The final step of the deployment is updating a symlink to point to the > new version. > > For N <= realpath_cache_ttl seconds after the deployment, some > filesystem operations fail because of outdated realpath cache entries. > > Is there a way to signal the PHP-FPM / FastCGI processes to clear > the realpath cache? If not, I think this should be added :-) > > Thanks! > Sebastian > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > (repeating on-list so it's public) While I agree that having a way to signal fpm to reset itself would be a good thing (I'm thinking something closer to the nginx "reload" op, where the config file is reloaded and all state is reset, but currently processing requests are allowed to complete before the workers are killed etc) a decent work-around is just to have two separate fpm pools and using nginx reload to do the switch instead of re-pointing a symlink. Assuming interval_between_deployments < realpath_cache_ttl, this would make the problem self-correcting. This is probably preferable in other ways too, for example you might get some weirdness if you repoint a symlink to the src in the middle of a request and some classes from the old version are already loaded, and the autoloader then gets some classes from the new version. After writing that I realise I'm not sure whether the realpath cache is per-pool, but even if it is this doesn't need to affect the model, as one could simply have two completely separate fpm instances. --f46d04182626295fbe0518def58d--