Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115934 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 32750 invoked from network); 3 Sep 2021 14:47:41 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Sep 2021 14:47:41 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3F9351804C9 for ; Fri, 3 Sep 2021 08:24:10 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 3 Sep 2021 08:24:09 -0700 (PDT) Received: by mail-lf1-f43.google.com with SMTP id f18so12411416lfk.12 for ; Fri, 03 Sep 2021 08:24:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=b7j7Z9FvmaV1UnNzErOF4iYHuFQ3TQ5nufuw22tuk9k=; b=caJvbmvwvqI3kQ6v6tXPbrM/oGQCStMYdcRWwZu0PntsgvRshSTzTqzvF2e7b0G3se dgELMeSjADaHtMl0atPx/o4JhGepUS8uUTDVOzEOJNYIiosmhigrHXQvVbxeeRnIS5cm Ja/D9wbJdW4tSD1vS48dKCUB7YVA6kkzNGzLxA0uNJv8yniKs4Gxaigxv9VcHPkFTVR6 6oGB2wblk9nSn6jkXTi7NGU/5Hcn8xrtXHmX+NVO4AIeKATeXupYGJmGK3kMiU3P4lzx V1wS5FPlviNvcbUn7ZtcP8Of3lRRpVIQiRhmIHFseK1qkuuQpQ47LHwQG802eo+HWLj7 XnBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=b7j7Z9FvmaV1UnNzErOF4iYHuFQ3TQ5nufuw22tuk9k=; b=kiIqUVft9bZXnIqdaX/q5yf8dhjf3cFzSb5oVx/M01bFsP0sv3JBFIN0ZlSn/0N1C/ CKws370w3OKZiU+v7ujC6wY5eeMFrjWs7Mh8K+YWukTMPwT+VZOmTPkV8VdiPu0gS5it PgrQOaKzbl+3QPmDc2G/WQ1zuXnJXoiBFAFuUMgPep/7S29aWraFZsV4uylpo0wjxfC2 GpK7uTCBPfse/QQi54mre0ihzaCimvlaEK1CyhWragr79a/ssL/XN8OnS38Tt9te68xs zW2cNf8pCmKtSjB3MsVETfPvObkKmu1nQWYwUlgiiXE6Oz04bgtHED24p21GwE7uDxc7 PK2g== X-Gm-Message-State: AOAM5316cpLqDnaQXE4dC7PfamB4P8NjP/iSrA7wfx2LBgKymJsqY7WP iBV8Zr9nA56cmrwa7GacCepH59FaGNWOzdno3poZkKWH X-Google-Smtp-Source: ABdhPJz7DN2VKyG4Hz3BU+1Hy9TGCcr2LspEIJ5Mb4PFHBCN5wY9O4RQd8C7R5A1kjFcZA3gDPGaQk0hc1RvKxtP8tg= X-Received: by 2002:a19:2d0d:: with SMTP id k13mr3214261lfj.232.1630682648054; Fri, 03 Sep 2021 08:24:08 -0700 (PDT) MIME-Version: 1.0 References: <0A048A30-444F-4DB0-A79C-9EA9BD07B1EC@cschneid.com> In-Reply-To: Date: Fri, 3 Sep 2021 17:23:52 +0200 Message-ID: To: Kevin Lyda Cc: Christian Schneider , PHP internals Content-Type: multipart/alternative; boundary="000000000000fa8f9105cb18e30d" Subject: Re: [PHP-DEV] Adding a way to disable the stat cache From: nikita.ppv@gmail.com (Nikita Popov) --000000000000fa8f9105cb18e30d Content-Type: text/plain; charset="UTF-8" On Fri, Sep 3, 2021 at 4:08 PM Kevin Lyda wrote: > On Fri, Sep 3, 2021 at 2:34 PM Christian Schneider > wrote: > > If I remember correctly it was about reducing the number of system > calls. Is this no issue any more? > > Has a quick benchmark been done to see the positive / negative impact of > the stat cache for a typical application? > > In the lifespan of php it really wasn't an issue unless someone was > doing something that wasn't wise - I can't think of a single reason to > stat a file in a tight loop. > > However more importantly the current behaviour returns bad data for > perfectly correct programs. So for example on a unix box... > > passthru('touch foo'); > if (is_file('foo')) { > echo "Correct\n"; > } > passthru('rm foo'); > if (is_file('foo')) { > echo "Incorrect\n"; > } > ?> > > Now this is a silly toy, but imagine using is_file to see if a > graphics file exists, running an image processing program on it to > modify it, and then using a stat call to get the file length to > populate the Content-Length field - it will almost certainly be wrong. > Just to throw it out there: Maybe we should clear the stat cache when functions in the exec family are used? Even if we allow disabling the stat cache, I think we can easily avoid that particular footgun. And if calls to external binaries are involved we likely don't have to worry about stat overhead. Regards, Nikita --000000000000fa8f9105cb18e30d--