Mysterious rails error with almost no trace

We have a strange problem with one seeker. Sometimes it raises a Rails FATAL error on some request, but the trace is very limited and looks something like this:

 [2014-07-01 18:16:37] FATAL Rails : ArgumentError (invalid %-encoding (c ^ FK+ 9u$_ t Kl Ξ₯E! =k \ Μ•* ߚ>c+<O یo ʘ> CR! 2 D (5 xq#!` 4 p |8 IE :+ H^9`^ # Vo{ > =[z )): lib/locale_middleware.rb:14:in `call' 

Crawler User Agent

Mozilla/5.0 (compatible; EasouSpider; +http://www.easou.com/search/spider.html)

We can ask him to stop scanning through robots.txt , but it would be better to deal with the root cause and not fail with 500 for these requests, if possible.

We also cannot reproduce such a request, so any suggestions on how to generate such a request will be very useful.

We use Rails 3.2.19, Unicorn on Ubuntu 12.04. Here locale_middleware.rb

+7
ruby-on-rails encoding web-crawler fatal-error
Jul 07 '14 at 13:33
source share
1 answer

Special thanks to Benjamin Sinclair for pointing out the edit on github .

The solution was described in this comment :

 config.middleware.use ::Rack::Robustness do |g| g.no_catch_all g.on(ArgumentError) { |ex| 400 } g.content_type 'text/plain' g.body{ |ex| ex.message } g.ensure(true) { |ex| env['rack.errors'].write(ex.message) } end 
+4
Jul 08 '14 at 17:07
source share



All Articles