Bug #80376 [Com]: last day of the month causes runway cpu usage

From: Date: Sat, 19 Dec 2020 11:52:40 +0000
Subject: Bug #80376 [Com]: last day of the month causes runway cpu usage
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231167@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80376&edit=1

 ID:                 80376
 Comment by:         evtukhov08 at gmail dot com
 Reported by:        mav2287 at aol dot com
 Summary:            last day of the month causes runway cpu usage
 Status:             Open
 Type:               Bug
 Package:            Date/time related
 Operating System:   OS X 10.11.6 El Capitan
 PHP Version:        7.4.12
 Block user comment: N
 Private report:     N

 New Comment:

PHP 8 have the same issue with dates on Mac OS 10.11 installed from brew.


Previous Comments:
------------------------------------------------------------------------
[2020-12-19 10:24:26] php-comment-2020 at ryandesign dot com

In the MacPorts bug report I suggested that it might have to do with the version of the compiler.
mav2287 confirmed that compiling the affected php versions with Apple Clang 800.0.42.1 from Xcode
8.2.1 (the last version compatible with OS X 10.11) produces a php that does not work, while
recompiling with open-source clang 10.0.1 installed by MacPorts produces a php that works. For those
who want to try this, you would use e.g.:

sudo port install clang-10
sudo port -ns upgrade --force php80 configure.compiler=macports-clang-10

This would only recompile the command line php80. Repeat the procedure for php80-apache2handler,
php80-cgi, and/or php80-fpm if you use those SAPIs. Substitute php74, php73, or php72 as needed. We
now have clang-11 in MacPorts so you could presumably use that, or clang-9.0, instead, if desired.

So this suggests that there is some code that was added to php this year that does not get along
with at least Apple Clang 800.0.42.1, though it's not clear which range of Apple Clang versions
are affected.

Perhaps I can git bisect to find which commit introduced the problem.

------------------------------------------------------------------------
[2020-12-17 10:54:38] ekl at woodwing dot com

I did some more digging on the problematic MacOSX 10.11.6 machine. 

It seems that between end of March 2020 and early October 2020 there were no PHP 7.3 nor PHP 7.4
patches released by MacPorts:

--------------------------------------------------------

$ git log --grep "php73"

commit 2b90e9dbf0b7c7d330325e724793d1ab6fc0e062
Author: Ryan Schmidt <ryandesign@macports.org>
Date:   Fri Oct 2 09:59:49 2020 -0500

    php: Update php73 to 7.3.23


commit b03fe0675f1efe520c67b13a6ccc17a6f9a99e09
Author: Ryan Schmidt <ryandesign@macports.org>
Date:   Tue Mar 24 07:24:35 2020 -0500

    php: Update php73 to 7.3.16

--------------------------------------------------------

$ git log --grep "php74"

commit 2eca46bc0c123000c2ef7efddfd382b411d41dfc
Author: Ryan Schmidt <ryandesign@macports.org>
Date:   Thu Oct 1 18:23:45 2020 -0500

    php: Update php74 to 7.4.11


commit 1b2546f94ff2583e3727f7f2df19f72386afc22e
Author: Ryan Schmidt <ryandesign@macports.org>
Date:   Thu Mar 26 09:30:28 2020 -0500

    php: Update php74 to 7.4.4

--------------------------------------------------------

I repeated my test (I mentioned in earlier posts) for all these 4 commits listed above. And it turns
out that:

- 7.3.16 works!
- 7.3.23 hangs!

- 7.4.4 works!
- 7.4.11 hangs!

I hope this helps you pinpointing the problem.

------------------------------------------------------------------------
[2020-12-16 17:32:25] ekl at woodwing dot com

On the problematic 10.11.6 machine, after uninstalling PHP 7.3.25, I managed to bring back the old
PHP 7.3.10 installation as follows:

$ git clone --single-branch https://github.com/macports/macports-ports.git
$ git log --grep "php73 to 7.3.10"

commit 22d4d0a0ba24b20946696eeb887b02e2d15509d5
Author: Ryan Schmidt <ryandesign@macports.org>
Date:   Thu Sep 26 19:31:04 2019 -0500

    php: Update php73 to 7.3.10

=> Note down the commit number for usage below.

$ cd /Users/your-user-name
$ git checkout 22d4d0a0ba24b20946696eeb887b02e2d15509d5
$ portindex /Users/your-user-name/macports-ports

$ vi /opt/local/etc/macports/sources.conf
=> Add the following line just before the rsync command:
	file:///Users/your-user-name/macports-ports [nosync]

$ sudo port install php73 @7.3.10
$ php73 -v
PHP 7.3.10 (cli) (built: Dec 16 2020 17:51:56) ( NTS )
Copyright (c) 1997-2018 The PHP Group

The following test shows that the old PHP 7.3.10 installation has NO problem:

$ php73 -r 'print (new DateTime( "15 Dec 2020" ))->format("Ymd
H:i:s").PHP_EOL;'
20201215 00:00:00

------------------------------------------------------------------------
[2020-12-16 14:13:39] cmb@php.net

Thanks!  I think somebody with access to macOS should have a closer look.

------------------------------------------------------------------------
[2020-12-16 14:10:57] ekl at woodwing dot com

I can repro with PHP 7.3.25 on our MacOSX 10.11.6 MacMini as follows:

$ sudo port install php73
$ sudo port install php73 +debug

$ sudo port activate php73
The following versions of php73 are currently installed:
 1) php73 @7.3.25_2+debug+libedit
 2) php73 @7.3.25_2+libedit (active)
Enter a number to select an option: 1
$ php73 -r 'print (new DateTime( "15 Dec 2020" ))->format("Ymd
H:i:s").PHP_EOL;'
20201215 00:00:00

$ php73 -v
PHP 7.3.25 (cli) (built: Dec 16 2020 14:43:06) ( NTS DEBUG )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.25, Copyright (c) 1998-2018 Zend Technologies

$ sudo port activate php73
The following versions of php73 are currently installed:
 1) php73 @7.3.25_2+debug+libedit
 2) php73 @7.3.25_2+libedit (active)
Enter a number to select an option: 2
$ php73 -r 'print (new DateTime( "15 Dec 2020" ))->format("Ymd
H:i:s").PHP_EOL;'
===>>> HANGS! <<<===

$ php73 -v
PHP 7.3.25 (cli) (built: Dec  6 2020 20:04:26) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.25, Copyright (c) 1998-2018 Zend Technologies

Notes:
- This problem suddenly occurred after upgrading from an older PHP 7.3 patch version. (I can't
remember the patch level that was still working. I assume it was something close to PHP 7.3.10, like
one year old.)
- This problem is a major show-stopper for us. We can't go back to an older PHP 7.3 patch level
anymore, as we thought it was smart to clear older installations first, once we ran into this
problem.
- Exactly the same problem happens for PHP 7.4.13 installed on the same machine.
- This problem does NOT happen on my MacOSX 10.13.6 MacBook Pro.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=80376


--
Edit this bug report at https://bugs.php.net/bug.php?id=80376&edit=1


Thread (21 messages)

« previous php.bugs (#231167) next »