Bug #49532 [Fbk->NoF]: php5ts.dll access violation exception php5ts!_zend_mm_free_int

From: Date: Tue, 08 Jan 2013 08:07:41 +0000
Subject: Bug #49532 [Fbk->NoF]: php5ts.dll access violation exception php5ts!_zend_mm_free_int
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-175864@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=49532&edit=1

 ID:                 49532
 Updated by:         pajoye@php.net
 Reported by:        matroy at investpsp dot ca
 Summary:            php5ts.dll access violation exception 
                     php5ts!_zend_mm_free_int
-Status:             Feedback
+Status:             No Feedback
 Type:               Bug
 Package:            *General Issues
 Operating System:   win32 only - Windows 2003 SP2
 PHP Version:        5.2.11
 Assigned To:        pajoye
 Block user comment: N
 Private report:     N

 New Comment:

Please try using this snapshot:

  http://snaps.php.net/php5.4-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/




Previous Comments:
------------------------------------------------------------------------
[2011-09-02 14:12:38] skys dot dragooon dot adsss at gmail dot com

I solved my problem.
This error occured with php.exe, php-cgi.exe and php-win.exe, and apache's launch..
In my case, it was due to a co-exist of PHP5.2.x and PHP5.3.x version and the bad use by my PHP5.3.x
of the PHP5.2.x INI file. (PHPRC environment variable pointing to PHP5.2.x INI that I missed)

------------------------------------------------------------------------
[2011-09-02 13:45:07] skys dot dragooon dot adsss at gmail dot com

Always the same error.. with 5.3.6 and 5.3.8... :/

------------------------------------------------------------------------
[2011-03-16 13:39:59] mdurovic at gmail dot com

It looks like httpd crashes after this error msg in the event viewer.

PHP Fatal error:  Maximum execution time of 30 seconds exceeded in
C:\ftproot\LocalUser\linkmarket\framework\common\php\session.class.php on line 71.

That is public function write($id, $data) from the code below:

<?php

class Session
{	
	
	/**
	 * a database connection resource
	 * @var resource
	 */
	private $_sess_db;
	
	/**
	 * Open the session
	 * @return bool
	 */
	public function open() {
		
		if ($this->_sess_db = mysql_connect('server:port',
					'user',
					'pw')) {
			return mysql_select_db('db', $this->_sess_db);
		}
		return false;
		
	}
	
	/**
	 * Close the session
	 * @return bool
	 */
	public function close() {
		
		if(is_resource($this->_sess_db))
		{
			return mysql_close($this->_sess_db);
		}
		
		return false;
	}
	
	/**
	 * Read the session
	 * @param int session id
	 * @return string string of the sessoin
	 */
	public function read($id) {
		
		$id = mysql_real_escape_string($id);
		$sql = sprintf("SELECT data FROM sessions WHERE id = '%s'", $id);
		if ($result = mysql_query($sql, $this->_sess_db))
		{
			if (mysql_num_rows($result))
			{
				$record = mysql_fetch_assoc($result);
				
				//free mysql result
				mysql_free_result($result);
				
				return $record['data'];
			}
		}
		return '';
		
	}
	
	/**
	 * Write the session
	 * @param int session id
	 * @param string data of the session
	 */
	public function write($id, $data) {
		
		$sql = sprintf("REPLACE INTO sessions (id,data,timestamp,ip,url) VALUES('%s',
'%s', '%s','%s','%s')",
				mysql_real_escape_string($id),
				mysql_real_escape_string($data),
				mysql_real_escape_string(time()),
				mysql_real_escape_string($_SERVER['REMOTE_ADDR']),
				mysql_real_escape_string("http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']));
				
		return mysql_query($sql, $this->_sess_db);
		
	}
	
	/**
	 * Destoroy the session
	 * @param int session id
	 * @return bool
	 */
	public function destroy($id) {
		
		$sql = sprintf("DELETE FROM sessions WHERE id = '%s'", $id);
		return mysql_query($sql, $this->_sess_db);
		
	}
	
	/**
	 * Garbage Collector
	 * @param int life time (sec.)
	 * @return bool
	 * @see session.gc_divisor      100
	 * @see session.gc_maxlifetime 1440
	 * @see session.gc_probability    1
	 * @usage execution rate 1/100
	 *        (session.gc_probability/session.gc_divisor)
	 */
	public function gc($max) {
		
		$sql = sprintf("DELETE FROM sessions WHERE timestamp < '%s'",
				mysql_real_escape_string(time() - $max));
		return mysql_query($sql, $this->_sess_db);
		
	}
	
}

//ini_set('session.gc_probability', 50);
ini_set('session.save_handler', 'user');

$session = new Session();
session_set_save_handler(array($session, 'open'),
		array($session, 'close'),
		array($session, 'read'),
		array($session, 'write'),
		array($session, 'destroy'),
		array($session, 'gc'));

?>

------------------------------------------------------------------------
[2011-03-11 00:28:46] pajoye@php.net

Without a script to reproduce your problem we will have no chance to fix it.

------------------------------------------------------------------------
[2011-03-10 21:18:26] mdurovic at gmail dot com

I don't know if this helps but here some more info:

----------------------------------------------------

FAULTING_IP: 
php5ts!_zend_mm_free_int+139 [Zend\zend_alloc.c @ 2019]
006ac699 395f0c          cmp     dword ptr [edi+0Ch],ebx

EXCEPTION_RECORD:  ffffffff -- (.exr 0xffffffffffffffff)
ExceptionAddress: 006ac699 (php5ts!_zend_mm_free_int+0x00000139)
   ExceptionCode: c0000005 (Access violation)
  ExceptionFlags: 00000000
NumberParameters: 2
   Parameter[0]: 00000000
   Parameter[1]: 0000000c
Attempt to read from address 0000000c

PROCESS_NAME:  httpd.exe

ERROR_CODE: (NTSTATUS) 0xc0000005 - The instruction at "0x%08lx" referenced memory at
"0x%08lx". The memory could not be "%s".

EXCEPTION_CODE: (NTSTATUS) 0xc0000005 - The instruction at "0x%08lx" referenced memory at
"0x%08lx". The memory could not be "%s".

EXCEPTION_PARAMETER1:  00000000

EXCEPTION_PARAMETER2:  0000000c

READ_ADDRESS:  0000000c 

FOLLOWUP_IP: 
php5ts!_zend_mm_free_int+139 [Zend\zend_alloc.c @ 2019]
006ac699 395f0c          cmp     dword ptr [edi+0Ch],ebx

MOD_LIST: <ANALYSIS/>

FAULTING_THREAD:  00001624

BUGCHECK_STR:  APPLICATION_FAULT_NULL_CLASS_PTR_DEREFERENCE_INVALID_POINTER_READ

PRIMARY_PROBLEM_CLASS:  NULL_CLASS_PTR_DEREFERENCE

DEFAULT_BUCKET_ID:  NULL_CLASS_PTR_DEREFERENCE

LAST_CONTROL_TRANSFER:  from 006ad6c6 to 006ac699

STACK_TEXT:  
05bafa38 006ad6c6 01997ba0 00001008 00773a64 php5ts!_zend_mm_free_int+0x139 [Zend\zend_alloc.c @
2019]
05bafa44 00773a64 05f9b1c8 019967d0 0089f395 php5ts!_efree+0x36 [Zend\zend_alloc.c @ 2351]
05bafa50 0089f395 0085a0a7 00000001 00000013 php5ts!closelog+0x54 [win32\wsyslog.c @ 71]
05bafa54 0085a0a7 00000001 00000013 019967d0 php5ts!zm_deactivate_syslog+0x5 [ext\standard\syslog.c
@ 122]
05bafa80 006a851c 00000001 00000013 019967d0 php5ts!zm_deactivate_basic+0xe7
[ext\standard\basic_functions.c @ 3789]
05bafa90 00726b72 01063558 019967d0 05bafb08 php5ts!module_registry_cleanup+0x1c [Zend\zend_API.c @
2150]
05bafaac 006a2732 00bff680 006a8500 019967d0 php5ts!zend_hash_reverse_apply+0x42 [Zend\zend_hash.c @
758]
05bafad4 006a2718 05baffa8 00000000 56433230 php5ts!zend_deactivate_modules+0x62 [Zend\zend.c @ 866]
05bafaec 0073f49b 01a0da84 019967d0 0075d1fb php5ts!zend_deactivate_modules+0x48 [Zend\zend.c @ 865]
05bafaf8 0075d1fb 01a0da84 00000000 05bafdd4 php5ts!zend_llist_clean+0xb [Zend\zend_llist.c @ 125]
05bafb20 0075971d 05fab840 0000003c 019967d0 php5ts!php_deactivate_ticks+0x1b [main\php_ticks.c @
31]
05bafb30 00756699 05fab840 0000003c 77bcac67 php5ts!php_body_write+0x1d [main\output.c @ 118]
05bafb58 00756869 05bafe78 05bafddc 77bcac67 php5ts!php_body_write_wrapper+0x19 [main\main.c @ 1687]
05bafdd4 10003378 00000000 10002ff6 062a3fb8 php5ts!php_execute_script+0xa9 [main\main.c @ 2201]
05bafddc 10002ff6 062a3fb8 019967d0 00000004 php5apache2_2!php_apache_request_dtor+0x8
[sapi\apache2handler\sapi_apache2.c @ 508]
05bafee4 6ff020e1 062a3fb8 010112d8 062a3fb8 php5apache2_2!php_handler+0x646
[sapi\apache2handler\sapi_apache2.c @ 681]
WARNING: Stack unwind information not available. Following frames may be wrong.
05bafefc 6ff02470 062a3fb8 062a3fb8 062a3fb8 libhttpd!ap_run_handler+0x21
05baff14 6ff0eaee 00000000 062a2fd8 05baff3c libhttpd!ap_invoke_handler+0xb0
05baff24 6ff0a96c 062a3fb8 00000000 005bc0c8 libhttpd!ap_die+0x29e
05baff3c 6ff04d61 062a2fd8 062a2fd8 062a2fd8 libhttpd!ap_get_request_note+0x1d0c
05baff54 6ff05023 062a2fd8 0062f400 05baff84 libhttpd!ap_run_process_connection+0x21
05baff64 6ff1d81c 062a2fd8 01bbcda0 00000000 libhttpd!ap_process_connection+0x33
05baff84 77bcb530 062a2fd0 00000000 00000000 libhttpd!ap_regkey_value_remove+0xc7c
05baffb8 77e6482f 017dfbf0 00000000 00000000 msvcrt!_endthreadex+0xa3
05baffec 00000000 77bcb4bc 017dfbf0 00000000 kernel32!BaseThreadStart+0x34


SYMBOL_STACK_INDEX:  0

SYMBOL_NAME:  php5ts!_zend_mm_free_int+139

FOLLOWUP_NAME:  MachineOwner

MODULE_NAME: php5ts

IMAGE_NAME:  php5ts.dll

DEBUG_FLR_IMAGE_TIMESTAMP:  4d26013e

STACK_COMMAND:  ~255s; .ecxr ; kb

FAILURE_BUCKET_ID:  NULL_CLASS_PTR_DEREFERENCE_c0000005_php5ts.dll!_zend_mm_free_int

BUCKET_ID: 
APPLICATION_FAULT_NULL_CLASS_PTR_DEREFERENCE_INVALID_POINTER_READ_php5ts!_zend_mm_free_int+139

WATSON_STAGEONE_URL:  http://watson.microsoft.com/StageOne/httpd_exe/2_2_17_0/4cbbe9e8/php5ts_dll/5_3_5_0/4d26013e/c0000005/0000c699.htm?Retriage=1

Followup: MachineOwner

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=49532


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=49532&edit=1


Thread (21 messages)

« previous php.bugs (#175864) next »