Skip Menu |

This queue is for tickets about the Net-SNMP CPAN distribution.

Report information
The Basics
Id: 69341
Status: rejected
Worked: 10 min
Priority: 0/
Queue: Net-SNMP

People
Owner: dtown [...] cpan.org
Requestors: BitCard [...] ResonatorSoft.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 5.2.0
  • v6.0.0
  • v6.0.1
Fixed in: (no value)



Subject: Timing bug with _event_create
The _event_create sub in Net::SNMP::Dispatcher has some odd logic with processing times vs. delays, which is creating zero-epoch dates for events. While the Dispatcher seems to fire these okay, it affects the midpoint insertion code and exactly how _event_handle prioritizes the events. The code in question looks like: $this->{_active} ? time() + $time : $time, # Execution time It should look like the time variable itself, not the active state, which doesn't make much sense. This works better: ($time < 100000000) ? time() + $time : $time, # Execution time This merely looks for a properly large time epoch and uses it as such, else assume it's a delay value. Unless the user wants Net::SNMP to wait 3 years before polling something, the logic works fine. Similar code is also found in _event_init and should be changed as such.
Can you describe in detail what you think the issue is? Your change could possibly lead to calculating incorrect execution times when the event loop is first started.
From: BitCard [...] ResonatorSoft.org
On Fri Jul 08 10:25:47 2011, DTOWN wrote: Show quoted text
> Can you describe in detail what you think the issue is? Your change > could possibly lead to calculating incorrect execution times when the > event loop is first started.
Sorry, it may have been my misunderstanding of how delay works, since it looks like you still want to keep the delay value without a time until the Dispatcher starts. Everything called it _TIME or $time, so I thought it was a bug. The _event_init sub appears to only be called when the Dispatcher is active (since _event_handle is only called at that point), so it should be set to the correct time before it's handled.
During run time the member _TIME does correspond to the execution time. For any entry inserted while the dispatcher is not active, the _TIME member will be the delay that will be converted into the execution time by _event_init(). It is true that _event_init() is currently only called while the event loop is active so the execution time should always be calculated. But, for robustness the _event_init() method is coded in such a way that it could be used while the dispatcher is not active. In the past I think it might have been used in both cases. On Fri Jul 08 19:21:46 2011, SineSwiper wrote: Show quoted text
> On Fri Jul 08 10:25:47 2011, DTOWN wrote:
> > Can you describe in detail what you think the issue is? Your change > > could possibly lead to calculating incorrect execution times when the > > event loop is first started.
> > Sorry, it may have been my misunderstanding of how delay works, since it > looks like you still want to keep the delay value without a time until > the Dispatcher starts. Everything called it _TIME or $time, so I > thought it was a bug. > > The _event_init sub appears to only be called when the Dispatcher is > active (since _event_handle is only called at that point), so it should > be set to the correct time before it's handled.