Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:112524 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 31762 invoked from network); 16 Dec 2020 10:26:48 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 16 Dec 2020 10:26:48 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 6A6F8180384 for ; Wed, 16 Dec 2020 01:57:57 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.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, 16 Dec 2020 01:57:56 -0800 (PST) Received: by mail-wr1-f47.google.com with SMTP id m5so22532864wrx.9 for ; Wed, 16 Dec 2020 01:57:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=TGrvPqWPiHNhV/QMoPw4SBhNRFClUeuEzMbWNZZHq2Q=; b=kYbQ/cypLoLaBZ9bthQIh+T/IaYwSvsbTLso5Y9x4jJ+UnDZUyAzyD8MIEfjHxdotF qA4YhHUeyqEZkKlnbEj3DEgiZuhunABRS/te3/IrxPa9UqsA/u+/vZwfjb3ZecKIwRBX UdQXEBizYWuXGnfLe5Wk2/bONhfME4ibGnN8qH/q8HbSAF6JjuiPIkxn11vOxkueVIu4 DWLcyRmyaUY62iwVWjgJi4WEUWTPp07kk/XJjyp1iD62Weuojr5IybNVZTCt/U87lDup iwk8sl8J1KJXmOQBLXm7TkNSNTdDDy8pE6LZZdjtgeThMV5rvqnH50PeIb1/I7Vaa6SI V8eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=TGrvPqWPiHNhV/QMoPw4SBhNRFClUeuEzMbWNZZHq2Q=; b=K6OnveDmXwK+4pdlGQiTYyJq3CGiS8s79QCr4T/BZFASkTNFzb0EjKd/ybxFoAmgtz T2KuU34Eo49Tb0hC9AeK7DrJO66vzGn//BoFSiX71UhDXpBiyLA6EQLZUoeTYoMjIPcD 8fX5bdmRKsHbeA89vWZBpyR1SZqkgR9RjQTQ6YIoSqOY39dtbi007tdnLVPBFiyo3pjT uhfQYfSSda4zIu5J+eCHOVh7NQ+ym0QKPosz/6VrJar1syUxf/94vwSv8YhupFtERLV4 Gi+T54Ha2crXguulldAxkxlTf3Mabq6nbtpbUNK5JxF0WpAbFAXOHdoOjcFkXDCo/60j fSNg== X-Gm-Message-State: AOAM531k1UGbvJnIoZUI8h+k5HLQXV8Pil/ZrbAWuDRGUCzX9oc8HS8V 99QmGXe1bZ5I1sGwf/TTRat12dy3FqKg1w== X-Google-Smtp-Source: ABdhPJwKb8AjM4CE+7zeZ7/Kojg0gfMSrTZigH6nHGLi6Bv4jI+iFFmT6Nk4tAAbxnMba2L2zvzqaA== X-Received: by 2002:adf:ed49:: with SMTP id u9mr37212643wro.292.1608112675598; Wed, 16 Dec 2020 01:57:55 -0800 (PST) Received: from [192.168.0.22] (cpc104104-brig22-2-0-cust548.3-3.cable.virginm.net. [82.10.58.37]) by smtp.googlemail.com with ESMTPSA id m21sm2096930wml.13.2020.12.16.01.57.54 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Dec 2020 01:57:54 -0800 (PST) To: internals@lists.php.net References: Message-ID: <9b36af8a-270f-2796-194e-b50296522407@gmail.com> Date: Wed, 16 Dec 2020 09:57:53 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: Re: [PHP-DEV] [RFC] [Discussion] Measuring maximum execution time based on wall-time From: rowan.collins@gmail.com (Rowan Tommins) Hi Máté, On 15/12/2020 23:12, Máté Kocsis wrote: > I've just collected a few examples when my proposal would be useful: > https://gist.github.com/kocsismate/dbcc4ba81b27cfb2e25b949723bb7c79 > > [...] > > Do the above examples and this reasoning make sense to you? Also, I'll > improve the wording I used when describing the consequences. The part I'm curious about is not so much when the setting would have an effect, as when it would be the desired solution. Your point about the server not being able to serve any more connections is reasonable, and I can see this being a useful last resort mechanism to keep the server responding. I'd be likely to treat it similarly to the Linux OOM killer: if it was ever actually invoked, I would be investigating how to fix my application. The wording in your e-mails and RFC suggests you see it as something you'd use instead of application-level solutions, rather than as well as them, and that's what I'm trying to picture the use case for. One scenario I can think of would look a bit like this: foreach ( $ordersToProcess as $orderDetails ) {     $result = send_order_to_remote_system($orderDetails);     save_confirmation_to_db($orderDetails->customerOrderRef, $result->supplierOrderRef); } If the remote system responded very slowly, that loop might take many times the expected duration. If we simply kill the process when a fixed wall time has elapsed, we're very likely to create an order on the remote system, but exit without saving its reference. It is however easy to see where in that loop we could safely call a routine like throw_exception_if_time_limit_reached(). If rather than placing orders, the loop was just gathering search results, killing the process would be less dangerous, but cleanly exiting would still be preferable, because we could return a warning and partial results, rather than a 500 error. Other scenarios I can think of have similar problems: * If the database locks up inside a transaction, killing the process probably won't roll that transaction back cleanly * If the process was working through a large import of data, it may have written a bunch of temporary data to disk or holding tables which won't be cleaned up In other words, I can only think of cases where "the cure would be worse than the disease". Regards, -- Rowan Tommins [IMSoP]