{"action":"closed","issue":{"url":"https://api.github.com/repos/elastic/logstash/issues/2152","labels_url":"https://api.github.com/repos/elastic/logstash/issues/2152/labels{/name}","comments_url":"https://api.github.com/repos/elastic/logstash/issues/2152/comments","events_url":"https://api.github.com/repos/elastic/logstash/issues/2152/events","html_url":"https://github.com/elastic/logstash/issues/2152","id":50569399,"number":2152,"title":"Pipeline stops processing events because of exception in filterworker \"#<NoMethodError: undefined method `encode' for nil:NilClass>\"","user":{"login":"mezzatto","id":649486,"avatar_url":"https://avatars.githubusercontent.com/u/649486?v=3","gravatar_id":"","url":"https://api.github.com/users/mezzatto","html_url":"https://github.com/mezzatto","followers_url":"https://api.github.com/users/mezzatto/followers","following_url":"https://api.github.com/users/mezzatto/following{/other_user}","gists_url":"https://api.github.com/users/mezzatto/gists{/gist_id}","starred_url":"https://api.github.com/users/mezzatto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mezzatto/subscriptions","organizations_url":"https://api.github.com/users/mezzatto/orgs","repos_url":"https://api.github.com/users/mezzatto/repos","events_url":"https://api.github.com/users/mezzatto/events{/privacy}","received_events_url":"https://api.github.com/users/mezzatto/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/elastic/logstash/labels/bug","name":"bug","color":"e11d21"},{"url":"https://api.github.com/repos/elastic/logstash/labels/dead-letter-queue","name":"dead-letter-queue","color":"bfd4f2"},{"url":"https://api.github.com/repos/elastic/logstash/labels/needs%20details","name":"needs details","color":"cc317c"}],"state":"closed","locked":false,"assignee":{"login":"jsvd","id":31809,"avatar_url":"https://avatars.githubusercontent.com/u/31809?v=3","gravatar_id":"","url":"https://api.github.com/users/jsvd","html_url":"https://github.com/jsvd","followers_url":"https://api.github.com/users/jsvd/followers","following_url":"https://api.github.com/users/jsvd/following{/other_user}","gists_url":"https://api.github.com/users/jsvd/gists{/gist_id}","starred_url":"https://api.github.com/users/jsvd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsvd/subscriptions","organizations_url":"https://api.github.com/users/jsvd/orgs","repos_url":"https://api.github.com/users/jsvd/repos","events_url":"https://api.github.com/users/jsvd/events{/privacy}","received_events_url":"https://api.github.com/users/jsvd/received_events","type":"User","site_admin":false},"milestone":null,"comments":5,"created_at":"2014-12-01T20:18:35Z","updated_at":"2015-09-07T14:51:03Z","closed_at":"2015-09-07T14:51:03Z","body":"I'm getting the following error in the logstash log, and when it happens the pipeline stops processing events:\r\n\r\n```\r\n{:timestamp=>\"2014-11-29T15:44:34.069000-0200\", :message=>\"Exception in filterworker\", \"exception\"=>#<NoMethodError: undefined method `encode' for nil:NilClass>, \"backtrace\"=>[\"(ruby filter code):1:in `register'\", \"org/jruby/RubyProc.java:271:in `call'\", \"/usr/local/logstash/lib/logstash/filters/ruby.rb:38:in `filter'\", \"(eval):32:in `initialize'\", \"org/jruby/RubyProc.java:271:in `call'\", \"/usr/local/logstash/lib/logstash/pipeline.rb:262:in `filter'\", \"/usr/local/logstash/lib/logstash/pipeline.rb:203:in `filterworker'\", \"/usr/local/logstash/lib/logstash/pipeline.rb:143:in `start_filters'\"], :level=>:error}\r\n```\r\n\r\nThe error does not seems to be related to some specific input. Sometimes the log is generated but the pipeline processing continues.\r\n\r\nSome info about the environment:\r\n\r\n```\r\n# java -version\r\njava version \"1.7.0_60\"\r\nJava(TM) SE Runtime Environment (build 1.7.0_60-b19)\r\nJava HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)\r\n```\r\n\r\nCommand line:\r\n\r\n```\r\n/usr/bin/java -Xmx500m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -Djava.awt.headless=true -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -jar /usr/local/logstash/vendor/jar/jruby-complete-1.7.11.jar -I/usr/local/logstash/lib /usr/local/logstash/lib/logstash/runner.rb agent -f /etc/logstash/log_indexer.conf -w 4 -l /var/log/logstash/log_indexer.log\r\n```\r\n\r\nMy config:\r\n\r\n```\r\ninput {\r\n  redis {\r\n    host => \"127.0.0.1\"\r\n    port => 43210\r\n    data_type => \"list\"\r\n    key => \"proc_log\"\r\n    batch_count => 100\r\n    codec => json\r\n    threads => 4\r\n  }\r\n}\r\n\r\nfilter {\r\n  ruby {\r\n    code => \"event['message'] = event['message'][0].encode('iso-8859-1', 'utf-8', :invalid => :replace, :undef => :replace, :replace => '')\"\r\n  }\r\n}\r\n\r\noutput {\r\n  file {\r\n    codec => line { charset => \"ISO-8859-1\" }\r\n    message_format => '%{message}'\r\n    flush_interval => 1\r\n    path => \"%{path}\"\r\n  }\r\n  elasticsearch {\r\n    index => \"ck-%{+YYYY.MM.dd.HH}\"\r\n    protocol => \"http\"\r\n    cluster => \"elasticsearch_procura_access\"\r\n    flush_size => 100\r\n    workers => 4\r\n  }\r\n}\r\n```"}}