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

Using "ssl" : true cause a panic: runtime error #725

Closed
dericabel opened this issue Oct 23, 2017 · 8 comments · Fixed by #738
Closed

Using "ssl" : true cause a panic: runtime error #725

dericabel opened this issue Oct 23, 2017 · 8 comments · Fixed by #738
Assignees
Milestone

Comments

@dericabel
Copy link

When setting "ssl" : true without a "path" setting causes the application to crash

Expected Behavior

"path" should default to "" and start without issue

Current Behavior

When "ssl" is true in the config and "path" is "" or not set I get the following

{"timestamp":"2017-10-23T21:41:45.15535672Z","level":"info","message":"Updating the datacenter ProdZone"}
panic: runtime error: makeslice: len out of range

goroutine 5 [running]:
panic(0x7c38c0, 0xc8204a1fb0)
	/usr/local/go/src/runtime/panic.go:481 +0x3e6
github.com/sensu/uchiwa/uchiwa/sensu.(*API).doRequest(0xc8200bc300, 0xc8204aac40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/go/src/github.com/sensu/uchiwa/uchiwa/sensu/request.go:33 +0x4c5
github.com/sensu/uchiwa/uchiwa/sensu.(*API).get(0xc8200bc300, 0xc820436180, 0x27, 0x0, 0x0, 0x0, 0x27, 0x0, 0x0)
	/go/src/github.com/sensu/uchiwa/uchiwa/sensu/methods.go:158 +0x246
github.com/sensu/uchiwa/uchiwa/sensu.(*API).getBytes(0xc8200bc300, 0x83f818, 0x4, 0x0, 0x0, 0x0, 0x5, 0x0, 0x0)
	/go/src/github.com/sensu/uchiwa/uchiwa/sensu/methods.go:22 +0x1db
github.com/sensu/uchiwa/uchiwa/sensu.(*Sensu).getBytes(0xc8201dca80, 0x83f818, 0x4, 0x0, 0x0, 0x0, 0x72e940, 0x0, 0x0)
	/go/src/github.com/sensu/uchiwa/uchiwa/sensu/loadbalancing.go:38 +0x2ef
github.com/sensu/uchiwa/uchiwa/sensu.(*Sensu).GetInfo(0xc8201dca80, 0xa61ce0, 0x0, 0x0)
	/go/src/github.com/sensu/uchiwa/uchiwa/sensu/info.go:13 +0x57
github.com/sensu/uchiwa/uchiwa/daemon.(*Daemon).fetchData(0xc8200ed920)
	/go/src/github.com/sensu/uchiwa/uchiwa/daemon/daemon.go:115 +0x1087
github.com/sensu/uchiwa/uchiwa/daemon.(*Daemon).Start(0xc8200ed920, 0xa, 0xc820012360)
	/go/src/github.com/sensu/uchiwa/uchiwa/daemon/daemon.go:29 +0x3d
created by github.com/sensu/uchiwa/uchiwa.Init
	/go/src/github.com/sensu/uchiwa/uchiwa/main.go:48 +0x28f

If I set "path" to "/" I get the following:

{"timestamp":"2017-10-23T21:46:37.067709864Z","level":"info","message":"Updating the datacenter ProdZone"}
{"timestamp":"2017-10-23T21:46:37.13293948Z","level":"warn","message":"GET https://[redacted]:4567//stashes returned: 404 Not Found"}

https://host:4567//stashes isn't a valid URL

Steps to Reproduce (for bugs)

Use a similar config to

{
      "sensu":[
        {
          "host":"dc1",
          "name":"ProdZone",
          "ssl":true
        },
        {
          "host":"dc2",
          "name":"DevZone",
          "ssl":true
        }
      ]
}

Context

I can't connected to a sensu api with SSL enabled without the above issue.

Your Environment

  • Uchiwa version used: 0.26.2-1 (docker image)
  • Sensu version used: 1.1.0
  • Operating System and version: Docker
@dericabel
Copy link
Author

Just built my own docker image from 0.26.3

Same issue.

@dericabel
Copy link
Author

I had nginx fronting the API so we could have SSL enabled. This appears to be causing uchiwa to crash on a call to /info.

@dericabel
Copy link
Author

Uchiwa 0.25.3-1 does not have this problem and works with nginx ssl fronting the sensu api

@julian7
Copy link

julian7 commented Oct 26, 2017

I tested with all versions, and the latest one which still works is 0.26.0-1.

@palourde
Copy link
Contributor

Some modifications were done in the HTTP client used by Uchiwa to query the APIs in the subsequent 0.26 releases. I just pushed a change which prevents the panic in #738. That being said, I'm not 100% sure why the content length would be unknown (-1) but it should help us understand what's going on if you still have this problem in the 1.0.0 release.

Thanks!

@julian7
Copy link

julian7 commented Jan 31, 2018

The issue now doesn't kill uchiwa, but it still not working well. 1.1.0-1 provides an error instead, as per #751 .

@tcador
Copy link

tcador commented Feb 7, 2018

@julian7 - I ran into this same issue and found that a compression profile set on our load balancer was to blame. Once removing that this error went away.

@julian7
Copy link

julian7 commented Feb 8, 2018

@tcador I can confirm that: I added gzip: off into my remote sensu server's reverse proxy (it's nginx), and now it works well with 1.1.3-1. Still, it would be nice to have compression support in the used HTTP client library ^^

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants