php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48351 Cannot support the windows fiber (a user mode thread against thread)?
Submitted: 2009-05-21 08:42 UTC Modified: 2009-05-21 12:14 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: fantiyu at sina dot com Assigned:
Status: Not a bug Package: IIS related
PHP Version: 5.2.9 OS: Windows
Private report: No CVE-ID: None
 [2009-05-21 08:42 UTC] fantiyu at sina dot com
Description:
------------
Sorry for my poor englist.
we have writing a web server core at this moment, and calling php 5.2.9 through isapi interface.
we made success in thread mode, but failed in fiber mode (a user mode thread against the real thread, with very fast context switching, there may are many fibers run in one thread, and occupied much smaller memory).
the dll is failed every time for memory issus when more than one calling fiber running in same thread.
maybe the php is not support windows fiber i guess?

need your help, ths!

Reproduce code:
---------------
here's the psapi interface we called:
BOOL WINAPI PsapiParser::WriteClient ( 
	HCONN      ConnID,
	LPVOID     Buffer,
	LPDWORD    lpdwBytes,
	DWORD      dwReserved)
{
	WebContext *pContext = (WebContext*)ConnID;
	ProcessDataIsapi *pData;
	pData = CONTAINING_RECORD((LPEXTENSION_CONTROL_BLOCK)ConnID, ProcessDataIsapi, m_ECB);
	pContext = pData->m_pContext;
	if (typeid(pContext) != typeid(WebContext *) || pContext->m_nIoStatus != IO_NONE) // for bug only
	{
		*lpdwBytes = 0;
		SetLastError(WSAECONNRESET);
		return FALSE;
	}
	pContext->m_SendBuffer.WriteBuffer(Buffer, *lpdwBytes);
	pContext->m_nIoStatus = IO_SEND;
	if (!pContext->m_pConn->Send()) //send failed
	{
		pContext->m_nIoStatus = IO_NONE;
		*lpdwBytes = 0;
		SetLastError(WSAECONNRESET);
		return FALSE;
	}
	WaitableContextIo wait(pContext);
	((FiberClient*)g_pThisFiber)->Wait(&wait); //switch to other fibers and came back when !wait->IsWaiting()
	if (pContext->m_nIoStatus == IO_ERROR)
	{
		*lpdwBytes = 0;
		pContext->m_nIoStatus = IO_NONE;
		SetLastError(WSAECONNRESET);
		return FALSE;
	}
	pContext->m_nIoStatus = IO_NONE;
	//printf ("\nWriteClient, %d\n%s\n\n", *lpdwBytes, Buffer); //for log only
	return TRUE;
}


Expected result:
----------------
calling stacks:
04fced38 01c99692 php5isapi+0x13f4
04fced58 10001215 php5ts!zend_llist_apply_with_argument+0x22
04fced8c 01c8ee73 php5isapi+0x1215
04fceda0 01caa0e5 php5ts!zend_ini_long+0x73
04fceda4 01caa230 php5ts!sapi_send_headers+0x45
04fcee38 7726a36f php5ts!sapi_send_headers+0x190
04fcee88 767b4c27 ntdll!RtlpCreateProcessRegistryInfo+0x8b
04fceea0 01bfbe19 msvcrt!mbsdup+0x3b
04fceeac 01cae002 php5ts!efree+0x39
04fceecc 01d95b0b php5ts!php_module_startup+0x1012
04fceed8 01cb22a8 php5ts!php_header+0xb
04fceee8 01cb17c4 php5ts!php_ub_body_write+0x48
04fcef28 01cac070 php5ts!php_end_ob_buffer+0x454
00000000 00000000 php5ts!php_verror+0x530

Access violation:
(6d8.20c): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=baadf015 ebx=04fced80 ecx=baadf015 edx=02e34e28 esi=baadf00d edi=02e34e00
eip=100013f4 esp=04fced3c ebp=100013f0 iopl=0         nv up ei ng nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010282
*** WARNING: Unable to verify checksum for H:\My Work\VC++\Active Projects\FServer\FServer\php\php5isapi.dll
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for H:\My Work\VC++\Active Projects\FServer\FServer\php\php5isapi.dll - 
php5isapi+0x13f4:
100013f4 8b4804          mov     ecx,dword ptr [eax+4] ds:0023:baadf019=????????
*** WARNING: Unable to verify checksum for H:\My Work\VC++\Active Projects\FServer\FServer\php\php5ts.dll
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for H:\My Work\VC++\Active Projects\FServer\FServer\php\php5ts.dll - 
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\system32\msvcrt.dll - 


Actual result:
--------------
php cannot running in windows fiber environment

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-05-21 12:14 UTC] jani@php.net
We are aware of PHP's problems with stability under IIS and are working 
to rectify the problem. Unfortunatly your bug report does not contain any
extra useful information and we already have enough bug reports open about
this issue. If you can provide more detailed information such as a 
reproducable crash or a backtrace please do so and reopen this bug. 
Otherwise please keep trying new releases as we are working to resolve 
the problems on this platform
 
Thanks for your interest in PHP.

Use FastCGI: http://php.iis.net/
 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Feb 04 06:05:49 2023 UTC