Edit report at http://bugs.php.net/bug.php?id=52077&edit=1
ID: 52077 Updated by: paj...@php.net Reported by: wajim at mail dot ru Summary: SNMP GET/WALK may hangs FOREVER -Status: Open +Status: Feedback Type: Bug Package: SNMP related Operating System: Win XP SP3 PHP Version: 5.2.13 New Comment: 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). Previous Comments: ------------------------------------------------------------------------ [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