Skip to content
This repository has been archived by the owner on Jan 7, 2020. It is now read-only.

Uchiwa doesn't start, multiple versions #332

Closed
erulabs opened this issue Jun 5, 2015 · 6 comments
Closed

Uchiwa doesn't start, multiple versions #332

erulabs opened this issue Jun 5, 2015 · 6 comments
Labels
Milestone

Comments

@erulabs
Copy link

erulabs commented Jun 5, 2015

panic: interface conversion: interface is []interface {}, not string

It seems like this may be a duplicate of issue #236 - however I've tested with Uchiwa 0.5.1, 0.7.0 and from source against master branch of this repository.

When running the binary directly /opt/uchiwa/bin/uchiwa -c /etc/sensu/uchiwa.json -p /opt/uchiwa/src/public, OR from source via go run uchiwa.go -c /etc/sensu/uchiwa.json - assuming my /etc/sensu/uchiwa.json has the following content:

{
  "sensu": [
    {
      "name": "Site 1",
      "host": "localhost",
      "port": 4567,
      "timeout": 5
    }
  ],
  "uchiwa": {
    "host": "0.0.0.0",
    "port": 3000,
    "user": "admin",
    "pass": "secret",
    "interval": 5
  }
}

I see the following crash:

{"Date":"2015-06-05T18:50:56.743264285Z","Level":"info","Src":{"Func":"github.com/sensu/uchiwa/uchiwa/config.Load","Line":72},"Output":"Loading configuration file /etc/sensu/uchiwa.json"}
{"Date":"2015-06-05T18:50:56.88572637Z","Level":"info","Src":{"Func":"github.com/sensu/uchiwa/uchiwa.(*Uchiwa).WebServer","Line":274},"Output":"Uchiwa is now listening on 0.0.0.0:3000"}
panic: interface conversion: interface is []interface {}, not string

goroutine 5 [running]:
github.com/sensu/uchiwa/uchiwa/daemon.(*Daemon).findStatus(0xc20802acf0, 0xc2080acf90)
    /root/go/src/github.com/sensu/uchiwa/uchiwa/daemon/helpers.go:70 +0xe6c
github.com/sensu/uchiwa/uchiwa/daemon.(*Daemon).buildClients(0xc20802acf0)
    /root/go/src/github.com/sensu/uchiwa/uchiwa/daemon/clients.go:12 +0x1f1
github.com/sensu/uchiwa/uchiwa/daemon.(*Daemon).buildData(0xc20802acf0)
    /root/go/src/github.com/sensu/uchiwa/uchiwa/daemon/daemon.go:52 +0x36
github.com/sensu/uchiwa/uchiwa/daemon.(*Daemon).Start(0xc20802acf0, 0xa, 0xc208052180)
    /root/go/src/github.com/sensu/uchiwa/uchiwa/daemon/daemon.go:23 +0x44
created by github.com/sensu/uchiwa/uchiwa.Init
    /root/go/src/github.com/sensu/uchiwa/uchiwa/main.go:50 +0x4c9

goroutine 1 [IO wait]:
net.(*pollDesc).Wait(0xc2081236b0, 0x72, 0x0, 0x0)
    /usr/local/go/src/net/fd_poll_runtime.go:84 +0x47
net.(*pollDesc).WaitRead(0xc2081236b0, 0x0, 0x0)
    /usr/local/go/src/net/fd_poll_runtime.go:89 +0x43
net.(*netFD).accept(0xc208123650, 0x0, 0x7f02490b1b20, 0xc2080ba808)
    /usr/local/go/src/net/fd_unix.go:419 +0x40b
net.(*TCPListener).AcceptTCP(0xc2080320a0, 0x4e5f54, 0x0, 0x0)
    /usr/local/go/src/net/tcpsock_posix.go:234 +0x4e
net/http.tcpKeepAliveListener.Accept(0xc2080320a0, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/net/http/server.go:1976 +0x4c
net/http.(*Server).Serve(0xc20811ce40, 0x7f02490b4e18, 0xc2080320a0, 0x0, 0x0)
    /usr/local/go/src/net/http/server.go:1728 +0x92
net/http.(*Server).ListenAndServe(0xc20811ce40, 0x0, 0x0)
    /usr/local/go/src/net/http/server.go:1718 +0x154
net/http.ListenAndServe(0xc20809fcf0, 0xc, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/net/http/server.go:1808 +0xba
github.com/sensu/uchiwa/uchiwa.(*Uchiwa).WebServer(0xc20800af90, 0xc20802a8a0, 0x7ab720, 0x722390, 0x6)
    /root/go/src/github.com/sensu/uchiwa/uchiwa/server.go:275 +0xd9f
main.main()
    /root/go/src/github.com/sensu/uchiwa/uchiwa.go:33 +0x42e

goroutine 6 [chan receive]:
github.com/sensu/uchiwa/uchiwa.(*Uchiwa).listener(0xc20800af90, 0xa, 0xc208052180)
    /root/go/src/github.com/sensu/uchiwa/uchiwa/main.go:74 +0x225
created by github.com/sensu/uchiwa/uchiwa.Init
    /root/go/src/github.com/sensu/uchiwa/uchiwa/main.go:51 +0x4fd

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:2232 +0x1

goroutine 9 [runnable]:
net/http.(*persistConn).readLoop(0xc208068160)
    /usr/local/go/src/net/http/transport.go:928 +0x9ce
created by net/http.(*Transport).dialConn
    /usr/local/go/src/net/http/transport.go:660 +0xc9f

goroutine 10 [select]:
net/http.(*persistConn).writeLoop(0xc208068160)
    /usr/local/go/src/net/http/transport.go:945 +0x41d
created by net/http.(*Transport).dialConn
    /usr/local/go/src/net/http/transport.go:661 +0xcbc
exit status 2

If I define a path, I get

"Date":"2015-06-05T18:39:51.188759236Z","Level":"info","Src":{"Func":"github.com/sensu/uchiwa/uchiwa.LoadConfig","Line":111},"Output":"Loading configuration file /etc/sensu/uchiwa.json"}
{"Date":"2015-06-05T18:39:51.225747626Z","Level":"warning","Src":{"Func":"github.com/sensu/uchiwa/uchiwa.Build","Line":53},"Output":"API call to \"http://localhost:4567//stashes\" returned: 404 Not Found"}
{"Date":"2015-06-05T18:39:51.418789948Z","Level":"info","Src":{"Func":"github.com/sensu/uchiwa/uchiwa.WebServer","Line":177},"Output":"Uchiwa is now listening on 0.0.0.0:3000"}

My thought is that this might not be Uchiwa's issue - Since it appears to be starting properly then crashing on a reply from Sensu API. Just to be sure, I tried 3 versions of Uchiwa (including current master as of about an hour ago), and I have loaded the default configuration file and played with it until I felt dizzy (The only thing that has any effect is breaking the connection to sensu-api - Uchiwa behaves normally if it can't reach sensu-api - if it can, it throws the error above).

My Sensu API is at version 0.17.0-1.

Any help would be appreciated! I'm sure there is some obvious issue here like me failing to understand the configuration or the version of Sensu-api.

Thanks!

@erulabs
Copy link
Author

erulabs commented Jun 5, 2015

Updated stack trace to output from current master branch (original post had the trace from a 0.5.1 build - this should be more helpful)

@palourde
Copy link
Contributor

palourde commented Jun 9, 2015

Hi @erulabs

I just merged #335 into master, could you try with the latest changes?

Thanks!

@erulabs
Copy link
Author

erulabs commented Jun 9, 2015

@palourde You're awesome! Thank you!!!

Just FYI I now see an error printed out quite a bit when: go run uchiwa.go -c config.json

config.json:

{
  "sensu": [
    {
      "name": "Site 1",
      "host": "localhost",
      "port": 4567
    }
  ],
  "uchiwa": {
    "host": "0.0.0.0",
    "port": 3000,
    "refresh": 5
  }
}

Error is:

{"Date":"2015-06-09T01:48:44.949198515Z","Level":"warning","Src":{"Func":"github.com/sensu/uchiwa/uchiwa/daemon.findClientEvents","Line":39},"Output":"Could not convert the event to a generic event structure: 1 error(s) decoding:\n\n* 'Check.Output' expected type 'string', got unconvertible type '[]interface {}'"}

Still, it works now! Thank you!

Edit: After looking at the code, my thought is that I have some heinous event data stored in Sensu somehow.

var event structs.GenericEvent

I'm gonna see if I can't debug this one myself and have it print some useful info about the event that it failed to decode 👍 Thanks again for all your help!

@palourde
Copy link
Contributor

palourde commented Jun 9, 2015

@erulabs Awesome!

The warning message you see is probably caused by an invalid event. I suggest you to flush the redis cache (redis-cli FLUSHALL) if possible, particularly if you just upgraded Sensu.

If you still see this message, could you provide me the output of the events endpoint on the Sensu API?(e.g. http://localhost:4567/events)

@palourde palourde added this to the 0.9.0 milestone Jun 9, 2015
@erulabs
Copy link
Author

erulabs commented Jun 9, 2015

Flushing the redis queue resolved the error message. Sort of upset with myself for not trying to figure out exactly what the malformed event was, but never-the-less, things are much much better now.

I'll leave this open (feel free to close it) - might be a good idea to leave open until this is released as a package as others may run into this.

@palourde
Copy link
Contributor

palourde commented Jun 9, 2015

@erulabs Uchiwa 0.9.0, which include this fix, has been released as today: http://blog.uchiwa.io/uchiwa-0-9-0/ so I'll close this issue but do not hesitate to let us know if you face any other issue!

@palourde palourde closed this as completed Jun 9, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants