2012-03-23 8 views
5

Ho notato che alcune richieste, in particolare da Uptime Robot per testare i tempi di attività pagina hanno recentemente iniziato generato il seguente errore Lint cremagliera sul mio Rails 3.1.x app:Come risolvere gli errori di Lint Rack?

21:47:05 web.1  | Started HEAD "/" for 74.86.158.106 at 2012-03-22 21:47:05 -0400 
21:47:05 web.1  | Processing by HomeController#index as */* 
... 
21:47:05 web.1  | /Users/username/.rvm/gems/[email protected]/gems/activesupport-3.1.4/lib/active_support/core_ext/string/output_safety.rb:23: warning: regexp match /.../n against to UTF-8 string 
... 
21:47:05 web.1  | Completed 200 OK in 81ms (Views: 60.3ms | ActiveRecord: 0.0ms) 
21:47:05 web.1  | 74.86.158.106 - - [22/Mar/2012 21:47:05] "GET/HTTP/1.1" 200 31842 0.1993 
21:47:05 web.1  | E, [2012-03-22T21:47:05.546848 #18938] ERROR -- : app error: Content-Length header was 31842, but should be 0 (Rack::Lint::LintError) 
21:47:05 web.1  | E, [2012-03-22T21:47:05.546978 #18938] ERROR -- : /Users/username/.rvm/gems/[email protected]/gems/rack-1.3.6/lib/rack/lint.rb:19:in `assert' 
21:47:05 web.1  | E, [2012-03-22T21:47:05.547079 #18938] ERROR -- : /Users/username/.rvm/gems/[email protected]/gems/rack-1.3.6/lib/rack/lint.rb:501:in `verify_content_length' 
21:47:05 web.1  | E, [2012-03-22T21:47:05.547178 #18938] ERROR -- : /Users/username/.rvm/gems/[email protected]/gems/rack-1.3.6/lib/rack/lint.rb:525:in `each' 
21:47:05 web.1  | E, [2012-03-22T21:47:05.547277 #18938] ERROR -- : /Users/username/.rvm/gems/[email protected]/gems/rack-1.3.6/lib/rack/body_proxy.rb:23:in `method_missing' 
21:47:05 web.1  | E, [2012-03-22T21:47:05.547375 #18938] ERROR -- : /Users/username/.rvm/gems/[email protected]/gems/unicorn-4.2.0/lib/unicorn/http_response.rb:41:in `http_response_write' 
21:47:05 web.1  | E, [2012-03-22T21:47:05.547476 #18938] ERROR -- : /Users/username/.rvm/gems/[email protected]/gems/unicorn-4.2.0/lib/unicorn/http_server.rb:538:in `process_client' 
21:47:05 web.1  | E, [2012-03-22T21:47:05.547574 #18938] ERROR -- : /Users/username/.rvm/gems/[email protected]/gems/unicorn-4.2.0/lib/unicorn/http_server.rb:604:in `worker_loop' 
21:47:05 web.1  | E, [2012-03-22T21:47:05.547672 #18938] ERROR -- : /Users/username/.rvm/gems/[email protected]/gems/unicorn-4.2.0/lib/unicorn/http_server.rb:487:in `spawn_missing_workers' 
21:47:05 web.1  | E, [2012-03-22T21:47:05.547770 #18938] ERROR -- : /Users/username/.rvm/gems/[email protected]/gems/unicorn-4.2.0/lib/unicorn/http_server.rb:137:in `start' 
21:47:05 web.1  | E, [2012-03-22T21:47:05.547867 #18938] ERROR -- : /Users/username/.rvm/gems/[email protected]/gems/unicorn-4.2.0/bin/unicorn:121:in `<top (required)>' 
21:47:05 web.1  | E, [2012-03-22T21:47:05.547966 #18938] ERROR -- : /Users/username/.rvm/gems/[email protected]/bin/unicorn:19:in `load' 
21:47:05 web.1  | E, [2012-03-22T21:47:05.548063 #18938] ERROR -- : /Users/username/.rvm/gems/[email protected]/bin/unicorn:19:in `<main>' 

Tutte le idee su ciò che può essere in corso Qui? In questo momento non sto cercando una soluzione che si rivolga specificamente a cosa fare in questo scenario per quanto riguarda la ricerca e la ricerca di ciò che può realmente accadere.

risposta

1

So che è una vecchia domanda, ma ho lo stesso identico problema. Le richieste da UptimeRobot e New Relic (e solo da IP da questi due) danno questi messaggi di log.

Sia UptimeRobot che NewRelic riportano "OK".

Sembra che non sia la richiesta di Rack::Lint lamentarsi, ma la risposta. Guarda lo stacktrace. Passa attraverso http_response_write di unicorno (anch'io uso unicorno).

Investigherò di più e aggiungerò qualsiasi risultato qui.

UPDATE:

io sono in grado di riprodurre il problema con

$ curl https://example.com -X HEAD -i 
HTTP/1.1 200 OK 
Server: nginx/1.6.2 (Ubuntu) 
Date: Wed, 18 Nov 2015 09:17:11 GMT 
Content-Type: text/html; charset=utf-8 
Content-Length: 18422 
Connection: keep-alive 
Status: 200 OK 
... 

curl: (18) transfer closed with 18422 bytes remaining to read 

così sembra che il mio vecchio Rails non sta sostenendo richieste HEAD correttamente.

AGGIORNAMENTO: non riesco a riprodurlo sul mio vagabondo o sul server di staging. L'unica differenza dalla produzione che posso pensare è SSL.

0

Sembra che il tuo robot Uptime stia inviando un'intestazione con il valore sbagliato. Dovrebbe essere inviata l'intestazione Lunghezza contenuto con un valore pari a 0 (o non inviarlo affatto) ma lo sta inviando con 31842, che è probabilmente sbagliato.

Si potrebbe dirigerlo a qualche altro server http, scaricare tutte le intestazioni e vedere il motivo per cui sta inviando questo o semplicemente cambiare il tuo robot uptime per non inviare questa intestazione.