php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37819 SNMP contention issue
Submitted: 2006-06-15 16:45 UTC Modified: 2006-06-22 17:36 UTC
From: sdw06 at health dot state dot ny dot us Assigned:
Status: Not a bug Package: SNMP related
PHP Version: 5.1.4 OS: Windows 2003
Private report: No CVE-ID: None
 [2006-06-15 16:45 UTC] sdw06 at health dot state dot ny dot us
Description:
------------
I am developing an application that does certain scripted functions for our helpdesk and networking groups and delivers the results via web interface. An example of some of the functionality is port status of a switch, router error tracking, performance monitoring, utilization...that kind of stuff. I'm using snmp to do pretty much everything and it works great and all is good *except* when 2 users try and do something invoking snmp calls at the exact same time. I did a line sniff to see what the deal was and this is what happens as an example:

User (A) requests port speed/duplex settings for a switch on the network, php starts sending out the snmpget calls needed...

User (B) initiates a check for router errors a split second after User (A), while User (A)'s script is still doing its thing. The instant User(B)
does this User(A) stops making the needed snmp calls and just stops. They then need to close out of their web browser and log back in.

User (B)'s request completes without a problem.

I am guessing this is caused by contention for the snmp port and php gets confused. Am I trying to do something that snmp is not capable of?

What makes me think it is possibly a PHP issue is I tried to see if another network application that uses SNMP would duplicate the same problem. To my surprise, it didn't. For example we have the Solar winds network management application running on the same machine as my web server. Solar Winds has a circuit utilization gauge that works by making SNMP calls to the router. I pretty much made an exact copy of this functionality, i.e. gathering utilization of the router by making SNMP calls to it. I was able to run both my utilization gauge and the solarwinds utilization gauge at the exact same time and both worked with no problem.

So it seems to happen only when PHP tries to make simultaneous SNMP calls.

Reproduce code:
---------------
Here is a small sample of some of the snmp calls I am making.

function snmppullsyslocation($target) {
include "C:\WicWeb\bin\wicwebnetwork.php";
return snmpget($target, $RWCOMSTRING, '.1.3.6.1.2.1.1.6.0', '1000000', '5');
}

function snmppullsyscontact($target) {
include "C:\WicWeb\bin\wicwebnetwork.php";
return snmpget($target, $RWCOMSTRING, '.1.3.6.1.2.1.1.4.0', '1000000', '5');
}

function snmppullsysobjectid($target) {
include "C:\WicWeb\bin\wicwebnetwork.php";
return snmpget($target, $RWCOMSTRING, '.1.3.6.1.2.1.1.2.0', '1000000', '5');
}

function snmppullduplexstate($target) {
snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
include "C:\WicWeb\bin\wicwebnetwork.php";
return snmpwalk($target, $RWCOMSTRING, '.1.3.6.1.4.1.9.9.87.1.4.1.1.31.0', '1000000', '5');
}

function snmppullduplexstatus($target) {
include "C:\WicWeb\bin\wicwebnetwork.php";
return snmpwalk($target, $RWCOMSTRING, '.1.3.6.1.4.1.9.9.87.1.4.1.1.32.0', '1000000', '5');
}


Expected result:
----------------
I expect to be able to have different php scrips make these snmp calls at the same time.

Actual result:
--------------
One script's snmp call goes through, the other one never completes.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-20 14:10 UTC] tony2001@php.net
Why do you think it's a problem of PHP?
PHP calls SNMP client functions and if SNMP client fails to perform its job, I doubt that PHP can help you with that.
 [2006-06-21 16:38 UTC] sdw06 at health dot state dot ny dot us
I guess I was under the impression that the SNMP functions were part of the php package? When I do a search for 'SNMP' on php.net under the functions list I get results for snmpwalk and snmpget and such. Maybe I am misunderstanding what you mean by snmp client functions. Are you saying that the agent on the devive I am polling is not doing what it is supposed to?

If this is the case should PHP not exit gracefully with an error message after the timeout period I specify in snmpget? The script will just hang there, requiring the user to close down their browser and long back in.

Thank you for your response.
 [2006-06-22 17:36 UTC] tony2001@php.net
SNMP functions in PHP are just wrappers for SNMP library. which actually implements SNMP protocol.
That's why we can't do anything if this library fails, hangs etc.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Jan 29 11:01:24 2020 UTC