Getting core dumps
Posted: Wed Nov 19, 2008 8:55 pm
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.
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.