Page 1 of 1

Getting core dumps

Posted: Wed Nov 19, 2008 8:55 pm
by minneapolis_dan
I added this text already to an ongoing discussion, but since it is marked "solved", I thought perhaps I should start a new topic.

I'm getting these core dumps, on two different CMSms installs. My server administrator looked at the core files, and the source appears to be stylesheet.php.

If it means anything to anyone, I'll paste what he found  below:


Here's a backtrace:

#0  0x008552dc in memcpy () from /lib/tls/libc.so.6
#1  0x08272843 in _php_stream_copy_to_mem (src=0xb7f14e1c, buf=0xbfeb92f8, maxlen=3085779132, persistent=0)
    at /home/cpeasyapache/src/php-5.2.5/main/streams/streams.c:1223
#2  0x08200ad6 in zif_file (ht=1, return_value=0xb7f447e8, return_value_ptr=0x0, this_ptr=0x0, return_value_used=1)
    at /home/cpeasyapache/src/php-5.2.5/ext/standard/file.c:741
#3  0x00f9b8cb in get_module () from /usr/local/Zend/lib/Optimizer-3.3.0/php-5.2.x/ZendOptimizer.so
#4  0x00000001 in ?? ()
#5  0xb7f447e8 in ?? ()
#6  0x00000000 in ?? ()


and below is the _php_stream_copy_to_mem() function from /home/cpeasyapache/src/php-5.2.5/main/streams/streams.c, which shows the start of the function up to line 1225:

    1196 PHPAPI size_t _php_stream_copy_to_mem(php_stream *src, char **buf, size_t maxlen, int persistent STREAMS_DC TSRMLS_DC)
    1197 {
    1198        size_t ret = 0;
    1199        char *ptr;
    1200        size_t len = 0, max_len;
    1201        int step = CHUNK_SIZE;
    1202        int min_room = CHUNK_SIZE / 4;
    1203        php_stream_statbuf ssbuf;
    1204
    1205        if (maxlen == 0) {
    1206                return 0;
    1207        }
    1208
    1209        if (maxlen == PHP_STREAM_COPY_ALL) {
    1210                maxlen = 0;
    1211        }
    1212
    1213        if (php_stream_mmap_possible(src)) {
    1214                char *p;
    1215                size_t mapped;
    1216
    1217                p = php_stream_mmap_range(src, php_stream_tell(src), maxlen, PHP_STREAM_MAP_MODE_SHARED_READONLY, &mapped);
    1218
    1219                if (p && mapped) {
    1220                        *buf = pemalloc_rel_orig(mapped + 1, persistent);
    1221
    1222                        if (*buf) {
    1223                                memcpy(*buf, p, mapped);
    1224                                (*buf)[mapped] = '\0';
    1225                        }


On line 1223, which is where the crash occurred, there is a memcpy() syscall, which attempts to copy an area of memory from one location to another. A possible cause of a crash could be due to bad memory on the server, but that is not the case here, as the memory on the server is fine.

Re: Getting core dumps

Posted: Wed Nov 19, 2008 9:07 pm
by Ted
Sounds like a bug in ZendOptimizer to me.  Anything we're doing isn't nearly low level enough to crash php...  it would have to be a php or php module bug.

It could be possible that it's not liking a =& call somewhere.  But let's be honest, if it wasn't valid, php wouldn't compile it in the first place.

I'd start with either upgrading PHP or taking out Zend Optimizer and see what happens.

Re: Getting core dumps

Posted: Thu Nov 20, 2008 6:56 pm
by minneapolis_dan
Thanks for looking at this. I'm running PHP version 5.2.5 and Zend optimizer 3.3.0.

I don't have control over these versions, but they seem pretty up to date to me? I guess if more people experience this and report it, we'll have more to go off of. I did talk with another poster here who had this issue, and that forum was marked "sovled" but I discovered that it's actually still happening to him (or her). They just delete the core files periodically.

I really don't know what to do, except keep deleting them and hope the problem goes away.