Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index out of range panic in solr input #3604

Closed
windspear opened this issue Dec 20, 2017 · 6 comments
Closed

Index out of range panic in solr input #3604

windspear opened this issue Dec 20, 2017 · 6 comments
Labels
bug unexpected problem or unintended behavior panic issue that results in panics from Telegraf
Milestone

Comments

@windspear
Copy link

CentOS release 6.4
Telegraf v1.5.0 (git: release-1.5 a1668bb)

use solr plugin as default config

[[inputs.solr]]

specify a list of one or more Solr servers

servers = ["http://localhost:8983"]

specify a list of one or more Solr cores (default - all)

cores = ["main"]

i got this error ,how to fix it ? thank you

Error in plugin [inputs.solr]: Get http://localhost:8983/solr/resource/admin/mbeans?stats=true&wt=json&cat=CORE&cat=QUERYHANDLER&cat=UPDATEHANDLER&cat=CACHE: net/http: request canceled (Client.Timeout exceeded while awaiting headers)
panic: runtime error: index out of range

goroutine 475 [running]:
github.com/influxdata/telegraf/plugins/inputs/solr.addCoreMetricsToAcc(0x1d9cf80, 0xc4200dcdc0, 0xc4208a8fc8, 0x8, 0xc42073efc0, 0xbe86a97a80425d32, 0x1ca1ec2193, 0x1e89820, 0x4, 0xc4203fb660)
/home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/plugins/inputs/solr/solr.go:249 +0x5e0
github.com/influxdata/telegraf/plugins/inputs/solr.(*Solr).gatherServerMetrics.func1(0xc4208a9720, 0xc4203f4ff0, 0xbe86a97a80425d32, 0x1ca1ec2193, 0x1e89820, 0xc4207b0841, 0x18, 0xc4208a8fc8, 0x8, 0x1d9cf80, ...)
/home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/plugins/inputs/solr/solr.go:200 +0x173
created by github.com/influxdata/telegraf/plugins/inputs/solr.(*Solr).gatherServerMetrics
/home/ubuntu/telegraf-build/src/github.com/influxdata/telegraf/plugins/inputs/solr/solr.go:196 +0x261

@ljagiello
Copy link
Contributor

Hi @windspear,

Could you provide more info? What Solr version are you using, what's the result of:

curl -svo result.txt http://localhost:8983/solr/resource/admin/mbeans?stats=true&wt=json&cat=CORE&cat=QUERYHANDLER&cat=UPDATEHANDLER&cat=CACHE

@windspear
Copy link
Author

windspear commented Dec 21, 2017

solr version is 4.9.1

i use command curl -svo result.txt http://localhost:8983/solr/resource/admin/mbeans?stats=true&wt=json&cat=CORE&cat=QUERYHANDLER&cat=UPDATEHANDLER&cat=CACHE
and got this

curl -svo result.txt http://localhost:8983/solr/resource/admin/mbeans?stats=true&wt=json&cat=CORE&cat=QUERYHANDLER&cat=UPDATEHANDLER&cat=CACHE
[1] 23709
[2] 23710
[3] 23711
[4] 23712
[5] 23713
[2] Done wt=json
[3] Done cat=CORE

  • About to connect() to localhost port 8983 (#0)
  • Trying ::1... connected
  • Connected to localhost (::1) port 8983 (#0)

GET /solr/resource/admin/mbeans?stats=true HTTP/1.1
User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.13.6.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Host: localhost:8983
Accept: /

< HTTP/1.1 200 OK
< Cache-Control: no-cache, no-store
< Pragma: no-cache
< Expires: Sat, 01 Jan 2000 01:00:00 GMT
< Last-Modified: Thu, 21 Dec 2017 08:05:13 GMT
< ETag: "160781ad93a"
< Content-Type: application/xml; charset=UTF-8
< Transfer-Encoding: chunked
<
{ [data not shown]

  • Failed writing body (0 != 16125)
  • Failed writing data
  • Closing connection #0

and must put enter ,got this
[1] Exit 23 curl -svo result.txt http://localhost:8983/solr/resource/admin/mbeans?stats=true
[4]- Done cat=QUERYHANDLER
[5]+ Done cat=UPDATEHANDLER

result.txt

@ljagiello
Copy link
Contributor

Try with quotes:

curl -svo result.txt "http://localhost:8983/solr/resource/admin/mbeans?stats=true&wt=json&cat=CORE&cat=QUERYHANDLER&cat=UPDATEHANDLER&cat=CACHE"

@windspear
Copy link
Author

that's ok

result.txt

@danielnelson danielnelson added the bug unexpected problem or unintended behavior label Jan 13, 2018
@danielnelson danielnelson changed the title Error in plugin [inputs.solr] Index out of range panic in solr input Jan 13, 2018
@danielnelson danielnelson added the panic issue that results in panics from Telegraf label Jan 13, 2018
@mkboudreau
Copy link
Contributor

I am getting the same thing and I have a fix. I am hoping to create a pull request today, I just want to make sure I have appropriate tests and all my ducks in a row.

The issue happens when the gatherData method does not return successfully, the following add... methods still execute without any error checks.

@danielnelson
Copy link
Contributor

Fix will be in 1.5.2, thanks to @mkboudreau

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior panic issue that results in panics from Telegraf
Projects
None yet
Development

No branches or pull requests

4 participants