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

runtime error: slice bounds out of range [1:0] #86

Closed
damir-bdr opened this issue Mar 16, 2021 · 2 comments · Fixed by #88
Closed

runtime error: slice bounds out of range [1:0] #86

damir-bdr opened this issue Mar 16, 2021 · 2 comments · Fixed by #88
Assignees
Labels
bug Something isn't working

Comments

@damir-bdr
Copy link

I initialize routes like this:

func (h *HttpSrv) createRoutes() {
	h.g.Get("/dsp/cpc/:sspId", h.handleGetBids)
	h.g.Post("/dsp/cpc/:sspId", h.handlePostBids)

	h.g.Get("/dsp-native/cpc/:sspId", h.handleNativeGetBids)
	h.g.Post("/dsp-native/cpc/:sspId", h.handleNativePostBids)

	h.g.Get("/dsp-popunder/cpc/:sspId", h.handlePopunderGetBids)
	h.g.Post("/dsp-popunder/cpc/:sspId", h.handlePopunderPostBids)
}

func (h *HttpSrv) handleGetBids(ctx gearbox.Context) {
	mw, ok := sspinfo.GetSspProcessorsPool().GetPushProcessor(ctx.Param("sspId"))
	if ok {
		mw.ExecQueryParamsHandler(ctx)
	} else {
		ctx.Status(gearbox.StatusNotFound)
	}
}

And catching the next panic:

panic: runtime error: slice bounds out of range [1:0]
goroutine 2027 [running]:
github.com/gogearbox/gearbox.(*node).matchRoute(0xc000557c00, 0xc031aa2900, 0x0, 0xc030b9b320, 0xc02e463f68, 0xc032ece400, 0x3)
	/go/pkg/mod/github.com/gogearbox/gearbox@v1.2.0/tree.go:134 +0x289
github.com/gogearbox/gearbox.(*router).Handler(0xc0005d0c80, 0xc0323d7400)
	/go/pkg/mod/github.com/gogearbox/gearbox@v1.2.0/router.go:163 +0x745
github.com/valyala/fasthttp.(*Server).serveConn(0xc02e54c000, 0xa69b38, 0xc031106420, 0x0, 0x0)
	/go/pkg/mod/github.com/valyala/fasthttp@v1.21.0/server.go:2193 +0x128e
github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc02e468640, 0xc032c9b0a0)
	/go/pkg/mod/github.com/valyala/fasthttp@v1.21.0/workerpool.go:223 +0xba
github.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc02e468640, 0xc032c9b0a0, 0x905520, 0xc032c9b0a0)
	/go/pkg/mod/github.com/valyala/fasthttp@v1.21.0/workerpool.go:195 +0x35
created by github.com/valyala/fasthttp.(*workerPool).getCh
	/go/pkg/mod/github.com/valyala/fasthttp@v1.21.0/workerpool.go:194 +0x11f

What the reason could be?

@abahmed abahmed self-assigned this Mar 17, 2021
@abahmed
Copy link
Member

abahmed commented Mar 18, 2021

Hey @damir-bdr Thanks for raising this issue. I'm going to check it ASAP.

@abahmed
Copy link
Member

abahmed commented Mar 18, 2021

@damir-bdr Can you provide the path of the request you're trying that causes this issue? (e.g. http://localhost:300/dsp-native/cpc/123)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants