From: fantiyu at sina dot com
Operating system: Windows
PHP version: 5.2.9
PHP Bug Type: Other web server
Bug description: Cannot support the windows fiber (a user mode thread against
thread)?
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
--
Edit bug report at http://bugs.php.net/?id=48351&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=48351&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=48351&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=48351&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=48351&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=48351&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=48351&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=48351&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=48351&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=48351&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=48351&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=48351&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=48351&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=48351&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=48351&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48351&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48351&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=48351&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=48351&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=48351&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=48351&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=48351&r=mysqlcfg