new snmptrap input causes high CPU even when idle

Description

Tried the March 1st nightly build from jenkins.

a minimal config:

#------------------------
input {
snmptrap {
port => 1162
community => 'public'
type => 'snmptrap'
}

}

output {
stdout { debug => true }
}

#------------------------

causes constant GC of new generation, regardless of any
activity on the actual input. jvisualvm shows most CPU
being used by "snmptrap|input|public" thread, as suspected.

Smells like a busy loop to me, happy to investigate further
if needed.

Gliffy Diagrams

Activity

Show:

Jason Kendall March 5, 2014 at 3:44 PM

Fixed with PR 388

Jason Kendall March 5, 2014 at 3:43 PM

PR was merged - Closing.

DickD March 4, 2013 at 2:45 PM

Submitted https://github.com/logstash/logstash/pull/388 to remove the spin loop issue.

Philippe Weber March 4, 2013 at 12:24 PM

Cross-commented on the original github pull request to get the thoughts of the plugin author.
https://github.com/logstash/logstash/pull/349

Philippe Weber March 4, 2013 at 12:11 PM

the loop in the code of the plugin seems strange and might be the cause,

@snmptrap = SNMP::TrapListener.new(:Port => @port, :Community => @community, :Host => @host) loop do @snmptrap.on_trap_default do |trap| begin event = to_event(trap.inspect, trap.source_ip) @logger.info("SNMP Trap received: ", :trap_object => trap.inspect) output_queue << event if event rescue => event @logger.error("Failed to create event", :trap_object => trap.inspect) end end

when looking at library example, it does not seems needed

m = SNMP::TrapListener.new(:Port => 1062, :Community => 'public') do |manager| manager.on_trap_default { |trap| p trap } end m.join

src: http://snmplib.rubyforge.org/doc/classes/SNMP/TrapListener.html

Fixed

Details

Assignee

Reporter

Affects versions

Created March 4, 2013 at 11:52 AM
Updated March 5, 2014 at 3:44 PM
Resolved March 5, 2014 at 3:44 PM