Bug #52077 [Com]: SNMP GET/WALK may hangs FOREVER
Edit report at http://bugs.php.net/bug.php?id=52077&edit=1 ID: 52077 Comment by: wajim at mail dot ru Reported by: wajim at mail dot ru Summary: SNMP GET/WALK may hangs FOREVER Status: Feedback Type: Bug Package: SNMP related Operating System: Win XP SP3 PHP Version: 5.2.13 New Comment: In net-snmp bugtracker I yet did not write. Previous Comments: [2010-06-19 15:31:47] paj...@php.net did you send a patch to the ucd-snmp maintainers? If your patch is accepted I can then patch our builds, and it will be fixed for the next 5.3.x release (can't and won't touch snmp in 5.2 touch). [2010-06-19 15:13:44] wajim at mail dot ru static int _sess_read(void *sessp, fd_set *fdset){ [cut] unsigned long unblock; //WAJIM [cut] unblock = 1; ioctlsocket(isp->sd, FIONBIO, &unblock); //WAJIM length = recvfrom(isp->sd, (char *)packet, PACKET_LENGTH, 0, (struct sockaddr *)&from, &fromlength); unblock = 0; ioctlsocket(isp->sd, FIONBIO, &unblock); //WAJIM [cut] } Those my 3 lines in snmp_api.c (ucd-snmp-4.2.7.1) fixes threads hanging. :-) [2010-06-19 15:03:22] larryjadams at comcast dot net Stupid WINSock does not support send and receive timeout socket options. It's a poorly implemented socket api. The net-snmp guys will have to implement with an alarm. It can not be solved here. But nice catch. ---------------- [2010-06-13 21:41:34] wajim at mail dot ru Description: Under a heavy GET/WALK-ing (form localhost to localhost) php may hangs forever -> apache's threads becomes zombies with CLOSE_WAIT sates even all timeouts (php and apache) are elapsed many times. Call-stack of a one zombie-thread: ntoskrnl.exe!KiUnlockDispatcherDatabase+0x77 ntoskrnl.exe!KeSetEvent+0x74 ntoskrnl.exe!PspGetSetContextSpecialApc+0x4e ntoskrnl.exe!KiDeliverApc+0xb3 ntoskrnl.exe!KiSwapThread+0x64 ntoskrnl.exe!KeWaitForSingleObject+0x1c2 ntoskrnl.exe!NtWaitForSingleObject+0x9a ntoskrnl.exe!KiFastCallEntry+0xf8 ntdll.dll!KiFastSystemCallRet ntdll.dll!ZwWaitForSingleObject+0xc mswsock.dll!SockWaitForSingleObject+0x1a0 mswsock.dll!WSPRecvFrom+0x1f0 WS2_32.dll!recvfrom+0x89 php_snmp.dll!snmp_sess_read+0x21f php_snmp.dll!snmp_sess_read+0x10 php_snmp.dll!snmp_read+0x17 php_snmp.dll!snmp_synch_response_cb+0xe8 php_snmp.dll!snmp_synch_response+0x19 php_snmp.dll!php_snmp_internal+0x267 php_snmp.dll!php_snmp+0x6da php_snmp.dll!zif_snmp2_get+0x27 php5ts.dll!zend_do_fcall_common_helper_SPEC+0x7ab php5ts.dll!ZEND_DO_FCALL_SPEC_CONST_HANDLER+0xe5 php5ts.dll!execute+0x1c5 php5ts.dll!zend_do_fcall_common_helper_SPEC+0x8ca php5ts.dll!ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER+0x15 php5ts.dll!execute+0x1c5 php5ts.dll!zend_do_fcall_common_helper_SPEC+0x8ca php5ts.dll!ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER+0x15 php5ts.dll!execute+0x1c5 php5ts.dll!zend_execute_scripts+0x107 php5ts.dll!php_execute_script+0x21d php5apache.dll!apache_php_module_main+0x91 php5apache.dll!send_php+0x265 php5apache.dll!send_parsed_php+0x10 ApacheCore.dll!ap_invoke_handler+0x87 ApacheCore.dll!ap_process_request+0x2b4 ApacheCore.dll!ap_process_request+0x26 ApacheCore.dll!ap_start_restart+0x37f WS2_32.dll!WSASocketW+0x119 IMHO bad call "WS2_32.dll!recvfrom" in buggy ucd-snmp library may hangs. There are no socket option like "setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, ..." before recvfrom call. -- Edit this bug report at http://bugs.php.net/bug.php?id=52077&edit=1
Bug #52077 [Com]: SNMP GET/WALK may hangs FOREVER
Edit report at http://bugs.php.net/bug.php?id=52077&edit=1 ID: 52077 Comment by: wajim at mail dot ru Reported by: wajim at mail dot ru Summary: SNMP GET/WALK may hangs FOREVER Status: Open Type: Bug Package: SNMP related Operating System: Win XP SP3 PHP Version: 5.2.13 New Comment: static int _sess_read(void *sessp, fd_set *fdset){ [cut] unsigned long unblock; //WAJIM [cut] unblock = 1; ioctlsocket(isp->sd, FIONBIO, &unblock); //WAJIM length = recvfrom(isp->sd, (char *)packet, PACKET_LENGTH, 0, (struct sockaddr *)&from, &fromlength); unblock = 0; ioctlsocket(isp->sd, FIONBIO, &unblock); //WAJIM [cut] } Those my 3 lines in snmp_api.c (ucd-snmp-4.2.7.1) fixes threads hanging. :-) Previous Comments: [2010-06-19 15:03:22] larryjadams at comcast dot net Stupid WINSock does not support send and receive timeout socket options. It's a poorly implemented socket api. The net-snmp guys will have to implement with an alarm. It can not be solved here. But nice catch. -------- [2010-06-13 21:41:34] wajim at mail dot ru Description: Under a heavy GET/WALK-ing (form localhost to localhost) php may hangs forever -> apache's threads becomes zombies with CLOSE_WAIT sates even all timeouts (php and apache) are elapsed many times. Call-stack of a one zombie-thread: ntoskrnl.exe!KiUnlockDispatcherDatabase+0x77 ntoskrnl.exe!KeSetEvent+0x74 ntoskrnl.exe!PspGetSetContextSpecialApc+0x4e ntoskrnl.exe!KiDeliverApc+0xb3 ntoskrnl.exe!KiSwapThread+0x64 ntoskrnl.exe!KeWaitForSingleObject+0x1c2 ntoskrnl.exe!NtWaitForSingleObject+0x9a ntoskrnl.exe!KiFastCallEntry+0xf8 ntdll.dll!KiFastSystemCallRet ntdll.dll!ZwWaitForSingleObject+0xc mswsock.dll!SockWaitForSingleObject+0x1a0 mswsock.dll!WSPRecvFrom+0x1f0 WS2_32.dll!recvfrom+0x89 php_snmp.dll!snmp_sess_read+0x21f php_snmp.dll!snmp_sess_read+0x10 php_snmp.dll!snmp_read+0x17 php_snmp.dll!snmp_synch_response_cb+0xe8 php_snmp.dll!snmp_synch_response+0x19 php_snmp.dll!php_snmp_internal+0x267 php_snmp.dll!php_snmp+0x6da php_snmp.dll!zif_snmp2_get+0x27 php5ts.dll!zend_do_fcall_common_helper_SPEC+0x7ab php5ts.dll!ZEND_DO_FCALL_SPEC_CONST_HANDLER+0xe5 php5ts.dll!execute+0x1c5 php5ts.dll!zend_do_fcall_common_helper_SPEC+0x8ca php5ts.dll!ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER+0x15 php5ts.dll!execute+0x1c5 php5ts.dll!zend_do_fcall_common_helper_SPEC+0x8ca php5ts.dll!ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER+0x15 php5ts.dll!execute+0x1c5 php5ts.dll!zend_execute_scripts+0x107 php5ts.dll!php_execute_script+0x21d php5apache.dll!apache_php_module_main+0x91 php5apache.dll!send_php+0x265 php5apache.dll!send_parsed_php+0x10 ApacheCore.dll!ap_invoke_handler+0x87 ApacheCore.dll!ap_process_request+0x2b4 ApacheCore.dll!ap_process_request+0x26 ApacheCore.dll!ap_start_restart+0x37f WS2_32.dll!WSASocketW+0x119 IMHO bad call "WS2_32.dll!recvfrom" in buggy ucd-snmp library may hangs. There are no socket option like "setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, ..." before recvfrom call. -- Edit this bug report at http://bugs.php.net/bug.php?id=52077&edit=1
[PHP-BUG] Bug #52077 [NEW]: SNMP GET/WALK may hangs FOREVER
From: Operating system: Win XP SP3 PHP version: 5.2.13 Package: SNMP related Bug Type: Bug Bug description:SNMP GET/WALK may hangs FOREVER Description: Under a heavy GET/WALK-ing (form localhost to localhost) php may hangs forever -> apache's threads becomes zombies with CLOSE_WAIT sates even all timeouts (php and apache) are elapsed many times. Call-stack of a one zombie-thread: ntoskrnl.exe!KiUnlockDispatcherDatabase+0x77 ntoskrnl.exe!KeSetEvent+0x74 ntoskrnl.exe!PspGetSetContextSpecialApc+0x4e ntoskrnl.exe!KiDeliverApc+0xb3 ntoskrnl.exe!KiSwapThread+0x64 ntoskrnl.exe!KeWaitForSingleObject+0x1c2 ntoskrnl.exe!NtWaitForSingleObject+0x9a ntoskrnl.exe!KiFastCallEntry+0xf8 ntdll.dll!KiFastSystemCallRet ntdll.dll!ZwWaitForSingleObject+0xc mswsock.dll!SockWaitForSingleObject+0x1a0 mswsock.dll!WSPRecvFrom+0x1f0 WS2_32.dll!recvfrom+0x89 php_snmp.dll!snmp_sess_read+0x21f php_snmp.dll!snmp_sess_read+0x10 php_snmp.dll!snmp_read+0x17 php_snmp.dll!snmp_synch_response_cb+0xe8 php_snmp.dll!snmp_synch_response+0x19 php_snmp.dll!php_snmp_internal+0x267 php_snmp.dll!php_snmp+0x6da php_snmp.dll!zif_snmp2_get+0x27 php5ts.dll!zend_do_fcall_common_helper_SPEC+0x7ab php5ts.dll!ZEND_DO_FCALL_SPEC_CONST_HANDLER+0xe5 php5ts.dll!execute+0x1c5 php5ts.dll!zend_do_fcall_common_helper_SPEC+0x8ca php5ts.dll!ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER+0x15 php5ts.dll!execute+0x1c5 php5ts.dll!zend_do_fcall_common_helper_SPEC+0x8ca php5ts.dll!ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER+0x15 php5ts.dll!execute+0x1c5 php5ts.dll!zend_execute_scripts+0x107 php5ts.dll!php_execute_script+0x21d php5apache.dll!apache_php_module_main+0x91 php5apache.dll!send_php+0x265 php5apache.dll!send_parsed_php+0x10 ApacheCore.dll!ap_invoke_handler+0x87 ApacheCore.dll!ap_process_request+0x2b4 ApacheCore.dll!ap_process_request+0x26 ApacheCore.dll!ap_start_restart+0x37f WS2_32.dll!WSASocketW+0x119 IMHO bad call "WS2_32.dll!recvfrom" in buggy ucd-snmp library may hangs. There are no socket option like "setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, ..." before recvfrom call. -- Edit bug report at http://bugs.php.net/bug.php?id=52077&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52077&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52077&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52077&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=52077&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52077&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=52077&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=52077&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=52077&r=needscript Try newer version: http://bugs.php.net/fix.php?id=52077&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=52077&r=support Expected behavior: http://bugs.php.net/fix.php?id=52077&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=52077&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=52077&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=52077&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52077&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=52077&r=dst IIS Stability: http://bugs.php.net/fix.php?id=52077&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=52077&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=52077&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=52077&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=52077&r=mysqlcfg