|  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: sdw06 at health dot state dot ny dot us
New email:
PHP Version: OS:


 [2006-06-15 16:45 UTC] sdw06 at health dot state dot ny dot us
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, '.', '1000000', '5');

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

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

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

function snmppullduplexstatus($target) {
include "C:\WicWeb\bin\wicwebnetwork.php";
return snmpwalk($target, $RWCOMSTRING, '.', '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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-20 14:10 UTC]
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 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]
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: Mon Mar 30 20:01:24 2020 UTC