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

Converting the nginx.conf panics #8

Closed
ansrivas opened this issue Mar 31, 2020 · 7 comments · Fixed by #9
Closed

Converting the nginx.conf panics #8

ansrivas opened this issue Mar 31, 2020 · 7 comments · Fixed by #9

Comments

@ansrivas
Copy link

ansrivas commented Mar 31, 2020

Hi @mholt, thank you for Caddy and especially for writing this adapter.

Trying to run the adapter with the latest beta.20 panics now with following error:

Error logs

./caddy adapt --config nginx.conf --adapter nginx
panic: assignment to entry in nil map

goroutine 1 [running]:
github.com/caddyserver/caddy/v2/caddyconfig.JSONModuleObject(0x13fabc0, 0x0, 0x15a1eb5, 0x7, 0x15a8319, 0x8, 0xc0007ce228, 0x1, 0x1357120, 0x1)
	github.com/caddyserver/caddy/[email protected]/caddyconfig/configadapters.go:83 +0x441
github.com/caddyserver/nginx-adapter.(*setupState).locationContext(0xc0007cf968, 0xc0006f3110, 0xc0006146e0, 0x1, 0x1, 0xc000193a20, 0x1, 0x2, 0x27, 0x30, ...)
	github.com/caddyserver/[email protected]/location.go:125 +0x3e43
github.com/caddyserver/nginx-adapter.(*setupState).serverContext(0xc0007cf968, 0xc0000e6b40, 0x5, 0x8, 0xc0007cf520, 0x1, 0x1, 0x1, 0x2)
	github.com/caddyserver/[email protected]/server.go:110 +0x1efd
github.com/caddyserver/nginx-adapter.(*setupState).httpContext(0xc0007cf968, 0xc00023cd80, 0xb, 0x10, 0xc0007cf730, 0x1, 0x1, 0x1, 0x127da31)
	github.com/caddyserver/[email protected]/nginxadapter.go:113 +0x4d4
github.com/caddyserver/nginx-adapter.(*setupState).mainContext(0xc0007cf968, 0xc0000e6480, 0x7, 0x8, 0x0, 0x0, 0xc00005e800, 0xc0007cf908, 0x43daec)
	github.com/caddyserver/[email protected]/nginxadapter.go:87 +0x4cb
github.com/caddyserver/nginx-adapter.Adapter.Adapt(0xc0003c8a80, 0x774, 0x974, 0xc0006f29c0, 0xc00062e900, 0x1500000001516640, 0xc0007cfbc8, 0x159c3be7505eb59e, 0x10, 0x1356f20, ...)
	github.com/caddyserver/[email protected]/nginxadapter.go:51 +0x1f6
github.com/caddyserver/caddy/v2/cmd.cmdAdaptConfig(0xc00018c9c0, 0xc0000d0140, 0x4, 0x4)
	github.com/caddyserver/caddy/[email protected]/cmd/commandfuncs.go:464 +0x3ed
github.com/caddyserver/caddy/v2/cmd.Main()
	github.com/caddyserver/caddy/[email protected]/cmd/main.go:84 +0x23e
main.main()
	caddy/main.go:12 +0x20

Steps to reproduce:

go get github.com/caddyserver/builder/cmd/xcaddy

xcaddy build v2.0.0-beta.20 --with github.com/caddyserver/nginx-adapter@0464b93dab75db7fc111ad558d29615832b84f7f

curl https://raw.githubusercontent.com/caddyserver/nginx-adapter/master/testdata/example1.conf -o nginx.conf

./caddy adapt --config nginx.conf --adapter nginx

Edit: Updated the logs

@mholt
Copy link
Member

mholt commented Mar 31, 2020

Your error log is truncated, but I assume it says something about assignment to entry in nil map?

/cc @mohammed90 if you have a sec

@ansrivas
Copy link
Author

Indeed I missed it, updated the complete output.

@mohammed90
Copy link
Member

Thanks for the report, @ansrivas! Can you provide the input? I'm suspecting the value of fastcgi_pass might have something to do with it, but complete input would be ideal.

@ansrivas
Copy link
Author

@mohammed90 thanks for the response. I have included everything in the steps to reproduce, I was just trying to run in it on the test data from the repository itself.

@mholt
Copy link
Member

mholt commented Mar 31, 2020

Ha, to be honest I almost submitted a comment asking for the input too, then I saw the clever curl command...

@mohammed90
Copy link
Member

@ansrivas I believe I got it. Can you try PR #9 please?

@ansrivas
Copy link
Author

ansrivas commented Apr 1, 2020

@mohammed90 I confirm, it works now. Thank you so much.

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.

3 participants