auxesis / visage

Graph collectd metrics in the browser, backed by a JSON API
http://visage-app.com/
Other
381 stars 56 forks source link

undefined method `join' for nil:NilClass #92

Closed eegilbert closed 12 years ago

eegilbert commented 12 years ago

Hi,

I just discovered Collectd and Visage, very cool stuff!

I'm running Ubuntu server 11.10 and while I can start the application and add a system to a profile, when trying to view this profile I get the following in the Webrick output:

NoMethodError - undefined method `join' for nil:NilClass:
        /usr/lib/ruby/gems/1.8/gems/visage-app-2.0.0/lib/visage-app/views/profile.haml:13:in `evaluate_source'
        /usr/lib/ruby/gems/1.8/gems/tilt-1.3.3/lib/tilt/template.rb:144:in `cached_evaluate'
        /usr/lib/ruby/gems/1.8/gems/tilt-1.3.3/lib/tilt/template.rb:127:in `evaluate'
        /usr/lib/ruby/gems/1.8/gems/tilt-1.3.3/lib/tilt/haml.rb:24:in `evaluate'
        /usr/lib/ruby/gems/1.8/gems/tilt-1.3.3/lib/tilt/template.rb:76:in `render'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:636:in `render'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:532:in `haml'
        /usr/lib/ruby/gems/1.8/gems/visage-app-2.0.0/lib/visage-app.rb:48:in `GET /profiles/:url'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:1211:in `call'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:1211:in `compile!'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:785:in `[]'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:785:in `route!'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:801:in `route_eval'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:785:in `route!'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:822:in `process_route'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:820:in `catch'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:820:in `process_route'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:784:in `route!'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:783:in `each'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:783:in `route!'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:886:in `dispatch!'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:719:in `call!'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:871:in `invoke'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:871:in `catch'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:871:in `invoke'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:719:in `call!'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:705:in `call'
        /usr/lib/ruby/gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/xss_header.rb:22:in `call'
        /usr/lib/ruby/gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/path_traversal.rb:16:in `call'
        /usr/lib/ruby/gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/json_csrf.rb:17:in `call'
        /usr/lib/ruby/gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/base.rb:47:in `call'
        /usr/lib/ruby/gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/xss_header.rb:22:in `call'
        /usr/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/nulllogger.rb:9:in `call'
        /usr/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/head.rb:9:in `call'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/showexceptions.rb:21:in `call'
        /usr/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/handler/webrick.rb:59:in `service'
        /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
        /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
        /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
        /usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
        /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
        /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
        /usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
        /usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
        /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
        /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
        /usr/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/handler/webrick.rb:13:in `run'
        /usr/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/server.rb:265:in `start'
        /usr/lib/ruby/gems/1.8/gems/visage-app-2.0.0/bin/visage-app:45
        /usr/bin/visage-app:19:in `load'
        /usr/bin/visage-app:19

I did have to update tilt to 1.3.3 before I could install visage-app via gem.

Erric

auxesis commented 12 years ago

Hi @eegilbert. Thanks for reporting this bug in Visage 2.0, and including a stack trace.

I'll take a look at the bug this evening, and will likely release an updated gem with the fix.

auxesis commented 12 years ago

Hi @eegilbert, would you be able to post a copy of your profile.yaml into this issue?

I think there may be a race condition being triggered when Visage manipulates profile.yaml.

auxesis commented 12 years ago

Also, through diagnosing this issue I managed to come across a JavaScript bug that stopped the save button from being rendered in newer versions of Firefox.

I've pushed out a 2.0.1 release that fixes this bug, and expect to push out another to fix this race condition.

eegilbert commented 12 years ago

Hi auxesis, I have a profiles.yaml that contains:

root@afid:~# more /usr/lib/ruby/gems/1.8/gems/visage-app-2.0.0/lib/visage-app/config/profiles.yaml
--- 
afid+erric+local: 
  :profile_name: afid.erric.local
  :url: afid+erric+local
  :hosts: 
  - afid.erric.local
  :metrics: 

But that's all it contains. I did forget to mention I was doing this with Chrome 17.0.963.79 m

Thank you!

Erric

auxesis commented 12 years ago

@eegilbert hmm ok, that's a bit weird - definitely a bug.

So you selected a host (afid.erric.local) in the builder interface, and then just saved a profile?

Did you select a metric as well before saving?

eegilbert commented 12 years ago

I just updated to 2.0.2 with gem and then:

  1. Started the app with: visage-app start
  2. Typed afid.erric.local in the Hosts input box of the Builder
  3. Clicked on Show Graphs (nothing happens but the Save profile button appears)
  4. I type in the name afid.erric.local into the Save profile input box and then hit the Save profile button
  5. I click on Profiles and then click on erric.afid.local and get the stack trace

Stack Trace:

NoMethodError - undefined method `join' for nil:NilClass:
        /usr/lib/ruby/gems/1.8/gems/visage-app-2.0.2/lib/visage-app/views/profile.haml:13:in `evaluate_source'
        /usr/lib/ruby/gems/1.8/gems/tilt-1.3.3/lib/tilt/template.rb:144:in `cached_evaluate'
        /usr/lib/ruby/gems/1.8/gems/tilt-1.3.3/lib/tilt/template.rb:127:in `evaluate'
        /usr/lib/ruby/gems/1.8/gems/tilt-1.3.3/lib/tilt/haml.rb:24:in `evaluate'
        /usr/lib/ruby/gems/1.8/gems/tilt-1.3.3/lib/tilt/template.rb:76:in `render'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:636:in `render'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:532:in `haml'
        /usr/lib/ruby/gems/1.8/gems/visage-app-2.0.2/lib/visage-app.rb:48:in `GET /profiles/:url'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:1211:in `call'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:1211:in `compile!'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:785:in `[]'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:785:in `route!'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:801:in `route_eval'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:785:in `route!'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:822:in `process_route'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:820:in `catch'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:820:in `process_route'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:784:in `route!'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:783:in `each'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:783:in `route!'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:886:in `dispatch!'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:719:in `call!'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:871:in `invoke'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:871:in `catch'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:871:in `invoke'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:719:in `call!'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/base.rb:705:in `call'
        /usr/lib/ruby/gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/xss_header.rb:22:in `call'
        /usr/lib/ruby/gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/path_traversal.rb:16:in `call'
        /usr/lib/ruby/gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/json_csrf.rb:17:in `call'
        /usr/lib/ruby/gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/base.rb:47:in `call'
        /usr/lib/ruby/gems/1.8/gems/rack-protection-1.2.0/lib/rack/protection/xss_header.rb:22:in `call'
        /usr/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/nulllogger.rb:9:in `call'
        /usr/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/head.rb:9:in `call'
        /usr/lib/ruby/gems/1.8/gems/sinatra-1.3.2/lib/sinatra/showexceptions.rb:21:in `call'
        /usr/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/handler/webrick.rb:59:in `service'
        /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
        /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
        /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
        /usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
        /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
        /usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
        /usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
        /usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
        /usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
        /usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
        /usr/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/handler/webrick.rb:13:in `run'
        /usr/lib/ruby/gems/1.8/gems/rack-1.4.1/lib/rack/server.rb:265:in `start'
        /usr/lib/ruby/gems/1.8/gems/visage-app-2.0.2/bin/visage-app:45
        /usr/bin/visage-app:19:in `load'
        /usr/bin/visage-app:19
10.0.0.54 - - [25/Mar/2012:05:39:59 PDT] "GET /profiles/afid+erric+local HTTP/1.1" 500 236411
http://afid.erric.local:9292/profiles -> /profiles/afid+erric+local
10.0.0.54 - - [25/Mar/2012:05:39:59 PDT] "GET /favicon.ico HTTP/1.1" 404 454

I've also tried this with Firefox and IE and get the same results.

Thank you!

Erric

auxesis commented 12 years ago

Ah right, I know what's going on here - I'm missing some input validation.

I'm pushing a fix for this now in the 2.0.3 release. You'll need to recreate your profiles.yaml for this release.

I'll let you know when I've done the release.

auxesis commented 12 years ago

OK, I've pushed out 2.0.4 with a fix for this issue.

Please upgrade and let me know if you still have the issue!

eegilbert commented 12 years ago

Yes, it's working now! :-) Thank you for the super quick turn around.

Erric