gplessis / dotdeb-php

Dotdeb : PHP packages
https://www.dotdeb.org/
Other
125 stars 23 forks source link

php7.0-redis 3.1.0-1~dotdeb+8.1 segfaults #159

Closed luispabon closed 7 years ago

luispabon commented 7 years ago

Since upgrading to this package version from 3.0.0-rc1, we're seeing constant redis went away (on pconnect) and segfaults (on connect) every other request to redis. These issues go away as soon as we roll back to 3.0.0-RC1

We're using redis for rpush/blpop.

luispabon commented 7 years ago

This is happening connecting to Redis 3.2 (local) and AWS Elasticache (impersonating Redis 3.2).

gplessis commented 7 years ago

I'll investigate asap.

(Note : next time, make sure to report your issue on the right project)

gplessis commented 7 years ago

It looks like 3.1.1 will be released over the week-end. It fixes a couple of segfaults. See https://github.com/phpredis/phpredis/issues/1076

gplessis commented 7 years ago

I just published an intermediate release (3.1.0-1~dotdeb+8.2) that should fix your issue. Please confirm.

HanXHX commented 7 years ago

Hi @gplessis,

I think it's same issue, but i can't see any segfault on php-fpm logs. With versions 3.1.0-1~dotdeb+8.2 / 3.1.0-1~dotdeb+8.1, I have an error on a phpmyadmin:

Catchable Fatal Error in ./libraries/session.lib.php#20
session_regenerate_id(): Failed to create(read) session ID: redis (path: tcp://XXXXXXXXXXXXXXXXXXX.euw1.cache.amazonaws.com:6379?database=5)

Config:

session.save_handler = redis
session.save_path = "tcp://"XXXXXXXXXXXXXXXXXXX.cache.amazonaws.com":6379?database=5"

I don't have any issue with 3.0.0~rc1-1~dotdeb+8.2

azeemism commented 7 years ago

Hi @gplessis , I am also having the same issue with segfaults when trying to login to Magento 2 admin or when customers try to login into their accounts.

Versions

I also had to roll back to Package: php7.0-redis Version: 3.0.0~rc1-1~dotdeb+8.2

Both of the following versions create the segfault issue: Version: 3.1.0-1~dotdeb+8.2 Version: 3.1.0-1~dotdeb+8.1

Logs

Nginx Log

2017/01/04 14:55:12 [error] 62842#62842: *20 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: XX.XX.XX.XX, server: domainnamehere.com, request: "POST /admin/admin/index/index/key/keyhere/ HTTP/1.0", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "domainnamehere.com", referrer: "https://domainnamehere.com/admin/admin/index/index/key/keyhere/"

/etc/var/messages

Jan  2 07:18:48 server1 kernel: [243505.106360] php-fpm7.0[10029]: segfault at 1 ip 0000000000000001 sp 00007ffe49e2d888 error 14
Jan  2 07:19:23 server1 kernel: [243539.518100] traps: php-fpm7.0[10031] general protection ip:7f9681645b2b sp:7ffe49e2d890 error:0 in php-fpm7.0[7f9681435000+45a000]

/var/log/kern.log

Jan  2 06:51:15 server1 kernel: [241850.957461] traps: php-fpm7.0[10037] general protection ip:7f9681645b2b sp:7ffe49e2d890 error:0 in php-fpm7.0[7f9681435000+45a000]
Jan  2 07:18:48 server1 kernel: [243505.106360] php-fpm7.0[10029]: segfault at 1 ip 0000000000000001 sp 00007ffe49e2d888 error 14

php7.0-fpm.log

[30-Dec-2016 16:50:15] WARNING: [pool www] child 10032 exited on signal 11 (SIGSEGV) after 68.736147 seconds from start
[30-Dec-2016 16:50:15] NOTICE: [pool www] child 10321 started

System: Debian Jessie 8 latest

Linux server1 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) x86_64 GNU/Linux

session.save Settings

I have tried the following settings for /etc/php/7.0/fpm/php.ini which work with 3.0.0~rc1-1~dotdeb+8.2, but do not work with the latest two updates.

Default:

session.save_handler = file
;session.save_path = "/var/lib/php/sessions"

TCP:

session.save_handler = redis
session.save_path = "tcp://127.0.0.1:6379?auth=passwordhere?timeout=10&database=0"

Socket:

session.save_handler = redis
session.save_path = "unix:///var/run/redis/redis.sock?auth=passwordhere?weight=1&timeout=10&database=0"

/etc/redis/redis.conf

bind 127.0.0.1
protected-mode yes
port 6379
tcp-backlog 61440
unixsocket /var/run/redis/redis.sock
unixsocketperm 777
timeout 0
tcp-keepalive 300
daemonize yes
supervised no
pidfile /var/run/redis/redis-server.pid
loglevel notice
logfile /var/log/redis/redis-server.log
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /var/lib/redis
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
requirepass passwordhere
maxmemory 6442450944
maxmemory-policy volatile-lru
maxmemory-samples 10
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes

/etc/php/7.0/fpm/php.ini

[PHP]
engine = On
short_open_tag = Off
precision = 14
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = 17
disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
disable_classes =
zend.enable_gc = On
expose_php = Off
max_execution_time = 18000
max_input_time = 300
memory_limit = 2G
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
html_errors = On
variables_order = "GPCS"
request_order = "GP"
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 500M
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
default_charset = "UTF-8"
doc_root =
user_dir =
enable_dl = Off
file_uploads = On
upload_max_filesize = 20M
max_file_uploads = 20
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60
[CLI Server]
cli_server.color = On
[Date]
date.timezone = "Canada/Pacific"
[filter]
[iconv]
[intl]
[sqlite3]
[Pcre]
[Pdo]
[Pdo_mysql]
pdo_mysql.cache_size = 2000
pdo_mysql.default_socket=
[Phar]
[mail function]
SMTP = localhost
smtp_port = 25
sendmail_path = "/usr/sbin/sendmail -t -i"
mail.add_x_header = On
[SQL]
sql.safe_mode = Off
[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
[Interbase]
ibase.allow_persistent = 1
ibase.max_persistent = -1
ibase.max_links = -1
ibase.timestampformat = "%Y-%m-%d %H:%M:%S"
ibase.dateformat = "%Y-%m-%d"
ibase.timeformat = "%H:%M:%S"
[MySQLi]
mysqli.max_persistent = -1
mysqli.allow_persistent = On
mysqli.max_links = -1
mysqli.cache_size = 2000
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off
[mysqlnd]
mysqlnd.collect_statistics = On
mysqlnd.collect_memory_statistics = Off
[OCI8]
[PostgreSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0
[bcmath]
bcmath.scale = 0
[browscap]
[Session]
session.save_handler = redis
session.save_path = "unix:///var/run/redis/redis.sock?auth=passwordhere@vws?weight=1&timeout=10&database=0"
session.use_strict_mode = 0
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 0
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.referer_check =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
[Assertion]
zend.assertions = -1
[COM]
[mbstring]
[gd]
[exif]
[Tidy]
tidy.clean_output = Off
[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400
soap.wsdl_cache_limit = 5
[sysvshm]
[ldap]
ldap.max_links = -1
[mcrypt]
[dba]
[opcache]
opcache.enable=1
opcache.enable_cli=0
opcache.memory_consumption=256
opcache.interned_strings_buffer=12
opcache.max_accelerated_files=65406
opcache.use_cwd=1
opcache.validate_timestamps=0
opcache.save_comments=1
opcache.load_comments=1
opcache.fast_shutdown=1
opcache.enable_file_override=1
opcache.error_log=/var/log/php7.0-opcache.log
opcache.log_verbosity_level=2
[curl]
[openssl]

/etc/php/7.0/fpm/pool.d/www.conf

[www]
user = www-data
group = www-data
listen = /run/php/php7.0-fpm.sock
listen.owner = www-data
listen.group = www-data
pm = dynamic
pm.max_children = 40
pm.start_servers = 15
pm.min_spare_servers = 15
pm.max_spare_servers = 25
pm.max_requests = 500

Relevent Packages Installed

rc  libapache2-mod-php7.0                7.0.14-1~dotdeb+8.1                  amd64        server-side, HTML-embedded scripting language (Apache 2 module)
ii  php7.0                               7.0.14-1~dotdeb+8.1                  all          server-side, HTML-embedded scripting language (metapackage)
ii  php7.0-bcmath                        7.0.14-1~dotdeb+8.1                  amd64        Bcmath module for PHP
ii  php7.0-cli                           7.0.14-1~dotdeb+8.1                  amd64        command-line interpreter for the PHP scripting language
ii  php7.0-common                        7.0.14-1~dotdeb+8.1                  amd64        documentation, examples and common module for PHP
ii  php7.0-curl                          7.0.14-1~dotdeb+8.1                  amd64        CURL module for PHP
ii  php7.0-dev                           7.0.14-1~dotdeb+8.1                  amd64        Files for PHP7.0 module development
ii  php7.0-fpm                           7.0.14-1~dotdeb+8.1                  amd64        server-side, HTML-embedded scripting language (FPM-CGI binary)
ii  php7.0-gd                            7.0.14-1~dotdeb+8.1                  amd64        GD module for PHP
ii  php7.0-igbinary                      2.0.1-1~dotdeb+8.1                   amd64        igbinary serializer for PHP
ii  php7.0-imagick                       3.4.2-1~dotdeb+8.2                   amd64        Provides a wrapper to the ImageMagick library
ii  php7.0-intl                          7.0.14-1~dotdeb+8.1                  amd64        Internationalisation module for PHP
ii  php7.0-json                          7.0.14-1~dotdeb+8.1                  amd64        JSON module for PHP
ii  php7.0-mbstring                      7.0.14-1~dotdeb+8.1                  amd64        MBSTRING module for PHP
ii  php7.0-mcrypt                        7.0.14-1~dotdeb+8.1                  amd64        libmcrypt module for PHP
ii  php7.0-mysql                         7.0.14-1~dotdeb+8.1                  amd64        MySQL module for PHP
ii  php7.0-opcache                       7.0.14-1~dotdeb+8.1                  amd64        Zend OpCache module for PHP
ii  php7.0-pspell                        7.0.14-1~dotdeb+8.1                  amd64        pspell module for PHP
ii  php7.0-readline                      7.0.14-1~dotdeb+8.1                  amd64        readline module for PHP
ii  php7.0-redis                         3.1.0-1~dotdeb+8.2                   amd64        PHP extension for interfacing with Redis
ii  php7.0-soap                          7.0.14-1~dotdeb+8.1                  amd64        SOAP module for PHP
ii  php7.0-xml                           7.0.14-1~dotdeb+8.1                  amd64        DOM, SimpleXML, WDDX, XML, and XSL module for PHP
ii  php7.0-xmlrpc                        7.0.14-1~dotdeb+8.1                  amd64        XMLRPC-EPI module for PHP
ii  php7.0-xsl                           7.0.14-1~dotdeb+8.1                  all          XSL module for PHP (dummy)
ii  php7.0-zip                           7.0.14-1~dotdeb+8.1                  amd64        Zip module for PHP
ii  php5-redis                           2.2.5-1                              amd64        PHP extension for interfacing with Redis
ii  php7.0-redis                         3.1.0-1~dotdeb+8.2                   amd64        PHP extension for interfacing with Redis
ii  redis-server                         2:3.2.6-1~dotdeb+8.1                 amd64        Persistent key-value database with network interface
ii  redis-tools                          2:3.2.6-1~dotdeb+8.1                 amd64        Persistent key-value database with network interface (client)
ii  libnginx-mod-http-auth-pam           1.10.2-2~dotdeb+8.2                  amd64        PAM authentication module for Nginx
ii  libnginx-mod-http-geoip              1.10.2-2~dotdeb+8.2                  amd64        GeoIP HTTP module for Nginx
ii  libnginx-mod-http-image-filter       1.10.2-2~dotdeb+8.2                  amd64        HTTP image filter module for Nginx
ii  libnginx-mod-http-lua                1.10.2-2~dotdeb+8.2                  amd64        LUA module for Nginx
ii  libnginx-mod-http-ndk                1.10.2-2~dotdeb+8.2                  amd64        Nginx Development Kit module
ii  libnginx-mod-http-perl               1.10.2-2~dotdeb+8.2                  amd64        Perl module for Nginx
ii  libnginx-mod-http-xslt-filter        1.10.2-2~dotdeb+8.2                  amd64        XSLT Transformation module for Nginx
ii  libnginx-mod-mail                    1.10.2-2~dotdeb+8.2                  amd64        Mail module for Nginx
ii  libnginx-mod-stream                  1.10.2-2~dotdeb+8.2                  amd64        Stream module for Nginx
ii  nginx-common                         1.10.2-2~dotdeb+8.2                  all          small, powerful, scalable web/proxy server - common files
ii  nginx-extras                         1.10.2-2~dotdeb+8.2                  amd64        nginx web/proxy server (extended version)

Magento2/app/etc/env.php

<?php
return array (
  'backend' =>
  array (
    'frontName' => 'admin',
  ),
  'crypt' =>
  array (
    'key' => 'crypkeyhere',
  ),
  'session' =>
  array (
    'save' => 'redis',
    'redis' =>
    array (
      'host' => '/var/run/redis/redis.sock',
      'port' => '0',
      'password' => 'passwordhere',
      'timeout' => '2.5',
      'persistent_identifier' => '',
      'database' => '0',
      'compression_threshold' => '2048',
      'compression_library' => 'gzip',
      'log_level' => '1',
      'max_concurrency' => '6',
      'break_after_frontend' => '5',
      'break_after_adminhtml' => '30',
      'first_lifetime' => '600',
      'bot_first_lifetime' => '60',
      'bot_lifetime' => '7200',
      'disable_locking' => '0',
      'min_lifetime' => '60',
      'max_lifetime' => '2592000',
    ),
  ),
  'cache' =>
  array (
    'frontend' =>
    array (
      'default' =>
      array (
        'backend' => 'Cm_Cache_Backend_Redis',
        'backend_options' =>
        array (
          'server' => '/var/run/redis/redis.sock',
          'port' => '0',
          'password' => passwordhere',
        ),
      ),
      'page_cache' =>
      array (
        'backend' => 'Cm_Cache_Backend_Redis',
        'backend_options' =>
        array (
          'server' => '/var/run/redis/redis.sock',
          'port' => '0',
          'password' => 'passwordhere',
          'database' => '1',
          'compress_data' => '0',
        ),
      ),
    ),
  ),
  'db' =>
  array (
    'table_prefix' => '',
    'connection' =>
    array (
      'default' =>
      array (
        'host' => 'localhost',
        'dbname' => 'dbusedhere',
        'username' => 'dbuserhere',
        'password' => 'dbpasswordhere',
        'model' => 'mysql4',
        'engine' => 'innodb',
        'initStatements' => 'SET NAMES utf8;',
        'active' => '1',
      ),
    ),
  ),
  'resource' =>
  array (
    'default_setup' =>
    array (
      'connection' => 'default',
    ),
  ),
  'x-frame-options' => 'SAMEORIGIN',
  'MAGE_MODE' => 'developer',
  'http_cache_hosts' =>
  array (
    0 =>
    array (
      'host' => '127.0.0.1',
      'port' => '6018',
    ),
  ),
  'cache_types' =>
  array (
    'config' => 0,
    'layout' => 0,
    'block_html' => 0,
    'collections' => 0,
    'reflection' => 0,
    'db_ddl' => 0,
    'eav' => 0,
    'customer_notification' => 0,
    'full_page' => 0,
    'config_integration' => 0,
    'config_integration_api' => 0,
    'translate' => 0,
    'config_webservice' => 0,
    'compiled_config' => 1,
  ),
  'install' =>
  array (
    'date' => 'Fri, 16 Sep 2016 00:18:58 +0000',
  ),
);

Thanks for all you do.

gplessis commented 7 years ago

Could you please let me know if the latest packages (version 3.1.0-1~dotdeb+8.3) fix the issue? They include most of the changes that will be included in the upcoming 3.1.1 upstream version.

luispabon commented 7 years ago

To be fair, it's common practice to report first to the package maintainers on all distros when there're issues, in this case indeed dotdeb. Could be a bad interaction with the specific libs it's linked to for instance. In this case it isn't tho.

On Thu, Jan 5, 2017 at 2:16 AM Guillaume Plessis notifications@github.com wrote:

Could you please let me know if the latest packages (version 3.1.0-1~dotdeb+8.3) fix the issue? They include most of the changes that will be included in the upcoming 3.1.1 upstream version.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gplessis/dotdeb-php/issues/159#issuecomment-270546101, or mute the thread https://github.com/notifications/unsubscribe-auth/AGF8VzDQNziON9rF4xy75l4JjmbVR09Tks5rPFJ8gaJpZM4LU5YF .

-- Kind regards, Luis Pabon

gplessis commented 7 years ago

Does it still segfault?

ikk0 commented 7 years ago

@gplessis: I'm not sure the fix you applied (https://github.com/gplessis/dotdeb-php-redis/commit/b74518b43ad49846b35481190bf3c0c2e8f71cdf) is relevant. According to official phpredis repository, this fixes the segfault: https://github.com/phpredis/phpredis/commit/335c05847c325099a13bd4e7d912575452f23015 (See: https://github.com/phpredis/phpredis/issues/1076#issuecomment-270041318)

azeemism commented 7 years ago

@gplessis , yes it still segfaults even with version 3.1.0-1~dotdeb+8.3

Just install and tried. Had to roll back to working version: apt-get install php7.0-redis=3.0.0~rc1-1~dotdeb+8.2

olivier-monaco commented 7 years ago

Hello,

I have the same problem. Here a backtrace from a core dump:

#0  0x00007fbc62363200 in ?? ()
#1  0x00005653dc1a8b9e in _php_stream_write_buffer (stream=0x7fbc77058e00, buf=0x7fbc6204aaa0 "*2\r\n$6\r\nSELECT\r\n$1\r\n3\r\n", count=23)
    at /usr/src/builddir/main/streams/streams.c:1116
#2  0x00005653dc1aa6ad in _php_stream_write (stream=0x7fbc77058e00, buf=<optimized out>, count=<optimized out>) at /usr/src/builddir/main/streams/streams.c:1231
#3  0x00007fbc6878ffc2 in redis_sock_write () from /usr/lib/php/20151012/redis.so
#4  0x00007fbc687773b4 in zim_Redis_select () from /usr/lib/php/20151012/redis.so
#5  0x00005653dc277ee6 in ZEND_DO_FCALL_SPEC_HANDLER () at /usr/src/builddir/Zend/zend_vm_execute.h:842
#6  0x00005653dc232c2b in execute_ex (ex=<optimized out>) at /usr/src/builddir/Zend/zend_vm_execute.h:414
#7  0x00005653dc1e44d5 in zend_call_function (fci=fci@entry=0x7ffe7538b380, fci_cache=0x7fbc632be6d8, fci_cache@entry=0x0) at /usr/src/builddir/Zend/zend_execute_API.c:858
#8  0x00005653dc1e48d9 in call_user_function_ex (function_table=<optimized out>, object=object@entry=0x0, function_name=<optimized out>,
    retval_ptr=retval_ptr@entry=0x7ffe7538b430, param_count=param_count@entry=1, params=params@entry=0x7ffe7538b420, no_separation=1, symbol_table=0x0)
    at /usr/src/builddir/Zend/zend_execute_API.c:675
#9  0x00005653dc1e490d in call_user_function (function_table=<optimized out>, object=object@entry=0x0, function_name=<optimized out>, retval_ptr=retval_ptr@entry=0x7ffe7538b430,
    param_count=param_count@entry=1, params=params@entry=0x7ffe7538b420) at /usr/src/builddir/Zend/zend_execute_API.c:657
#10 0x00005653dc0f473d in ps_call_handler (func=<optimized out>, argc=argc@entry=1, argv=argv@entry=0x7ffe7538b420, retval=retval@entry=0x7ffe7538b430)
    at /usr/src/builddir/ext/session/mod_user.c:33
#11 0x00005653dc0f49c5 in ps_read_user (mod_data=<optimized out>, key=<optimized out>, val=0x7ffe7538b490, maxlifetime=<optimized out>)
    at /usr/src/builddir/ext/session/mod_user.c:129
#12 0x00005653dc0f23ec in zif_session_regenerate_id (execute_data=<optimized out>, return_value=0x7fbc77014ea0) at /usr/src/builddir/ext/session/session.c:2146
#13 0x00005653dc2419fd in ZEND_DO_ICALL_SPEC_HANDLER () at /usr/src/builddir/Zend/zend_vm_execute.h:586
#14 0x00005653dc232c2b in execute_ex (ex=<optimized out>) at /usr/src/builddir/Zend/zend_vm_execute.h:414
#15 0x00005653dc287877 in zend_execute (op_array=0x7fbc7707e000, op_array@entry=0x7fbc6344ba88, return_value=return_value@entry=0x7fbc77014e30)
    at /usr/src/builddir/Zend/zend_vm_execute.h:458
#16 0x00005653dc1f2cb3 in zend_execute_scripts (type=type@entry=8, retval=0x7fbc77014e30, retval@entry=0x0, file_count=file_count@entry=3) at /usr/src/builddir/Zend/zend.c:1437
#17 0x00005653dc192990 in php_execute_script (primary_file=0x7ffe7538daf0) at /usr/src/builddir/main/main.c:2494
#18 0x00005653dc079765 in main (argc=-571662921, argv=0x5653dded1e64) at /usr/src/builddir/sapi/fpm/fpm/fpm_main.c:1968
olivier-monaco commented 7 years ago

Not sure but maybe the problem come when we close than open again the redis conneciton. Here is a a minimal use case:

<?php
$r = new Redis();        
$r->connect('xxx', 6379);
$r->select(3);
$r->close();
$r->connect('xxx', 6379);
$r->select(4);

This gives me the same backtrace:

#0  0x00007ffff5e6f500 in ?? ()
#1  0x000055555576e3de in _php_stream_write_buffer (stream=0x7ffff5e6f300, buf=0x7ffff5e72000 "*2\r\n$6\r\nSELECT\r\n$1\r\n4\r\n", count=23)
    at /usr/src/builddir/main/streams/streams.c:1116
#2  0x000055555576feed in _php_stream_write (stream=0x7ffff5e6f300, buf=<optimized out>, count=<optimized out>) at /usr/src/builddir/main/streams/streams.c:1231
#3  0x00007fffe6c8ffc2 in redis_sock_write () from /usr/lib/php/20151012/redis.so
#4  0x00007fffe6c773b4 in zim_Redis_select () from /usr/lib/php/20151012/redis.so
#5  0x000055555583d726 in ZEND_DO_FCALL_SPEC_HANDLER () at /usr/src/builddir/Zend/zend_vm_execute.h:842
#6  0x00005555557f846b in execute_ex (ex=<optimized out>) at /usr/src/builddir/Zend/zend_vm_execute.h:414
...

@gplessis From https://github.com/phpredis/phpredis/issues/958 seems to come from an dev env problem.

olivier-monaco commented 7 years ago

Note: we have the problem only with a Redis 3.2 server, not with a Redis 3.0 server.

olivier-monaco commented 7 years ago

@azeemism I don't know for Magento 2 but on 1.9.3, the Credis_Client class is used for Redis connection. This class supports à "standalone" option. You can, as a workaround, change lib/Credis/Client.php, ligne 296 (in __construct) to:

$this->standalone = true;

(not tested)

gplessis commented 7 years ago

3.1.0-1~dotdeb+8.4 packages have just been published. They include the patch mentioned by @ikk0. Please advise.

olivier-monaco commented 7 years ago

@gplessis Works fine with 3.1.0-1~dotdeb+8.4. Thanks.

gplessis commented 7 years ago

Thanks for your feedback and sorry for the delay of the fix.

luispabon commented 7 years ago

Thank you, this also solves my queueing problems :+1: