Skip to content

Segmentation fault when execution time of LUA script exceeds timeout #437

@matej21

Description

@matej21

Hi, I'm getting segmentation fault error when execution time of lua script exceeds timeout defined in Redis::connect(), here is example code:

<?php
$lua = '
for y = 1, 10, 1 do
       for i = 1, 100000, 1 do
               redis.call("sAdd", "foo", i)
       end
       for i = 1, 100000, 1 do
               redis.call("sRem", "foo", i)
       end
end
';
$redis = new Redis();
$redis->connect("localhost", NULL, 1);
$sha = $redis->script("load", $lua);
$redis->evalsha($sha);

and here is gdb output:

(gdb) run redis.php
Starting program: /usr/bin/php5 redis.php
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffea0ee700 (LWP 7886)]
[Thread 0x7fffea0ee700 (LWP 7886) exited]

Program received signal SIGSEGV, Segmentation fault.
__memcpy_ssse3_back () at ../sysdeps/x86_64/multiarch/memcpy-ssse3-back.S:2611
2611    ../sysdeps/x86_64/multiarch/memcpy-ssse3-back.S: No such file or directory.
(gdb) bt
#0  __memcpy_ssse3_back () at ../sysdeps/x86_64/multiarch/memcpy-ssse3-back.S:2611
#1  0x000000000067b0c7 in _estrndup ()
#2  0x000000000069e2d4 in _zval_copy_ctor_func ()
#3  0x00007fffea76e4e8 in _zval_copy_ctor (zvalue=0x7ffff7fbb2f8) at /usr/include/php5/Zend/zend_variables.h:45
#4  redis_read_variant_reply (ht=ht@entry=1, return_value=return_value@entry=0x7ffff7fbb2f8, return_value_ptr=return_value_ptr@entry=0x0, 
    this_ptr=this_ptr@entry=0x7ffff7fb9680, return_value_used=return_value_used@entry=0, redis_sock=redis_sock@entry=0x7ffff7fbb568, z_tab=z_tab@entry=0x0)
    at /home/matej21/tmp/phpredis/library.c:1835
#5  0x00007fffea767e2f in zim_Redis_evalsha (ht=1, return_value=0x7ffff7fbb2f8, return_value_ptr=0x0, this_ptr=0x7ffff7fb9680, return_value_used=0)
    at /home/matej21/tmp/phpredis/redis.c:6112
#6  0x0000000000747d21 in ?? ()
#7  0x0000000000701737 in execute ()
#8  0x00000000006a0a9c in zend_execute_scripts ()
#9  0x0000000000640be3 in php_execute_script ()
#10 0x000000000074a6a3 in ?? ()
#11 0x000000000042d080 in ?? ()
#12 0x00007ffff58abea5 in __libc_start_main (main=0x42cbb0, argc=2, ubp_av=0x7fffffffdf98, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, 
    stack_end=0x7fffffffdf88) at libc-start.c:260
#13 0x000000000042d115 in _start ()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions