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

slice bounds out of range #2706

Closed
PeeZu opened this issue Aug 14, 2019 · 9 comments
Closed

slice bounds out of range #2706

PeeZu opened this issue Aug 14, 2019 · 9 comments
Labels
bug 🐞 Something isn't working

Comments

@PeeZu
Copy link

PeeZu commented Aug 14, 2019

1. Which version of Caddy are you using (caddy -version)?

1.0.2

2. What are you trying to do?

validate the Caddyfile

3. What is your Caddyfile?

:80 {

}

OR

:443 {

}

4. How did you run Caddy (give the full command and describe the execution environment)?

just try to validate the Caddyfile with: caddy -validate -conf /path/to/your/caddyfile

5. Please paste any relevant HTTP request(s) here.

6. What did you expect to see?

Caddyfile is valid

7. What did you see instead (give full error messages and/or log)?

panic: runtime error: slice bounds out of range

goroutine 1 [running]:
github.com/caddyserver/caddy/caddyhttp/httpserver.Address.Key(...)
        /Users/matt/Dev/src/github.com/caddyserver/releaser/cmd/release-caddy/buildenv_08-13-1452.612513987/main/vendor/github.com/caddyserver/caddy/caddyhttp/httpserver/plugin.go:494
github.com/caddyserver/caddy/caddyhttp/httpserver.(*httpContext).InspectServerBlocks(0xc000144c90, 0xc00002a270, 0x27, 0xc00014c180, 0x1, 0x1, 0xc00014c180, 0x1, 0x1, 0x0, ...)
        /Users/matt/Dev/src/github.com/caddyserver/releaser/cmd/release-caddy/buildenv_08-13-1452.612513987/main/vendor/github.com/caddyserver/caddy/caddyhttp/httpserver/plugin.go:143 +0x12f5
github.com/caddyserver/caddy.ValidateAndExecuteDirectives(0xd56ca0, 0xc00014b000, 0xc00016e100, 0xc00014b001, 0x0, 0x0)
        /Users/matt/Dev/src/github.com/caddyserver/releaser/cmd/release-caddy/buildenv_08-13-1452.612513987/main/vendor/github.com/caddyserver/caddy/caddy.go:614 +0x3be
github.com/caddyserver/caddy/caddy/caddymain.Run()
        /Users/matt/Dev/src/github.com/caddyserver/releaser/cmd/release-caddy/buildenv_08-13-1452.612513987/main/vendor/github.com/caddyserver/caddy/caddy/caddymain/run.go:182 +0x90d
main.main()
        main/main.go:11 +0x2e

8. Why is this a bug, and how do you think this should be fixed?

Server doesn't start as expected

9. What are you doing to work around the problem in the meantime?

revert to previous version 1.0.1

@DanyHenriquez
Copy link

DanyHenriquez commented Aug 14, 2019

Experiencing the same thing


goroutine 1 [running]:
github.com/caddyserver/caddy/caddyhttp/httpserver.Address.Key(...)
	/tmp/buildenv_08-14-0630.667715477/main/vendor/github.com/caddyserver/caddy/caddyhttp/httpserver/plugin.go:494
github.com/caddyserver/caddy/caddyhttp/httpserver.(*httpContext).InspectServerBlocks(0xc000031170, 0x7ffe3b639f5c, 0xf, 0xc0001e6100, 0x3, 0x4, 0xc0001e6100, 0x3, 0x4, 0x0, ...)
	/tmp/buildenv_08-14-0630.667715477/main/vendor/github.com/caddyserver/caddy/caddyhttp/httpserver/plugin.go:143 +0x12ee
github.com/caddyserver/caddy.ValidateAndExecuteDirectives(0xea5f00, 0xc00003ad40, 0xc0001fc200, 0xc0001fc200, 0x1, 0xc00000e058)
	/tmp/buildenv_08-14-0630.667715477/main/vendor/github.com/caddyserver/caddy/caddy.go:614 +0x3b7
github.com/caddyserver/caddy.startWithListenerFds(0xea5f00, 0xc00003ad40, 0xc0001fc200, 0x0, 0x0, 0x0)
	/tmp/buildenv_08-14-0630.667715477/main/vendor/github.com/caddyserver/caddy/caddy.go:516 +0x125
github.com/caddyserver/caddy.Start(0xea5f00, 0xc00003ad40, 0xea5f00, 0xc00003ad40, 0x0)
	/tmp/buildenv_08-14-0630.667715477/main/vendor/github.com/caddyserver/caddy/caddy.go:473 +0xea
github.com/caddyserver/caddy/caddy/caddymain.Run()
	/tmp/buildenv_08-14-0630.667715477/main/vendor/github.com/caddyserver/caddy/caddy/caddymain/run.go:193 +0x646
main.main()
	main/main.go:17 +0x27

I have tried 0.0.0.0:80, *:80 and :80. All variations give this error.

@ABeltramo
Copy link

Same issue using the docker image.

@DanyHenriquez
Copy link

From the comment with version 1.0.2 release

One minor breaking change in Go 1.12.8 might affect some configurations that use service name in the port of their Caddyfiles, like so: example.com:https - we've smoothed this over so the behavior of Caddy is the same but if you encounter any odd inconsistencies, switch to using numeric ports or proper URL scheme: either https://example.com (recommended) or example.com:443.

@DanyHenriquez
Copy link

DanyHenriquez commented Aug 14, 2019

I found a fix

We used *:80 and other versions of this definition.

Change it to http://*:80. So put the protocol in front of it and caddy will start with version 1.0.2.

This is also in line with the comment attached to the release.

Hope this will help you guys too :)

@mholt
Copy link
Member

mholt commented Aug 14, 2019

Oops, would someone like to contribute a patch? I'll be away from the computer for the next ~6 hours.

@paulgalow
Copy link

I found a fix

We used *:80 and other versions of this definition.

Change it to http://*:80. So put the protocol in front of it and caddy will start with version 1.0.2.

This is also in line with the comment attached to the release.

Hope this will help you guys too :)

Thanks for posting this fix. Was running into the same issue here.

# Old naming scheme produces a runtime error on v1.0.2
name.example.com:80 { }
# Fix
http://name.example.com:80 { }

@mholt mholt closed this as completed in a08ab0c Aug 14, 2019
@mholt
Copy link
Member

mholt commented Aug 14, 2019

I've added test cases and pushed a fix at a08ab0c - would you please try that and confirm it works for you and then I will tag another release. Thanks

@mholt mholt added the bug 🐞 Something isn't working label Aug 14, 2019
@hectorm
Copy link

hectorm commented Aug 14, 2019

I confirm that it is now working correctly. Thanks!

grugnog added a commit to CivicActions/civicactions.com that referenced this issue Aug 14, 2019
@mholt
Copy link
Member

mholt commented Aug 14, 2019

Caddy v1.0.3 has this fix. Thanks for the report!

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

No branches or pull requests

6 participants