Git Product home page Git Product logo

Comments (12)

laruence avatar laruence commented on May 29, 2024

能把backtrace贴出来么?

from yac.

gobattle avatar gobattle commented on May 29, 2024

截取了部分core dump的信息

== ProcStatus =================================
Name:   php5-fpm
State:  S (sleeping)
Tgid:   20733
Pid:    20733
PPid:   20578
TracerPid:      0
Uid:    33      33      33      33
Gid:    33      33      33      33
FDSize: 512
Groups: 33
VmPeak:  1530832 kB
VmSize:  1509568 kB
VmLck:         0 kB
VmPin:         0 kB
VmHWM:     74692 kB
VmRSS:     71464 kB
VmData:    83828 kB
VmStk:       136 kB
VmExe:      7168 kB
VmLib:     30120 kB
VmPTE:       756 kB
VmSwap:        0 kB
Threads:        1

...
7f42a15df000-7f42a15e9000 r-xp 00000000 fc:00 2490924                    /usr/lib/php5/20100525/yac.so
7f42a15e9000-7f42a17e8000 ---p 0000a000 fc:00 2490924                    /usr/lib/php5/20100525/yac.so
7f42a17e8000-7f42a17e9000 r--p 00009000 fc:00 2490924                    /usr/lib/php5/20100525/yac.so
7f42a17e9000-7f42a17ea000 rw-p 0000a000 fc:00 2490924                    /usr/lib/php5/20100525/yac.so
...
7fff90468000-7fff90489000 rw-p 00000000 00:00 0                          [stack]

...


== SegvAnalysis =================================
Segfault happened at: 0x7f42a15e4995:   Cannot access memory at address 0x7f42a15e4995
PC (0x7f42a15e4995) ok
SP (0x7fff90481da0) ok
Reason could not be automatically determined.

== Signal =================================
11

== SourcePackage =================================
php5

== Stacktrace =================================
#0  0x00007f42a15e4995 in ?? ()
No symbol table info available.
Cannot access memory at address 0x7fff90481da0

== StacktraceTop =================================
?? ()

== Tags =================================
precise

== ThreadStacktrace =================================
.
Thread 1 (LWP 20733):
#0  0x00007f42a15e4995 in ?? ()
No symbol table info available.
Cannot access memory at address 0x7fff90481da0

== Title =================================
php5-fpm crashed with SIGSEGV

因为团队里无人有php extension的开发经验,如何打印出更详细的backtrace还请鸟哥指点,thx!

from yac.

gobattle avatar gobattle commented on May 29, 2024

update:

dump出来了更详细的信息:

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `php a.php'.
Program terminated with signal 11, Segmentation fault.
#0  0x00007fb3cc9baef8 in yac_storage_update () from /usr/lib/php5/20100525/yac.so

请笑纳

from yac.

laruence avatar laruence commented on May 29, 2024

Hey: 关于如何生成backtrace: http://bugs.php.net/bugs-generating-backtrace.php

如果你有core文件, 那就直接gdb php -c core文件, 然后backtrace命令就可以了

看起来你有100%可重现的测试脚本? 如果有, 也提供一下吧 :) thanks

from yac.

gobattle avatar gobattle commented on May 29, 2024

多谢鸟哥指点

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `php a.php'.
Program terminated with signal 11, Segmentation fault.
#0  0x00007f23ccc5cef8 in yac_storage_update () from /usr/lib/php5/20100525/yac.so
(gdb) backtrace
#0  0x00007f23ccc5cef8 in yac_storage_update () from /usr/lib/php5/20100525/yac.so
#1  0x00007f23ccc5a6f8 in yac_add_impl () from /usr/lib/php5/20100525/yac.so
#2  0x00007f23ccc5b4ea in zim_yac_set () from /usr/lib/php5/20100525/yac.so
#3  0x00000000007601d2 in ?? ()
#4  0x0000000000719a17 in execute ()
#5  0x00000000006b984c in zend_execute_scripts ()
#6  0x0000000000658c53 in php_execute_script ()
#7  0x0000000000762803 in ?? ()
#8  0x000000000042c420 in ?? ()
#9  0x00007f23cd9c176d in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6
#10 0x000000000042c4b5 in _start ()

重现的脚本很简单,把key space设置成8M后,在脚本里不停地 set ,差不多用掉 2w 个slots以后就会 segment fault 。如果使用 4M 的key space就不会有这个问题。

<?php
$yac = new Yac();
$i = 0;
while (true) {
  $yac->set(rand(), rand(), 2);
  $i++;
  if ($i > 20000) {
    break;
  }
}

from yac.

gobattle avatar gobattle commented on May 29, 2024

这个情况跟 key 的长度也有关系,如果把 rand() 换成 rand(0, 10000) 就无法重现了。

from yac.

laruence avatar laruence commented on May 29, 2024

好的, 我尝试重现一下, 你们的yac编译的时候, 应该是没有加-g, 所以导致堆栈信息基本上没有用.
你们也可以尝试改成128M看看. sorry for that..

from yac.

gobattle avatar gobattle commented on May 29, 2024

我们是

phpize
./configure
sudo make

这样编译的,应该如何加上 -g 参数呢?

如果把 yac.keys_memory_size 改成128M,那个脚本跑到差不多7w次的时候也会出seg fault。

还要多谢鸟哥的作品 :)

from yac.

laruence avatar laruence commented on May 29, 2024

已经修复, 你更新下代码吧. thanks

from yac.

gobattle avatar gobattle commented on May 29, 2024

ok,没问题了 :)

from yac.

laruence avatar laruence commented on May 29, 2024

恩, 如果有其他问题, 你可以直接写邮件给我, issue的反应可能会比较慢. 或者微博私信.

from yac.

gobattle avatar gobattle commented on May 29, 2024

ok.

from yac.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.