php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15956 Difficult to say in brief. I have included some output from gdb
Submitted: 2002-03-08 07:36 UTC Modified: 2002-05-26 13:46 UTC
From: K dot Steven at alkazar dot net Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.0CVS-2002-03-08 OS: RedHat 7.1
Private report: No CVE-ID: None
 [2002-03-08 07:36 UTC] K dot Steven at alkazar dot net
To whoever reads this.

This is quite complicated (for me) so please bear with me.
I have a script run from the command line that makes a MySQL connection, scans a table for data, if the table is empty it sleeps() for 5 seconds then scans again. Once it finds a message, it outputs the data to a pager transmitter.

Everything appears to function well for a couple of hours or so but then it just produces a core dump of around 22Mb.

Certainly no expert with gdb (only just found out it existed when trying to submit a bug report), I have extracted the only lines that appear with information in them. Just using the example 
int (char *)(executor_globals.function_state_ptr->function)->common.function_name
on the gdb backtrace page produced
this:
"Attempt to extract a component of a value that is not a structure."

The only reason I came to submit it as a bug is because using od -c core I came accross this:

0020640 C a n n o t  i n c r e m e n t
0020660 / d e c r e  m e n t o v e r l
0020700 o a d e d o b j e c t s  n   o
0020720 r s t r i n g  o f f s e t s
0020740 \0 U n d e f i n e d  c l a s s
0020760 n a m e ' % s ' \0 t h i s  \0
0021000 C a l l  t o a  m e m b e r
0021020 f u n c t i o n  o n  a n
0021040 o n - o b j e c t \0 B u g : P
0021060 r o b l e m i n  m e t h o d
0021100 c a l l \n \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
0021140 C a l l t o  u n d e f i n e
0021160 d f u n c t i o n : % s (
0021200 ) \0 U n k n o w n f u n c t i
0021220 o n : % s ( ) \n \0 \0 \0 \0 \0 \0
0021240 P r o b l e m  w i t h  m e t
0021260 h o d   c a l l . R e p o r t
0021300 t h i s   b u g  \n  \0  \0  \0  \0  \0  \0
And I have mmm.... one or two of these :)

The only lines from gdb (exept for lots and lots of 
#24 0x081167d7 in execute ()
#25 0x081167d7 in execute ())
are these:

#0  0x4026243c in _IO_vfprintf (s=0xbf8005a0, format=0x405e6d6d "mysql_%s_%s_%s",
    ap=0xbf800688) at vfprintf.c:231
#1  0x40280202 in _IO_vsprintf (string=0x8c98fa4 "db_server_password",
    format=0x405e6d6d "mysql_%s_%s_%s", args=0xbf800688) at iovsprintf.c:47
#2  0x4026c677 in sprintf (s=0x8c98fa4 "db_server_password",
    format=0x405e6d6d "mysql_%s_%s_%s") at sprintf.c:38
#3  0x405e33e7 in php_mysql_do_connect () from /usr/lib/php4/mysql.so
#4  0x405e39dd in php_if_mysql_connect () from /usr/lib/php4/mysql.so
#5  0x081165ef in execute ()
#6  0x081167d7 in execute ()

#1304 0x081167d7 in execute ()
#1305 0x081167d7 in execute ()
#1306 0x080e3dc5 in zend_execute_scripts ()
#1307 0x08061cc4 in php_execute_script ()
#1308 0x0805fd5e in main ()
#1309 0x40229177 in __libc_start_main (main=0x805f370 <main>, argc=3, ubp_av=0xbffffb0c,
    init=0x805d904 <_init>, fini=0x812073c <_fini>, rtld_fini=0x4000e184 <_dl_fini>,
    stack_end=0xbffffafc) at ../sysdeps/generic/libc-start.c:129

#1307 0x08061cc4 in php_execute_script ()
(gdb) print (char *)(executor_globals.function_state_ptr->function)->common.function_name
Attempt to extract a component of a value that is not a structure.

Finally we have the function:

function scan_mq(){
  db_connect() or die('Unable to connect to database server!');
  $mq_query="SELECT id, message_from, message_to, message, priority, time, email_friendly_name, email_message_id, button_type, battery_status from mq group by priority,time";
  $mq=mysql_query($mq_query) or die("query failed");
	$num_rows = mysql_num_rows($mq);
	while($num_rows <= 0){
	sleep(5);
//db_free_result($delete_message_from_mq_query);
  db_close($mq);
	scan_mq(); // Repeats the function if the message queue is empty.
	}
blah de blah.......

Perhaps upgrading from 4.0.4pl1 to the latest might fix the problem but I thought I should submit this anyway.
If you need any more details, core file (?) or anything just mail me and I will do what I can.

Best to all.

Ken Steven

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-26 13:46 UTC] derick@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately your version of PHP is too old -- the problem
might already be fixed. Please download a new PHP
version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 02:01:30 2024 UTC