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

Error: runtime error: invalid memory address or nil pointer dereference #12

Closed
AshDerTest opened this issue Feb 10, 2022 · 1 comment · Fixed by #13
Closed

Error: runtime error: invalid memory address or nil pointer dereference #12

AshDerTest opened this issue Feb 10, 2022 · 1 comment · Fixed by #13

Comments

@AshDerTest
Copy link
Contributor

AshDerTest commented Feb 10, 2022

Hi

I am currently using flagger for all my canary deployments which works fine.
I have attempted to implement the k6 test using the solution provided in the documentation within this repo, to run using flagger, however encounter the following problem:

time="2022-02-10T10:11:18Z" level=info msg="not creating a kubernetes client" time="2022-02-10T10:11:18Z" level=info msg="starting server at :80" time="2022-02-10T10:13:48Z" level=info msg="parsing the request payload" command=/launch-test ip="10.244.0.9:57572" requestID=abcfc7e0-7faa-40bb-bc11-557cd72c00af time="2022-02-10T10:13:48Z" level=info msg="fetching secrets (if any)" command=/launch-test ip="10.244.0.9:57572" requestID=abcfc7e0-7faa-40bb-bc11-557cd72c00af time="2022-02-10T10:13:48Z" level=info msg="launching k6 test" command=/launch-test ip="10.244.0.9:57572" requestID=abcfc7e0-7faa-40bb-bc11-557cd72c00af time="2022-02-10T10:13:48Z" level=debug msg="launching 'k6 run /tmp/k6-script3416005183'" time="2022-02-10T10:13:48Z" level=info msg="waiting for output path" command=/launch-test ip="10.244.0.9:57572" requestID=abcfc7e0-7faa-40bb-bc11-557cd72c00af time="2022-02-10T10:13:48Z" level=debug msg="waiting 2 seconds for test to start" command=/launch-test ip="10.244.0.9:57572" requestID=abcfc7e0-7faa-40bb-bc11-557cd72c00af 2022/02/10 10:13:50 http: panic serving 10.244.0.9:57572: runtime error: invalid memory address or nil pointer dereference goroutine 68 [running]: net/http.(*conn).serve.func1() /usr/local/go/src/net/http/server.go:1801 +0xb9 panic({0x14ae3c0, 0x23c7a00}) /usr/local/go/src/runtime/panic.go:1047 +0x266 github.com/grafana/flagger-k6-webhook/pkg/handlers.(*launchHandler).ServeHTTP(0xc0003b3ae0, {0x7f1f10dcc0a8, 0xc0000941e0}, 0x681ea5) /app/pkg/handlers/launch.go:281 +0x721 github.com/prometheus/client_golang/prometheus/promhttp.InstrumentHandlerCounter.func1({0x186fd88, 0xc0000be620}, 0xc0000b6800) /go/pkg/mod/github.com/prometheus/client_golang@v1.11.0/prometheus/promhttp/instrument_server.go:101 +0x92 net/http.HandlerFunc.ServeHTTP(0xc000458b40, {0x186fd88, 0xc0000be620}, 0xc0000be620) /usr/local/go/src/net/http/server.go:2046 +0x2f net/http.(*ServeMux).ServeHTTP(0x0, {0x186fd88, 0xc0000be620}, 0xc0000b6800) /usr/local/go/src/net/http/server.go:2424 +0x149 net/http.serverHandler.ServeHTTP({0x1864c28}, {0x186fd88, 0xc0000be620}, 0xc0000b6800) /usr/local/go/src/net/http/server.go:2878 +0x43b

OS: Docker + Kind + Helm + k8s 1.23
Note:

  • Flagger running fine
  • K6 pod runs fine
  • K6 run works fine (used configmap to test in pod)

image

Script as per below:
` import http from 'k6/http';
import { sleep, check } from 'k6';
import { Counter } from 'k6/metrics';

        export const requests = new Counter('http_reqs');
        
        export let options = {
          vus: 1,
          duration: '30s',
          iterations: 1,
        };

        export default function () {
          const res = http.get('http://{{ include "test.fullname" . }}-canary.{{- .Release.Namespace }}:{{ .Values.service.port }}');
          sleep(1);
          const checkRes = check(res, {
            'status is 200': (r) => r.status === 200,
          });
        }     `

Please can you assist, if any further info is required, please let me know.

@julienduchesne
Copy link
Member

Hey @AshDerTest. Thanks for the report! This was due to the fact that you haven't set a Slack token (which should have been allowed). I've fixed the panic in v0.1.1

Let me know if you face any other issues with this tool! We have been using it in production for a little while here at Grafana Labs but it can definitely benefit from some external eyes

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

Successfully merging a pull request may close this issue.

2 participants