Bug #53632 [Com]: PHP hangs on numeric value 2.2250738585072011e-308

From: Date: Tue, 04 Jan 2011 18:06:35 +0000
Subject: Bug #53632 [Com]: PHP hangs on numeric value 2.2250738585072011e-308
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-157572@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53632&edit=1

 ID:                 53632
 Comment by:         hieu dot ld at vnnb dot net
 Reported by:        exploringbinary at gmail dot com
 Summary:            PHP hangs on numeric value 2.2250738585072011e-308
 Status:             Assigned
 Type:               Bug
 Package:            Math related
 PHP Version:        5.3.4
 Assigned To:        dmitry
 Block user comment: N
 Private report:     N

 New Comment:

Does not reproduce on php 5.3.4 (with gentoo patches, compiled -O2).

driana@undine ~/h $ cat numericval.php
<?php $d = 2.2250738585072011e-308; echo $d + 0; echo "\n"; ?>

driana@undine ~/h $ php numericval.php
2.2250738585072E-308

driana@undine ~/h $ php -v
PHP 5.3.4-pl0-gentoo (cli) (built: Dec 24 2010 14:24:29)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

driana@undine ~/h $ uname -a
Linux undine 2.6.28-hardened-r9-hrd-undine #1 SMP Thu Nov 12 02:29:42
CET 2009 i686 Intel(R) Pentium(R) Dual CPU E2180 @ 2.00GHz GenuineIntel
GNU/Linux

Configure Command =>  './configure'  '--prefix=/usr'
'--build=i686-pc-linux-gnu' '--host=i686-pc-linux-gnu'
'--mandir=/usr/share/man' '--infodir=/usr/share/info'
'--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib'
'--prefix=/usr/lib/php5.3' '--mandir=/usr/lib/php5.3/man'
'--infodir=/usr/lib/php5.3/info' '--libdir=/usr/lib/php5.3/lib'
'--with-libdir=lib' '--without-pear' '--enable-maintainer-zts'
'--disable-bcmath' '--with-bz2' '--disable-calendar'
'--with-curl'
'--without-curlwrappers' '--without-enchant' '--enable-exif'
'--enable-ftp' '--with-gettext' '--without-gmp'
'--disable-intl'
'--without-kerberos' '--enable-mbstring' '--with-mcrypt'
'--without-mssql' '--with-onig=/usr' '--with-openssl'
'--with-openssl-dir=/usr' '--enable-pcntl' '--with-pgsql'
'--without-pspell' '--without-recode' '--disable-shmop'
'--without-snmp'
'--disable-soap' '--disable-sockets' '--without-sybase-ct'
'--disable-sysvmsg' '--disable-sysvsem' '--disable-sysvshm'
'--with-tidy' '--disable-wddx' '--with-xmlrpc'
'--without-xsl'
'--enable-zip' '--with-zlib' '--disable-debug'
'--enable-dba'
'--without-cdb' '--without-db4' '--disable-flatfile'
'--with-gdbm'
'--disable-inifile' '--without-qdbm' '--with-freetype-dir=/usr'
'--with-t1lib=/usr' '--enable-gd-jis-conv' '--with-jpeg-dir=/usr'
'--with-png-dir=/usr' '--without-xpm-dir' '--with-gd'
'--with-imap'
'--with-imap-ssl' '--without-interbase' '--with-mysql=/usr'
'--with-mysql-sock=/var/run/mysqld/mysqld.sock'
'--with-mysqli=/usr/bin/mysql_config' '--without-oci8'
'--without-pdo-dblib' '--with-pdo-mysql=/usr' '--with-pdo-pgsql'
'--with-pdo-sqlite=/usr' '--without-pdo-odbc' '--with-readline'
'--without-libedit' '--without-mm' '--with-sqlite=/usr'
'--enable-sqlite-utf8' '--with-pic' '--with-pcre-regex=/usr'
'--with-pcre-dir=/usr' '--with-config-file-path=/etc/php/cli-php5.3'
'--with-config-file-scan-dir=/etc/php/cli-php5.3/ext-active'
'--enable-cli' '--disable-cgi' '--disable-fpm'
'--disable-embed'
'--without-apxs2'

CFLAGS="-march=core2 -mfpmath=sse -O2 -pipe -fforce-addr
-fomit-frame-pointer"


Previous Comments:
------------------------------------------------------------------------
[2011-01-04 18:36:42] chris dot tandiono at gmail dot com

[christandiono@hang1 ~]$ uname -a
FreeBSD hang1 8.0-RELEASE-p3 FreeBSD 8.0-RELEASE-p3 #0: Wed May 26
05:45:12 UTC 
2010     root@i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC 
i386
[christandiono@hang1 ~]$ php -v
PHP 5.3.4 with Suhosin-Patch (cli) (built: Dec 20 2010 18:00:57) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

[chris@hang2 ~]$ uname -a
Linux hang2 2.6.36-ARCH #1 SMP PREEMPT Wed Nov 24 06:44:11 UTC 2010 i686

Intel(R) Core(TM) Duo CPU T2400 @ 1.83GHz GenuineIntel GNU/Linux
[chris@hang2 ~]$ php -v
PHP 5.3.4 with Suhosin-Patch (cli) (built: Dec 16 2010 21:19:01) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

[chris@nohang ~]$ uname -a
Darwin nohang 10.5.0 Darwin Kernel Version 10.5.0: Fri Nov  5 23:20:39
PDT 2010; 
root:xnu-1504.9.17~1/RELEASE_I386 i386 i386
[chris@nohang ~]$ php -v
PHP 5.3.3 (cli) (built: Aug 22 2010 19:41:57) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

Hangs on FreeBSD and Linux, not on Mac OS X. It might be worth noting
that the 
last two machines have the same CPU (the Linux and Mac OS X machines).

------------------------------------------------------------------------
[2011-01-04 17:55:00] hion2000 at yahoo dot ca

Same happens on my Ubuntu box as well.

$ php -v
PHP 5.3.3-1ubuntu9.1 with Suhosin-Patch (cli) (built: Oct 15 2010
14:17:04)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies


$ uname -a
Linux Server2 2.6.35-23-generic-pae #41-Ubuntu SMP Wed Nov 24 10:35:46
UTC 2010 
i686 GNU/Linux

------------------------------------------------------------------------
[2011-01-04 17:41:03] rasmus@php.net

This is an interesting bug.  How about we just mark these as volatile
doubles in 
that part of the code to make sure they don't end up in registers.  My
guess is 
that it would fix it.  Need to track down a 32-bit machine to test this
though.

------------------------------------------------------------------------
[2011-01-04 17:19:56] exploringbinary at gmail dot com

See

http://www.exploringbinary.com/php-hangs-on-numeric-value-2-2250738585072011e-308/
http://www.reddit.com/r/programming/comments/evtrq/php_hangs_on_numeric_value_22250738585072011e308/
http://news.ycombinator.com/item?id=2066084

for lots of additional comments on this issue.

------------------------------------------------------------------------
[2011-01-04 16:50:11] abowling1 at gmail dot com

Same problem on 2 systems (hangs with CPU pegged at 100%).

I have two CentOS 5.5 systems running i386 PHP packages:
PHP 5.3.2 (cli) (built: Mar  4 2010 21:52:46), Zend Engine v2.3.0, with
eAccelerator v0.9.6
CPU: 
processor       : 0 (and 1)
vendor_id       : GenuineIntel
cpu family      : 6
model           : 15
model name      : Intel(R) Core(TM)2 CPU          6420  @ 2.13GHz
stepping        : 6
cpu MHz         : 800.000
cache size      : 4096 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 2
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 10
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca
cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm
constant_tsc pni mon itor ds_cpl vmx est tm2 cx16 xtpr lahf_lm
bogomips        : 2139.82

AND

PHP 5.3.3 (cli) (built: Jul 22 2010 16:41:20), Zend Engine v2.3.0, with
eAccelerator v0.9.6

CPU:
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 15
model           : 2
model name      : Intel(R) Pentium(R) 4 CPU 2.00GHz
stepping        : 4
cpu MHz         : 1993.668
cache size      : 512 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca
cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm up
bogomips        : 3987.33

Package's build settings:
./configure --build=i686-redhat-linux-gnu --host=i686-redhat-linux-gnu
--target=i386-redhat-linux-gnu --program-prefix= --prefix=/usr
--exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin
--sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include
--libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var
--sharedstatedir=/usr/com --mandir=/usr/share/man
--infodir=/usr/share/info --cache-file=../config.cache --with-libdir=lib
--with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d
--disable-debug --with-pic --disable-rpath --without-pear --with-bz2
--with-exec-dir=/usr/bin --with-freetype-dir=/usr --with-png-dir=/usr
--with-xpm-dir=/usr --enable-gd-native-ttf --with-t1lib=/usr
--without-gdbm --with-gettext --with-gmp --with-iconv
--with-jpeg-dir=/usr --with-openssl --with-zlib --with-layout=GNU
--enable-exif --enable-ftp --enable-magic-quotes --enable-sockets
--enable-sysvsem --enable-sysvshm --enable-sysvmsg --with-kerberos
--enable-ucd-snmp-hack --enable-shmop --enable-calendar
--with-libxml-dir=/usr --enable-xml --with-system-tzdata
--with-apxs2=/usr/sbin/apxs --enable-maintainer-zts
--with-config-file-scan-dir=/etc/php-zts.d --enable-force-cgi-redirect
--enable-pcntl --with-imap=shared --with-imap-ssl
--enable-mbstring=shared --enable-mbregex --with-gd=shared
--enable-bcmath=shared --enable-dba=shared --with-db4=/usr
--with-xmlrpc=shared --with-ldap=shared --with-ldap-sasl
--with-mysql=shared,mysqlnd --with-mysqli=shared,mysqlnd
--enable-mysqlnd-threading
--with-oci8=shared,instantclient,/usr/lib/oracle/11.1.0.7/client/lib,11.1.0.7
--with-pdo-oci=shared,instantclient,/usr,11.1.0.7
--with-interbase=shared,/usr/lib/firebird
--with-pdo-firebird=shared,/usr/lib/firebird --enable-dom=shared
--with-pgsql=shared --enable-wddx=shared --with-snmp=shared,/usr
--enable-soap=shared --with-xsl=shared,/usr --enable-xmlreader=shared
--enable-xmlwriter=shared --with-curl=shared,/usr --enable-fastcgi
--enable-pdo=shared --with-pdo-odbc=shared,unixODBC,/usr
--with-pdo-mysql=shared,mysqlnd --with-pdo-pgsql=shared,/usr
--with-pdo-sqlite=shared,/usr --with-pdo-dblib=shared,/usr
--without-sqlite3 --with-sqlite=shared,/usr --enable-json=shared
--enable-zip=shared --without-readline --with-libedit
--with-pspell=shared --enable-phar=shared --with-mcrypt=shared,/usr
--with-tidy=shared,/usr --with-mssql=shared,/usr --enable-sysvmsg=shared
--enable-sysvshm=shared --enable-sysvsem=shared --enable-posix=shared
--with-unixODBC=shared,/usr --enable-fileinfo=shared
--enable-intl=shared --with-icu-dir=/usr --with-enchant=shared,/usr
--with-recode=shared,/usr

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


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

    http://bugs.php.net/bug.php?id=53632


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


Thread (42 messages)

« previous php.bugs (#157572) next »