graylog-labs / gelf-rb

Ruby GELF library (Graylog Extended Log Format)

Home Page:https://rubygems.org/gems/gelf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GELF::Notifier#serialize_hash fails when attempting to read 'rack.errors'

rthbound opened this issue · comments

Hi, I'm using graylog with rails 5 (edge)... I've found that GELF::Notifier now fails here: https://github.com/Graylog2/gelf-rb/blob/master/lib/gelf/notifier.rb#L254 ...

Tracing the code, I see that the error occurs when calling #as_json on #IO:

IOError: not opened for reading.

I believe this is because we're attempting to read $stderr, which is write-only.

ping @joschi

@joschi any ideas?

Pinging a few others: @bernd @dennisoelkers @edmundoa @mariussturm (please don't hate me 😄 )

Is this a new problem? Have you guys coded around this previously? As far as I can see, rack.errors has always held a STDERR stream (and has always been write-only). Was there some code written to skip over rack.errors, to rescue from IOErrors, something else?

Looking forward to using graylog when rails5 comes out, but it looks like this error will prevent that.

Edit: another possibility is that #as_json's behavior has changed (maybe it's become less forgiving)

Hi @rthbound,

thank you for bringing this to our attention! Do you happen to have a full backtrace of the problem at hand? It would be interesting to see how the rack.errors find their way into the hash at all since I'd guess that this gem is not the only logger that might have trouble working with those.

@milgner apologies for the delay. It looks like others may be noticing this too, outside of the gelf-rb world. rails/rails/issues/26132