Page 1 of 1

[Solved] Getting Core Dumps from stylesheet.php in version 1.4.1

Posted: Mon Sep 22, 2008 4:55 pm
by pjb@godiva
Greetings from a first time poster.

I'm running version CMSMadeSimple 1.4.1 with php version 4.4.6 on a linux server.  I started getting core dump files on the system and, using gbd to examine them found that all were generated by stylesheet.php.  The script is terminated with signal 7 (bus error) and a core dump.   Examining my server error logs, it seems like all incidents of a dump correlate  with  a "Premature end of script header" error in stylesheet.php.

This error does not cause the site to crash, but the accumulating core dump files are of course not a good thing -- even if they can be deleted safely.

Any ideas for a fix?

Re: Getting Core Dumps from stylesheet.php in version 1.4.1

Posted: Mon Sep 22, 2008 5:00 pm
by alby
pjb@godiva wrote: I'm running version CMSMadeSimple 1.4.1 with php version 4.4.6 on a linux server.  I started getting core dump files on the system and, using gbd to examine them found that all were generated by stylesheet.php.  The script is terminated with signal 7 (bus error) and a core dump.   Examining my server error logs, it seems like all incidents of a dump correlate  with  a "Premature end of script header" error in stylesheet.php.
Stylesheets are there or site not display them?

Alby

Re: Getting Core Dumps from stylesheet.php in version 1.4.1

Posted: Mon Sep 22, 2008 7:24 pm
by pjb@godiva
Yes,  the stylesheets are there and doing their job; the site is otherwise fully functional.  But I continue to pick up core dumps.

Re: Getting Core Dumps from stylesheet.php in version 1.4.1

Posted: Tue Sep 23, 2008 2:03 am
by duclet
What modules do you have installed? Despite what it seems, stylesheet.php does end up loading all the modules you have installed so there might be a case where you have a module that requires PHP5+. That, or if you are using Apache as a CGI module, the script might be terminated prematurely by your host.

Re: Getting Core Dumps from stylesheet.php in version 1.4.1

Posted: Tue Sep 23, 2008 12:02 pm
by pjb@godiva
The only module I've added is Album 0.9.3 -- otherwise, all other modules are those supplied in the cms 1.4.1 default installation.

Re: [Solved] Getting Core Dumps from stylesheet.php in version 1.4.1

Posted: Tue Sep 23, 2008 6:25 pm
by pjb@godiva
The problem appears to have been that a well meaning site editor had put some malformed html and css onto one of the content pages.  Grr.  Once this was finally found and removed, the core dumps  ceased.

Thanks to those who offered suggestions ...

Re: [Solved] Getting Core Dumps from stylesheet.php in version 1.4.1

Posted: Wed Nov 19, 2008 3:22 pm
by minneapolis_dan
I'm getting these core dumps too, 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.