Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110339 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 76548 invoked from network); 3 Jun 2020 08:23:10 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 3 Jun 2020 08:23:10 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0740C1804F2 for ; Wed, 3 Jun 2020 00:05:17 -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_H3,RCVD_IN_MSPIKE_WL,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-oo1-f47.google.com (mail-oo1-f47.google.com [209.85.161.47]) (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 ; Wed, 3 Jun 2020 00:05:16 -0700 (PDT) Received: by mail-oo1-f47.google.com with SMTP id v1so315800ooh.0 for ; Wed, 03 Jun 2020 00:05:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6rIUQioYkpSo5BeZNnc/YrkrDhO9ceNo8ywr8oK3BhE=; b=jh+9twAvS/oogfu4/G4zjPYVWuYKLy9911CnhO3ihN3dVRPvo/EZJYsTqPTJUMmVkr auKIF36fEtfFeiTWV1GPT7+36w+u4Mb092c9elD9uVzvIAv8s8hrzdcg0UH9kkunOOxb zpEkxfkQMk4XB7DQoWJoNBOOdoQanX6N2fvd3rJDYv8muWtL1Gz1SZpW5S1Fm7+FwP+o NZSlofeE20FsIhfhJTDG34W5JWa089IyxPbqGAUpgq/PuBLqW2OCCNHuxGAmvgdbA0ps kiPX4X8Em86Kx81JHtx3oz8SD2WpXUozfb3HEWLVD+wOy/SzP9bfJFNoOwhP0tYNRHW8 UJQw== 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=6rIUQioYkpSo5BeZNnc/YrkrDhO9ceNo8ywr8oK3BhE=; b=lRIxI+KhY46HEt9Pe7rE6O9PwOOg4+bwb128Bhf55Fp5v7TTRA5PnVyA+Yzo5ggIqf 1QGGEaJLCj5u5W3kBTzzzADL0SEmuts4K7jiEmJX5Tisg5cpOBIJXi24IXYn1mVD0Rbk x/jPYsSd3CQv9j5TgGbqCjgznEIXA6KpCaT2+CllaxXw1jMyZ3n9+7PBQ1w6cgZZ2oQj Eiv819qFXx9ChvNLKlSv686XEKfiKrxdZvBc8cM6Kh5pDvuRIZp/O/0tBbcOJlGFFc7g vYMp1k9ajsl7xeUSErL+nYo6OXafFc5dH3Qh4dRgJUrDEK+qbWeS9PWYMVH3KVZGsRYV rPzw== X-Gm-Message-State: AOAM533xCM/6C4rqBxkb5l8nDwjwzhEdSb7Ho8YYz5NHmHNFFV9dWjzj nsUe4l66u97VPXzPWRu0JqNhFdCdYzZz9TTc1/I= X-Google-Smtp-Source: ABdhPJwI1HJcbAaFdANlFH9xZPEseRS4iwCGoQ+PseVR4/sa07iqSNW1yJizGWfBTUEoODq1/HQPVn+CjOnmYSCCTlU= X-Received: by 2002:a4a:96f1:: with SMTP id t46mr23192580ooi.75.1591167912062; Wed, 03 Jun 2020 00:05:12 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 3 Jun 2020 09:04:53 +0200 Message-ID: To: Max Semenik Cc: Internals Content-Type: multipart/alternative; boundary="0000000000002d32d605a728a6d5" Subject: Re: [PHP-DEV] RFC: Error backtraces From: nikita.ppv@gmail.com (Nikita Popov) --0000000000002d32d605a728a6d5 Content-Type: text/plain; charset="UTF-8" On Tue, Jun 2, 2020 at 10:57 PM Max Semenik wrote: > On Sun, May 31, 2020 at 4:47 PM Nikita Popov wrote: > > > I'm concerned about the performance implications of this change. > Backtrace > > gathering is quite expensive and doing this for every diagnostic will > have > > a large performance impact if there are many of them. This is okay if > your > > code is intended to be diagnostics clean, but unfortunately this is not a > > given. If you generate 10k deprecation warnings during a request, you're > > definitely going to feel those backtraces. > > > > INI setting should take care of this. If your code is crap, don't flip it > on. > There's a couple of problems with this line of argumentation: First, even if the code is crap, wouldn't it still want to have stack traces for fatal errors? Why should crap code be denied stack traces? Isn't that the code that needs them most? If the code weren't crap it wouldn't be causing fatal errors anyway ;) Second, PHP has plenty of functions (especially I/O functions) where ignoring notices and warnings is a requirement. You are not interested in back traces for errors your ignore. Keep in mind that error_get_last() data is populated independently of whether errors are suppressed or not. Similarly, if your code promoted all warnings to exceptions using a custom error handler, then you'll perform a duplicate backtrace calculation, first when the warning is originally through, and then again if you construct the exception. (This is less bad than other cases, because it's "just" twice as slow.) Finally, even if we completely disregard the question of performance, back traces are very noisy. You get one fatal error per request, but you might easily get 1k warnings if something happens to trigger in a loop. With back traces, those 1k warnings will be 100k lines. I'm not sure if limiting it to just fatals is the best choice, but I do think that this needs a bit more control. And limited to just backtraces for fatals, I think this functionality should be enabled by default. This might also want to integrate with the zend.exception_ignore_args option (or, because that one is exception-specific, a renamed option that does the same thing). We will want to disable argument gathering in a default production configuration, because the arguments may contain sensitive data that must not appear inside log files. Regards, Nikita --0000000000002d32d605a728a6d5--