php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57777 Crash after exit main() function
Submitted: 2007-08-07 07:27 UTC Modified: 2017-04-01 21:26 UTC
From: filipski at mail dot md Assigned:
Status: Wont fix Package: PHPScript (PECL)
PHP Version: Irrelevant OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: filipski at mail dot md
New email:
PHP Version: OS:

 

 [2007-08-07 07:27 UTC] filipski at mail dot md
Description:
------------
Description:
------------
Package downloaded pecl-5.2.3-Win32.zip
A problem with php5activescript.dll
I created a new Win32 Console application in VisualStudio2005.

Everything runs fine until the very end. But after returning from
function main() the program waits some time and crashes.
So, it:
1. It unload slowly
2. It crashes

When doing the same with Python, PerlScript, JScript, VBScript there is
no problem after the function main exits. The program runs fine, invokes
the script dispatch functions, exits ok, quick and with no crashes.

BTW after the program ends, the engine unloads very slowly. Much slower
than other engines I tried Python, PerlScript, JScript, VBScript.


Reproduce code:
---------------
int main(){...CoInitialize();...{
	IActiveScriptSite* pSite = new MyActiveScriptSite();
   CComPtr<IActiveScript> pas;
   CComPtr<IDispatch> pDisp;
   HRESULT hr;
   CComPtr<IActiveScriptParse> pasp;
   hr = pasp.CoCreateInstance(L"PHPScript", 0, CLSCTX_ALL);
   hr = pasp->InitNew();
	hr = pasp->QueryInterface(&pas);
	hr = pas->SetScriptSite(pSite);

   EXCEPINFO ei;
   wchar_t *pwszCode = L".... some PHP code in UNICODE format...
   hr = pasp->ParseScriptText(pwszCode, 0, 0, 0, 0, 0, 
                                SCRIPTTEXT_ISPERSISTENT,
                                0, &ei);
...
}
CoUninitialize();


Expected result:
----------------
I expect the engine to unload imediately, quickly and with no crashes.


Actual result:
--------------
A diallog box with a crash report is shown:
Unhandled exception at 0x011aa455 in eval.exe: 0xC0000005: Access
violation reading location 0x019eceb8.
This is the call stack, maybe it could be helpful:
 	php5ts.dll!011aa455() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for
php5ts.dll]	
 	php5ts.dll!011aa1a8() 	
 	php5ts.dll!011aa1c4() 	
 	php5ts.dll!01199a97() 	
 	php5ts.dll!01101f22() 	
 	php5ts.dll!011db5e6() 	
 	php5activescript.dll!10001fa2() 	
 	ntdll.dll!7c91056d() 	
 	kernel32.dll!7c80995a() 	
 	ntdll.dll!7c91056d() 	
 	msvcrt.dll!77c2c2de() 	
 	msvcrt.dll!77c2c2e3() 	
 	kernel32.dll!7c80996d() 	
 	MSCTFIME.IME!755d9c87() 	
 	MSCTFIME.IME!755d9fb8() 	
 	php5activescript.dll!10006611() 	
 	ntdll.dll!7c9011a7() 	
 	ntdll.dll!7c923f31() 	
 	ntdll.dll!7c96cd11() 	
 	ntdll.dll!7c910945() 	
 	ntdll.dll!7c91094e() 	
 	kernel32.dll!7c81cd76() 	
 	ntdll.dll!7c960af8() 	
 	ntdll.dll!7c960bf0() 	
 	ntdll.dll!7c960bcc() 	
 	ntdll.dll!7c91056d() 	
>	eval.exe!_free_base(void * pBlock=0x7ffddc00)  Line 109 + 0x12
bytes	C
 	ntdll.dll!7c90f0aa() 	
 	kernel32.dll!7c80e62b() 	
 	kernel32.dll!7c80e45c() 	
 	kernel32.dll!7c81cdee() 	
 	eval.exe!__crtExitProcess(int status=0)  Line 684	C
 	eval.exe!doexit(int code=0, int quick=0, int retcaller=0)  Line 596 +
0x9 bytes	C
 	eval.exe!exit(int code=0)  Line 398 + 0xd bytes	C
 	eval.exe!__tmainCRTStartup()  Line 333	C
 	eval.exe!mainCRTStartup()  Line 196	C
 	kernel32.dll!7c816fd7() 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-08 04:13 UTC] filipski at mail dot md
Yeah, only thing I forgot to comment.

The crash happens after caller program exits main() program. It is not a main function inside the php script. And is not any of main functions inside PHPScript engine. It is the main function of scripting host program.
 [2017-04-01 21:26 UTC] tpunt@php.net
-Status: Open +Status: Wont fix
 [2017-04-01 21:26 UTC] tpunt@php.net
Due to this extension not seeing any activity since 2009, this issue will not be fixed. We are therefore closing this now.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Nov 30 03:01:23 2020 UTC