[RESOLVED] Core dumps not generated in PHP 5.3

Discussion in 'PHP' started by rm31, May 12, 2010.

  1. rm31

    rm31 New Member

    Hi,

    I've been trying to debug php crashes. The problem is similar to what others have posted here in the past - 503 errors, load goes through the roof, etc. We've tried several different combinations of php, litespeed, and apc. PHP 5.3.1 with APC and LSAPI 5.3 seems to be working best (always tried PHP without APC first to make sure APC didn't introduce more problems).

    When we were on 5.2.10, LSAPI_ALLOW_CORE_DUMP worked fine to generate core.xxxx files in the docroot directories. But the newer php versions haven't been generating core files - PHP 5.3 definitely doesn't and I think 5.2.13 didn't either.

    Is this a known issue? Are there any workarounds to still get core dumps? The core dump was pretty helpful in determining that most of the crashes were centered around unserializing objects after retrieval from memcache. We modified our __sleep/__wakeup methods to make sure not so much data was serialized and the problem has gone away.

    We had crashes in 5.3.2, but since we weren't finding core dump files, I couldn't debug it. Going to 5.3.1 fixed the crashes. Maybe there's a way to specify the directory for litespeed to place the core dumps? I did a unix "find" in case the location moved, but didn't get any results.

    Thanks a lot!!
  2. mistwang

    mistwang LiteSpeed Staff

    You can run "ulimit -a" from PHP see if you get none-zero "core file size". If it is non-zero, you should check the permission of the directory that core dump file should be created in.
  3. rm31

    rm31 New Member

    Thanks for the reply. I ran "echo `ulimit -a`" from a php script through litespeed and it looks like core file size is correctly set to unlimited:

    core file size (blocks, -c) unlimited
    data seg size (kbytes, -d) unlimited
    scheduling priority (-e) 0
    file size (blocks, -f) unlimited
    pending signals (-i) 8256
    max locked memory (kbytes, -l) 32
    max memory size (kbytes, -m) unlimited
    open files (-n) 1500
    pipe size (512 bytes, -p) 8
    POSIX message queues (bytes, -q) 819200
    real-time priority (-r) 0
    stack size (kbytes, -s) 10240
    cpu time (seconds, -t) unlimited
    max user processes (-u) 400
    virtual memory (kbytes, -v) 524288
    file locks (-x) unlimited

    All of my docroot directories have write permissions for litespeed which is the user for lsphp5. Maybe the core dump file is trying to get created somewhere else? Again, this was working before in php 5.2.
  4. mistwang

    mistwang LiteSpeed Staff

  5. rm31

    rm31 New Member

    Thanks a lot for your help! I found that lsws/fcgi-bin was only writable to root. Opening it to litespeed did the trick. So it seems that the core dump location moved at some point from the php script dir to the lsphp5 dir.

    And from the core dumps, it seems that they're occuring during shutdown and some other points when linking libraries - no php user functions in the backtrace. I'm on 64-bit CentOS 5. I noticed that at some point I must have lost "--with-libdir=lib64" from my php configure, so I pretty sure that's the problem. Thanks again.
  6. mistwang

    mistwang LiteSpeed Staff

    If it crashes in middle of a request, the core file will be in the directory that the script located, if it crash after a request complete, the core file will be under fcgi-bin/ directory.

Share This Page