Skip to content

Issues with k6 v1 API #23

@ragnarlonn

Description

@ragnarlonn

Feedback from engineering candidate Diego:

I seem to be running into problems when trying to interact with the v1 API, which in turn seems to cause the Ember front-end to display a "An error occurred." message.

It looks like all requests on the v1 API seem to be failing - both trying to fetch http://127.0.0.1:6565/v1/xxx and k6 commands that rely on the endpoints (for example "$ k6 stats") raise a panic on the lingering k6 instance. My scenario would be:

1) launching a k6 run for a script, pausing it when completes via the
lingering flag:
$ docker run --rm --net=host -v /tmp/scripts/localhost.js:/myscript.js loadimpact/k6:latest run -u 1 -d 1s -l /myscript.js
(execution is fine - http requests are made, etc and pauses when the specified amount of time passed)

2) launching a request for the v1 api, via HTTP or command
2.1) launch another command on another shell (ex. stats)
-----
$ docker run --rm --net=host  loadimpact/k6:latest stats
time="2016-12-17T15:26:47Z" level=error msg=Error error="unexpected end of JSON input"
unexpected end of JSON input

2.2) panic on the other shell with the k6 run
2016/12/17 15:26:47 [Recovery] panic recovered:
GET /v1/metrics HTTP/1.1
Host: 127.0.0.1:6565
Accept-Encoding: gzip
User-Agent: Go-http-client/1.1


interface conversion: interface {} is nil, not *lib.Engine
/usr/local/go/src/runtime/panic.go:458 (0x431883)
    gopanic: reflectcall(nil, unsafe.Pointer(d.fn), deferArgs(d), uint32(d.siz), uint32(d.siz))
/usr/local/go/src/runtime/iface.go:201 (0x414c2f)
    panicdottype: panic(&TypeAssertionError{iface.string(), haveString, want.string(), ""})
/go/src/github.com/loadimpact/k6/api/common/context.go:37 (0x59151e)
    GetEngine: return ctx.Value(ctxKeyEngine).(*lib.Engine)
(...)

Imported from https://trello.com/c/1kc7skeF/99-issues-with-k6-v1-api

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions