Home > Archive > PERL POE > September 2006 > PoCo::SNMP keeping requesting sessions alive for too long due to postback
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
PoCo::SNMP keeping requesting sessions alive for too long due to postback
|
|
| Kenneth Flegal 2006-09-11, 7:06 pm |
| From what I have seen, when I call finish on a session for PoCo::SNMP I
am unable to start a session for that same host again for the life of
the program. The first request would work every time without fail but
any subsequent requests made after creating a new PoCo::SNMP session for
this host would never make the postback. I am now using the hostname the
session is for as the alias of the PoCo::SNMP session and detaching the
session from the first session that created the session and using the
session with that alias if it has already been spawned.
I am fine with keeping the PoCo::SNMP session alive throughout the life
of the program as every connection that I make will be used frequently
so long as it isn't keeping other sessions alive without cause. With
PoCo::SNMP using a postback that is passed along in the anonymous sub
used as the callback (which is referenced permanently in the Net::SNMP
session) however, it will keep the calling session alive until a call is
made from another session or the finish is called. I believe I have a
fix for this problem by simply adding a line to the anonymous sub that
sets the postback reference to undef after calling the postback. I
haven't seen any side effects from making this change but wanted to
bring it up on this list to make sure that I am not missing something
important and to include the patch in the case that this is a useful
change. Any comments on this would be greatly appreciated and I hope
that this patch is useful.
- Kenny Flegal
| |
| Kenneth Flegal 2006-09-12, 7:10 pm |
| Rob,
Thanks for looking into this and getting this resolved so quickly! The
new version works perfectly. I was afraid I had went off on an odd
(maybe more accurately "dead wrong") tangent with this one. :)
- Kenny
-----Original Message-----
From: Rob Bloodgood [mailto:robb@empire2.com]=20
Sent: Tuesday, September 12, 2006 11:43 AM
To: Kenneth Flegal; POE
Subject: Re: PoCo::SNMP keeping requesting sessions alive for too long
due to postback
Kenneth Flegal wrote:
>
> From what I have seen, when I call finish on a session for PoCo::SNMP=20
> I am unable to start a session for that same host again for the life=20
> of the program. The first request would work every time without fail=20
> but any subsequent requests made after creating a new PoCo::SNMP=20
> session for this host would never make the postback. I am now using=20
> the hostname the session is for as the alias of the PoCo::SNMP session
> and detaching the session from the first session that created the=20
> session and using the session with that alias if it has already been=20
> spawned.
>
> I am fine with keeping the PoCo::SNMP session alive throughout the=20
> life of the program as every connection that I make will be used=20
> frequently so long as it isn't keeping other sessions alive without=20
> cause. With PoCo::SNMP using a postback that is passed along in the=20
> anonymous sub used as the callback (which is referenced permanently in
> the Net::SNMP session) however, it will keep the calling session alive
> until a call is made from another session or the finish is called. I=20
> believe I have a fix for this problem by simply adding a line to the=20
> anonymous sub that sets the postback reference to undef after calling=20
> the postback. I haven't seen any side effects from making this change=20
> but wanted to bring it up on this list to make sure that I am not=20
> missing something important and to include the patch in the case that=20
> this is a useful change. Any comments on this would be greatly=20
> appreciated and I hope that this patch is useful.
>
> - Kenny Flegal
>
You have incorrectly identified the nature of the problem, as well as=20
its solution. Turns out PoCo::SNMP had some bad logic involved when a=20
session was closed, causing it to *stay* "closed," even when you started
a new, different instance of it. I fixed that last nite and a new=20
version of the component is on CPAN. Try your program with the new=20
version, and feel free to email me personally if you have any additional
issues.
L8r,
Rob
|
|
|
|
|