Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Cluster segfault when invalid LUA is evaluated #1105

@albertofem

Description

@albertofem

This one is easy to reproduce:

  • Create a test with the following code:
public function testEvalWithSyntaxError() {
    $scr = "return KEYS[1,]";

    $result = $this->redis->eval($scr, Array(0), 1);

    $this->assertFalse($result);
}
  • Run cluster tests

At some point (it seems random), the process will segfault with the following trace:

* thread #1: tid = 0x0000, 0x000000010afec631 php`_emalloc + 204, stop reason = signal SIGSTOP
  * frame #0: 0x000000010afec631 php`_emalloc + 204
    frame #1: 0x000000010b011810 php`add_assoc_string_ex + 54
    frame #2: 0x000000010c125c83 redis.so`redis_parse_info_response(response=<unavailable>, z_ret=<unavailable>) + 275 at library.c:970 [opt]
    frame #3: 0x000000010c142bba redis.so`cluster_info_resp(execute_data=<unavailable>, return_value=0x000000010c217ad0, c=0x0000000112345000, ctx=<unavailable>) + 58 at cluster_library.c:2034 [opt]
    frame #4: 0x000000010c13ba6e redis.so`zim_RedisCluster_info(execute_data=0x000000010c217b30, return_value=0x000000010c217ad0) + 382 at redis_cluster.c:2755 [opt]
    frame #5: 0x000000010b060c4c php`ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER + 667
    frame #6: 0x000000010b04b36f php`execute_ex + 44
    frame #7: 0x000000010b04b5e7 php`zend_execute + 551
    frame #8: 0x000000010b00de96 php`zend_execute_scripts + 307
    frame #9: 0x000000010afb59e2 php`php_execute_script + 770
    frame #10: 0x000000010b0aa11f php`do_cli + 3806
    frame #11: 0x000000010b0a90b8 php`main + 1249
    frame #12: 0x00007fff979665ad libdyld.dylib`start + 1

It seems to be some issue with the INFO parse function, but my knowledge of this library is limited and can't work on a fix.

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