Using FastCGI with Caddy 0.9.4 leads to a invalid memory address or nil pointer dereference in go/src/sync/atomic/asm_*.s on: ARMv6, ARMv7, i686. Everything works on: amd64. Always using Linux.
See https://forum.caddyserver.com/t/panic-with-ssl-fcgi/1168/10?u=22749
$ cd /tmp
$ wget https://www.saddi.com/software/flup/dist/flup-1.0.2.tar.gz
$ tar -xzvf flup-1.0.2.tar.gz
$ cd flup-1.0.2
$ cat > hello.py
def myapp(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/plain')])
return ['Hello World!\n']
if __name__ == '__main__':
from flup.server.fcgi import WSGIServer
WSGIServer(myapp, bindAddress='fcgi.sock').run()
$ cat > Caddyfile
:2016
fastcgi / /tmp/flup-1.0.2/fcgi.sock
$ caddy -log stderr &
$ curl http://localhost:2016
2016/12/22 22:32:34 [PANIC] runtime error: invalid memory address or nil pointer dereference
500 Internal Server Error
Without the fastcgi directive there is no panic. All architectures worked fine with Caddy 0.9.3. All builds came from https://caddyserver.com/download
Aha - while I'm only speculating, I bet this is it (see third bug, about word alignment): https://golang.org/pkg/sync/atomic/#pkg-note-BUG
See https://sourcegraph.com/github.com/mholt/caddy@c972ea39c8b40c28506958bb43d31d2ed357e9f2/-/blob/caddyhttp/fastcgi/dialer.go#L71-72 - I'm guessing this field is not aligned properly. @wendigo - when you have a chance, could you swap that up to the first field in the struct instead of the second? And then see if there are any other fields like that which need to be re-aligned.
Indeed looks like an alignment issue. See https://github.com/golang/go/issues/599
Actually I'll just fix it real quick. @tewe can you build from source to test it? I'm pushing a fix right now.
@mholt 馃憤 it麓s working
@elcore On ARM?
@elcore On ARM?
Yes (ARMv7) 馃槃 -- go test successfully passes now
Thanks for checking.
Works for me on Raspberry Pi 1 (ARMv6)
BTW cross-compiling was amazingly simple
Yeah, Go is awesome like that 馃槑 glad it works for you. Thanks!
Most helpful comment
Works for me on Raspberry Pi 1 (ARMv6)
BTW cross-compiling was amazingly simple