Bug 235917

Summary: lang/php7x core dumped. Reason: php7x-imap module
Product: Ports & Packages Reporter: Sergey Anokhin <admin>
Component: Individual Port(s)Assignee: Torsten Zuehlsdorff <tz>
Status: Closed FIXED    
Severity: Affects Only Me CC: w.schwarzenfeld
Priority: --- Flags: tz: merge-quarterly+
Version: Latest   
Hardware: amd64   
OS: Any   

Description Sergey Anokhin 2019-02-21 14:05:10 UTC
Hi All,

# uname -rv
12.0-STABLE FreeBSD 12.0-STABLE #2 r343904M: Wed Feb 13 08:53:51 MSK 2019     root@server.5034.ru:/usr/obj/usr/src/amd64.amd64/sys/SERVER

I have issues with php7x. This is my build options:

[x] CLI      Build CLI version                        
[x] CGI      Build CGI version                        
[x] FPM      Build FPM version                        
[x] EMBED    Build embedded library                   
[x] PHPDBG   Interactive PHP debugger                 
[x] DEBUG    Build with debugging support             
[x] DTRACE   Build with DTrace probes                 
[x] IPV6     IPv6 protocol support                    
[x] MYSQLND  Build with MySQL Native Driver           
[x] LINKTHR  Link thread lib (for threaded extensions)
[ ] ZTS      Force Zend Thread Safety (ZTS) build    

The issue: php core dumped when php7x-imap module installed.

This is debug:

root@server:/usr/ports/mail/php72-imap# gdb
GNU gdb (GDB) 8.2.1 [GDB v8.2.1 for FreeBSD]
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-portbld-freebsd12.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) run php -v
Starting program:  php -v
No executable file specified.
Use the "file" or "exec-file" command.
(gdb) quit
root@server:/usr/ports/mail/php72-imap# gdb php
GNU gdb (GDB) 8.2.1 [GDB v8.2.1 for FreeBSD]
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-portbld-freebsd12.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from php...done.
(gdb) run php -v
Starting program: /usr/bin/php php -v

Program received signal SIGSEGV, Segmentation fault.
0x0000000802628eda in hash_lookup () from /usr/local/lib/libc-client4.so.9
(gdb) bt
#0  0x0000000802628eda in hash_lookup () from /usr/local/lib/libc-client4.so.9
#1  0x000000080333161f in find_alias () from /usr/local/lib/librecode.so.3
#2  0x0000000803333576 in recode_new_outer () from /usr/local/lib/librecode.so.3
#3  0x00000008032740a7 in zm_startup_recode () from /usr/local/lib/php/20170718-debug/recode.so
#4  0x00000000006a27bd in zend_startup_module_ex (module=0x800f87800) at Zend/zend_API.c:1873
#5  0x00000000006a3100 in zend_startup_module_zval (zv=0x800fa5ee0) at Zend/zend_API.c:1888
#6  0x00000000006b4d7d in zend_hash_apply (ht=0x8517b0 <module_registry>, apply_func=0x6a30e0 <zend_startup_module_zval>) at Zend/zend_hash.c:1508
#7  0x00000000006a2f27 in zend_startup_modules () at Zend/zend_API.c:1999
#8  0x00000000005ed95c in php_module_startup (sf=0x7dc168 <cli_sapi_module>, additional_modules=0x0, num_additional_modules=0) at main/main.c:2309
#9  0x00000000007be23b in php_cli_startup (sapi_module=0x7dc168 <cli_sapi_module>) at sapi/cli/php_cli.c:431
#10 0x00000000007bc56c in main (argc=3, argv=0x7fffffffea38) at sapi/cli/php_cli.c:1370
(gdb) frame 0
#0  0x0000000802628eda in hash_lookup () from /usr/local/lib/libc-client4.so.9
(gdb) frame 1
#1  0x000000080333161f in find_alias () from /usr/local/lib/librecode.so.3
(gdb) frame 2
#2  0x0000000803333576 in recode_new_outer () from /usr/local/lib/librecode.so.3
(gdb) frame 3
#3  0x00000008032740a7 in zm_startup_recode () from /usr/local/lib/php/20170718-debug/recode.so
(gdb) frame 4
#4  0x00000000006a27bd in zend_startup_module_ex (module=0x800f87800) at Zend/zend_API.c:1873
1873    Zend/zend_API.c: No such file or directory.
(gdb) frame 5
#5  0x00000000006a3100 in zend_startup_module_zval (zv=0x800fa5ee0) at Zend/zend_API.c:1888
1888    in Zend/zend_API.c
(gdb) frame 6
#6  0x00000000006b4d7d in zend_hash_apply (ht=0x8517b0 <module_registry>, apply_func=0x6a30e0 <zend_startup_module_zval>) at Zend/zend_hash.c:1508
1508    Zend/zend_hash.c: No such file or directory.
(gdb) frame 7
#7  0x00000000006a2f27 in zend_startup_modules () at Zend/zend_API.c:1999
1999    Zend/zend_API.c: No such file or directory.
(gdb) frame 8
#8  0x00000000005ed95c in php_module_startup (sf=0x7dc168 <cli_sapi_module>, additional_modules=0x0, num_additional_modules=0) at main/main.c:2309
2309    main/main.c: No such file or directory.
(gdb) frame 9
#9  0x00000000007be23b in php_cli_startup (sapi_module=0x7dc168 <cli_sapi_module>) at sapi/cli/php_cli.c:431
431     sapi/cli/php_cli.c: No such file or directory.
(gdb) frame 10
#10 0x00000000007bc56c in main (argc=3, argv=0x7fffffffea38) at sapi/cli/php_cli.c:1370
1370    in sapi/cli/php_cli.c
Comment 1 Sergey Anokhin 2019-02-24 22:04:21 UTC
btw, 

#mv ext-20-imap.ini ext-30-imap.ini

this movement solve the issue.
Comment 2 Torsten Zuehlsdorff freebsd_committer freebsd_triage 2019-02-25 15:00:52 UTC
Interesting. I will have a look at this issue this week!
Comment 3 Sergey Anokhin 2019-02-26 07:29:24 UTC
(In reply to Torsten Zuehlsdorff from comment #2)


There is a opinion that this is old php bug linked with order of loading php modules (and mod_php too).

This is my module list:

# php -m
[PHP Modules]
bcmath
bz2
Core
ctype
curl
date
dom
filter
gd
gettext
hash
iconv
imap
intl
json
ldap
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDFlib
PDO
pdo_sqlite
Phar
posix
pspell
readline
recode
Reflection
session
SimpleXML
soap
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache
Comment 4 Sergey Anokhin 2019-02-26 07:31:23 UTC
(In reply to Torsten Zuehlsdorff from comment #2)

This is config files:

# ls -1 /usr/local/etc/php/
ext-10-opcache.ini
ext-18-session.ini
ext-20-bcmath.ini
ext-20-bz2.ini
ext-20-ctype.ini
ext-20-curl.ini
ext-20-dom.ini
ext-20-filter.ini
ext-20-gd.ini
ext-20-gettext.ini
ext-20-hash.ini
ext-20-iconv.ini
ext-20-intl.ini
ext-20-json.ini
ext-20-ldap.ini
ext-20-mbstring.ini
ext-20-mysqli.ini
ext-20-openssl.ini
ext-20-pcntl.ini
ext-20-pdo.ini
ext-20-posix.ini
ext-20-pspell.ini
ext-20-readline.ini
ext-20-recode.ini
ext-20-simplexml.ini
ext-20-soap.ini
ext-20-sqlite3.ini
ext-20-tokenizer.ini
ext-20-xml.ini
ext-20-xmlwriter.ini
ext-20-zip.ini
ext-20-zlib.ini
ext-30-imap.ini
ext-30-pdf.ini
ext-30-pdo_sqlite.ini
ext-30-phar.ini
ext-30-xmlreader.ini
ext-30-xmlrpc.ini
ext-30-xsl.ini

ext-30-imap.ini - was renamed manually
Comment 5 commit-hook freebsd_committer freebsd_triage 2019-04-11 09:50:21 UTC
A commit references this bug:

Author: tz
Date: Thu Apr 11 09:49:41 UTC 2019
New revision: 498659
URL: https://svnweb.freebsd.org/changeset/ports/498659

Log:
  PHP: Change MOD_PRIO for imap to avoid core dumps

  PR:		235917
  Reported by:	Sergey Anokhin <admin@5034.ru>
  MFH:		2019Q2

Changes:
  head/lang/php71/Makefile
  head/lang/php71/Makefile.ext
  head/lang/php72/Makefile
  head/lang/php72/Makefile.ext
  head/lang/php73/Makefile
  head/lang/php73/Makefile.ext
Comment 6 commit-hook freebsd_committer freebsd_triage 2019-04-11 10:59:18 UTC
A commit references this bug:

Author: tz
Date: Thu Apr 11 10:58:19 UTC 2019
New revision: 498663
URL: https://svnweb.freebsd.org/changeset/ports/498663

Log:
  MFH: r498659

  PHP: Change MOD_PRIO for imap to avoid core dumps

  PR:		235917
  Reported by:	Sergey Anokhin <admin@5034.ru>

  Approved by:	ports-secteam (joneum)

Changes:
_U  branches/2019Q2/
  branches/2019Q2/lang/php71/Makefile
  branches/2019Q2/lang/php71/Makefile.ext
  branches/2019Q2/lang/php72/Makefile
  branches/2019Q2/lang/php72/Makefile.ext
  branches/2019Q2/lang/php73/Makefile
  branches/2019Q2/lang/php73/Makefile.ext
Comment 7 Torsten Zuehlsdorff freebsd_committer freebsd_triage 2019-04-11 11:00:24 UTC
Committed, thanks! :)