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

Running in Docker Alpine results in http: panic serving 172.17.0.1:42896: runtime error: invalid memory address or nil pointer dereference #316

Open
someonewithpc opened this issue Aug 10, 2022 · 1 comment

Comments

@someonewithpc
Copy link

When running without a preexisting CA, page loads fail with http: panic serving 172.17.0.1:42896: runtime error: invalid memory address or nil pointer dereference. Running with the .puma-dev-ssl folder mapped into Docker does not result in this error.

This is invoked with docker run -p 80:80 -p 443:443 b0c500dc84dd, where the container is build with docker build . from the Dockerfile below:

FROM ruby:2.6.2-alpine

RUN apk update && apk add --no-cache --virtual build-dependencies build-base git ruby-dev openssl-dev go imagemagick imagemagick-dev mariadb-dev nodejs

ENV RAILS_ROOT /var/www/platform
RUN mkdir -p $RAILS_ROOT

WORKDIR $RAILS_ROOT

# Setting env up
ENV RAILS_ENV='production'
ENV RACK_ENV='production'
ENV PUMA_DEV_VERSION="0.18.2"

# Use a pre-built binary
RUN wget "https://github.com/puma/puma-dev/releases/download/v0.18.2/puma-dev-${PUMA_DEV_VERSION}-linux-amd64.tar.gz" -O /tmp/puma-dev.tar.gz
RUN tar xvfz /tmp/puma-dev.tar.gz --directory /usr/bin/

# Install puma-dev from source
# ENV GOROOT=/usr/lib/go
# ENV GOPATH=/root/go
# RUN go get "github.com/puma/puma-dev/..." 2> /dev/null; :
# ENV GO111MODULE="on"
# RUN cd "${GOPATH}/src/github.com/puma/puma-dev/" && make && make install
# RUN cp "${GOPATH}/src/github.com/puma/puma-dev/puma-dev" /usr/bin/puma-dev

COPY . .

RUN bundle install

RUN apk del build-dependencies

EXPOSE 80 443

ENTRYPOINT /usr/bin/puma-dev -sysbind -timeout 3h -dir $RAILS_ROOT

Running with

This is the full output:

! Add /root/.puma-dev-ssl/cert.pem to your browser to trust CA
* Directory for apps: /var/www/platform
* Domains: test
* HTTP Server port: 80
* HTTPS Server port: 443
! Puma dev listening on http and https
2022/08/10 15:28:37 http: panic serving 172.17.0.1:42896: runtime error: invalid memory address or nil pointer dereference
goroutine 21 [running]:
net/http.(*conn).serve.func1(0xc0000c8b40)
	/usr/lib/go/src/net/http/server.go:1746 +0xd2
panic(0x55cfedc341c0, 0x55cfede94b40)
	/usr/lib/go/src/runtime/panic.go:513 +0x1bd
github.com/puma/puma-dev/dev.makeCert(0x0, 0xc0000b66a0, 0x13, 0x0, 0x0, 0x55cfed856c00)
	/root/go/src/github.com/puma/puma-dev/dev/ssl.go:188 +0x48c
github.com/puma/puma-dev/dev.(*certCache).GetCertificate(0xc0000a8df0, 0xc0001082c0, 0x0, 0x0, 0x0)
	/root/go/src/github.com/puma/puma-dev/dev/ssl.go:144 +0x156
github.com/puma/puma-dev/dev.(*certCache).GetCertificate-fm(0xc0001082c0, 0xc00006ba78, 0x55cfed8574ea, 0xb0)
	/root/go/src/github.com/puma/puma-dev/dev/http_linux.go:12 +0x36
crypto/tls.(*Config).getCertificate(0xc000092c00, 0xc0001082c0, 0x2, 0xc0000c4420, 0x2)
	/usr/lib/go/src/crypto/tls/common.go:726 +0x311
crypto/tls.(*serverHandshakeState).readClientHello(0xc000111c50, 0xc00006bc40, 0x10, 0x8)
	/usr/lib/go/src/crypto/tls/handshake_server.go:217 +0x3be
crypto/tls.(*Conn).serverHandshake(0xc000091880, 0x55cfedc99b38, 0xc0000919a0)
	/usr/lib/go/src/crypto/tls/handshake_server.go:47 +0xb8
crypto/tls.(*Conn).Handshake(0xc000091880, 0x0, 0x0)
	/usr/lib/go/src/crypto/tls/conn.go:1274 +0x179
net/http.(*conn).serve(0xc0000c8b40, 0x55cfedc9ed00, 0xc0000ad590)
	/usr/lib/go/src/net/http/server.go:1762 +0x189
created by net/http.(*Server).Serve
	/usr/lib/go/src/net/http/server.go:2851 +0x2f7
2022/08/10 15:28:37 http: panic serving 172.17.0.1:42908: runtime error: invalid memory address or nil pointer dereference
goroutine 22 [running]:
net/http.(*conn).serve.func1(0xc0000c8be0)
	/usr/lib/go/src/net/http/server.go:1746 +0xd2
panic(0x55cfedc341c0, 0x55cfede94b40)
	/usr/lib/go/src/runtime/panic.go:513 +0x1bd
github.com/puma/puma-dev/dev.makeCert(0x0, 0xc0000b67c0, 0x13, 0x0, 0x0, 0x55cfed856c00)
	/root/go/src/github.com/puma/puma-dev/dev/ssl.go:188 +0x48c
github.com/puma/puma-dev/dev.(*certCache).GetCertificate(0xc0000a8df0, 0xc000108370, 0x0, 0x0, 0x0)
	/root/go/src/github.com/puma/puma-dev/dev/ssl.go:144 +0x156
github.com/puma/puma-dev/dev.(*certCache).GetCertificate-fm(0xc000108370, 0xc00006ba78, 0x55cfed8574ea, 0xb0)
	/root/go/src/github.com/puma/puma-dev/dev/http_linux.go:12 +0x36
crypto/tls.(*Config).getCertificate(0xc000092c00, 0xc000108370, 0x2, 0xc0000c4420, 0x2)
	/usr/lib/go/src/crypto/tls/common.go:726 +0x311
crypto/tls.(*serverHandshakeState).readClientHello(0xc00006bc50, 0xc00006bc40, 0x10, 0x8)
	/usr/lib/go/src/crypto/tls/handshake_server.go:217 +0x3be
crypto/tls.(*Conn).serverHandshake(0xc000091c00, 0x55cfedc99b38, 0xc000091d20)
	/usr/lib/go/src/crypto/tls/handshake_server.go:47 +0xb8
crypto/tls.(*Conn).Handshake(0xc000091c00, 0x0, 0x0)
	/usr/lib/go/src/crypto/tls/conn.go:1274 +0x179
net/http.(*conn).serve(0xc0000c8be0, 0x55cfedc9ed00, 0xc0000ad6b0)
	/usr/lib/go/src/net/http/server.go:1762 +0x189
created by net/http.(*Server).Serve
	/usr/lib/go/src/net/http/server.go:2851 +0x2f7
2022/08/10 15:28:38 http: panic serving 172.17.0.1:42914: runtime error: invalid memory address or nil pointer dereference
goroutine 23 [running]:
net/http.(*conn).serve.func1(0xc0000c8c80)
	/usr/lib/go/src/net/http/server.go:1746 +0xd2
panic(0x55cfedc341c0, 0x55cfede94b40)
	/usr/lib/go/src/runtime/panic.go:513 +0x1bd
github.com/puma/puma-dev/dev.makeCert(0x0, 0xc0000b6860, 0x13, 0x0, 0x0, 0x55cfed856c00)
	/root/go/src/github.com/puma/puma-dev/dev/ssl.go:188 +0x48c
github.com/puma/puma-dev/dev.(*certCache).GetCertificate(0xc0000a8df0, 0xc000108420, 0x0, 0x0, 0x0)
	/root/go/src/github.com/puma/puma-dev/dev/ssl.go:144 +0x156
github.com/puma/puma-dev/dev.(*certCache).GetCertificate-fm(0xc000108420, 0xc00006ba78, 0x55cfed8574ea, 0xb0)
	/root/go/src/github.com/puma/puma-dev/dev/http_linux.go:12 +0x36
crypto/tls.(*Config).getCertificate(0xc000092c00, 0xc000108420, 0x2, 0xc0000c4420, 0x2)
	/usr/lib/go/src/crypto/tls/common.go:726 +0x311
crypto/tls.(*serverHandshakeState).readClientHello(0xc00006bc50, 0xc00006bc40, 0x10, 0x8)
	/usr/lib/go/src/crypto/tls/handshake_server.go:217 +0x3be
crypto/tls.(*Conn).serverHandshake(0xc0003be000, 0x55cfedc99b38, 0xc0003be120)
	/usr/lib/go/src/crypto/tls/handshake_server.go:47 +0xb8
crypto/tls.(*Conn).Handshake(0xc0003be000, 0x0, 0x0)
	/usr/lib/go/src/crypto/tls/conn.go:1274 +0x179
net/http.(*conn).serve(0xc0000c8c80, 0x55cfedc9ed00, 0xc0000ad7a0)
	/usr/lib/go/src/net/http/server.go:1762 +0x189
created by net/http.(*Server).Serve
	/usr/lib/go/src/net/http/server.go:2851 +0x2f7
2022/08/10 15:28:38 http: panic serving 172.17.0.1:42918: runtime error: invalid memory address or nil pointer dereference
goroutine 24 [running]:
net/http.(*conn).serve.func1(0xc0000c8d20)
	/usr/lib/go/src/net/http/server.go:1746 +0xd2
panic(0x55cfedc341c0, 0x55cfede94b40)
	/usr/lib/go/src/runtime/panic.go:513 +0x1bd
github.com/puma/puma-dev/dev.makeCert(0x0, 0xc0000b68e0, 0x13, 0x0, 0x0, 0x55cfed856c00)
	/root/go/src/github.com/puma/puma-dev/dev/ssl.go:188 +0x48c
github.com/puma/puma-dev/dev.(*certCache).GetCertificate(0xc0000a8df0, 0xc0001084d0, 0x0, 0x0, 0x0)
	/root/go/src/github.com/puma/puma-dev/dev/ssl.go:144 +0x156
github.com/puma/puma-dev/dev.(*certCache).GetCertificate-fm(0xc0001084d0, 0xc00006ba78, 0x55cfed8574ea, 0xb0)
	/root/go/src/github.com/puma/puma-dev/dev/http_linux.go:12 +0x36
crypto/tls.(*Config).getCertificate(0xc000092c00, 0xc0001084d0, 0x2, 0xc0000c4420, 0x2)
	/usr/lib/go/src/crypto/tls/common.go:726 +0x311
crypto/tls.(*serverHandshakeState).readClientHello(0xc00006bc50, 0xc00006bc40, 0x10, 0x8)
	/usr/lib/go/src/crypto/tls/handshake_server.go:217 +0x3be
crypto/tls.(*Conn).serverHandshake(0xc0003be380, 0x55cfedc99b38, 0xc0003be4a0)
	/usr/lib/go/src/crypto/tls/handshake_server.go:47 +0xb8
crypto/tls.(*Conn).Handshake(0xc0003be380, 0x0, 0x0)
	/usr/lib/go/src/crypto/tls/conn.go:1274 +0x179
net/http.(*conn).serve(0xc0000c8d20, 0x55cfedc9ed00, 0xc0000ad890)
	/usr/lib/go/src/net/http/server.go:1762 +0x189
created by net/http.(*Server).Serve
	/usr/lib/go/src/net/http/server.go:2851 +0x2f7
2022/08/10 15:28:38 http: panic serving 172.17.0.1:42932: runtime error: invalid memory address or nil pointer dereference
goroutine 25 [running]:
net/http.(*conn).serve.func1(0xc0000c8dc0)
	/usr/lib/go/src/net/http/server.go:1746 +0xd2
panic(0x55cfedc341c0, 0x55cfede94b40)
	/usr/lib/go/src/runtime/panic.go:513 +0x1bd
github.com/puma/puma-dev/dev.makeCert(0x0, 0xc0000b6980, 0x13, 0x0, 0x0, 0x55cfed856c00)
	/root/go/src/github.com/puma/puma-dev/dev/ssl.go:188 +0x48c
github.com/puma/puma-dev/dev.(*certCache).GetCertificate(0xc0000a8df0, 0xc000108580, 0x0, 0x0, 0x0)
	/root/go/src/github.com/puma/puma-dev/dev/ssl.go:144 +0x156
github.com/puma/puma-dev/dev.(*certCache).GetCertificate-fm(0xc000108580, 0xc00006ba78, 0x55cfed8574ea, 0xb0)
	/root/go/src/github.com/puma/puma-dev/dev/http_linux.go:12 +0x36
crypto/tls.(*Config).getCertificate(0xc000092c00, 0xc000108580, 0x2, 0xc0000c4420, 0x2)
	/usr/lib/go/src/crypto/tls/common.go:726 +0x311
crypto/tls.(*serverHandshakeState).readClientHello(0xc00006bc50, 0xc00006bc40, 0x10, 0x8)
	/usr/lib/go/src/crypto/tls/handshake_server.go:217 +0x3be
crypto/tls.(*Conn).serverHandshake(0xc0003be700, 0x55cfedc99b38, 0xc0003be820)
	/usr/lib/go/src/crypto/tls/handshake_server.go:47 +0xb8
crypto/tls.(*Conn).Handshake(0xc0003be700, 0x0, 0x0)
	/usr/lib/go/src/crypto/tls/conn.go:1274 +0x179
net/http.(*conn).serve(0xc0000c8dc0, 0x55cfedc9ed00, 0xc0000ad980)
	/usr/lib/go/src/net/http/server.go:1762 +0x189
created by net/http.(*Server).Serve
	/usr/lib/go/src/net/http/server.go:2851 +0x2f7
2022/08/10 15:28:38 http: panic serving 172.17.0.1:42946: runtime error: invalid memory address or nil pointer dereference
goroutine 26 [running]:
net/http.(*conn).serve.func1(0xc0000c8e60)
	/usr/lib/go/src/net/http/server.go:1746 +0xd2
panic(0x55cfedc341c0, 0x55cfede94b40)
	/usr/lib/go/src/runtime/panic.go:513 +0x1bd
github.com/puma/puma-dev/dev.makeCert(0x0, 0xc0000243c0, 0x13, 0x0, 0x0, 0x55cfed856c00)
	/root/go/src/github.com/puma/puma-dev/dev/ssl.go:188 +0x48c
github.com/puma/puma-dev/dev.(*certCache).GetCertificate(0xc0000a8df0, 0xc0003f6000, 0x0, 0x0, 0x0)
	/root/go/src/github.com/puma/puma-dev/dev/ssl.go:144 +0x156
github.com/puma/puma-dev/dev.(*certCache).GetCertificate-fm(0xc0003f6000, 0xc00006fa78, 0x55cfed8574ea, 0xb0)
	/root/go/src/github.com/puma/puma-dev/dev/http_linux.go:12 +0x36
crypto/tls.(*Config).getCertificate(0xc000092c00, 0xc0003f6000, 0x2, 0xc0000c4420, 0x2)
	/usr/lib/go/src/crypto/tls/common.go:726 +0x311
crypto/tls.(*serverHandshakeState).readClientHello(0xc00006fc50, 0xc00006fc40, 0x10, 0x8)
	/usr/lib/go/src/crypto/tls/handshake_server.go:217 +0x3be
crypto/tls.(*Conn).serverHandshake(0xc0003bea80, 0x55cfedc99b38, 0xc0003beba0)
	/usr/lib/go/src/crypto/tls/handshake_server.go:47 +0xb8
crypto/tls.(*Conn).Handshake(0xc0003bea80, 0x0, 0x0)
	/usr/lib/go/src/crypto/tls/conn.go:1274 +0x179
net/http.(*conn).serve(0xc0000c8e60, 0x55cfedc9ed00, 0xc00014f200)
	/usr/lib/go/src/net/http/server.go:1762 +0x189
created by net/http.(*Server).Serve
	/usr/lib/go/src/net/http/server.go:2851 +0x2f7
2022/08/10 15:28:43 http: panic serving 172.17.0.1:32960: runtime error: invalid memory address or nil pointer dereference
goroutine 7 [running]:
net/http.(*conn).serve.func1(0xc00035c140)
	/usr/lib/go/src/net/http/server.go:1746 +0xd2
panic(0x55cfedc341c0, 0x55cfede94b40)
	/usr/lib/go/src/runtime/panic.go:513 +0x1bd
github.com/puma/puma-dev/dev.makeCert(0x0, 0xc000024460, 0x13, 0x0, 0x0, 0x55cfed856c00)
	/root/go/src/github.com/puma/puma-dev/dev/ssl.go:188 +0x48c
github.com/puma/puma-dev/dev.(*certCache).GetCertificate(0xc0000a8df0, 0xc0003f60b0, 0x0, 0x0, 0x0)
	/root/go/src/github.com/puma/puma-dev/dev/ssl.go:144 +0x156
github.com/puma/puma-dev/dev.(*certCache).GetCertificate-fm(0xc0003f60b0, 0xc00006fa78, 0x55cfed8574ea, 0xb0)
	/root/go/src/github.com/puma/puma-dev/dev/http_linux.go:12 +0x36
crypto/tls.(*Config).getCertificate(0xc000092c00, 0xc0003f60b0, 0x2, 0xc0000c4420, 0x2)
	/usr/lib/go/src/crypto/tls/common.go:726 +0x311
crypto/tls.(*serverHandshakeState).readClientHello(0xc00006fc50, 0xc00006fc40, 0x10, 0x8)
	/usr/lib/go/src/crypto/tls/handshake_server.go:217 +0x3be
crypto/tls.(*Conn).serverHandshake(0xc000061180, 0x55cfedc99b38, 0xc0000612a0)
	/usr/lib/go/src/crypto/tls/handshake_server.go:47 +0xb8
crypto/tls.(*Conn).Handshake(0xc000061180, 0x0, 0x0)
	/usr/lib/go/src/crypto/tls/conn.go:1274 +0x179
net/http.(*conn).serve(0xc00035c140, 0x55cfedc9ed00, 0xc00014f320)
	/usr/lib/go/src/net/http/server.go:1762 +0x189
created by net/http.(*Server).Serve
	/usr/lib/go/src/net/http/server.go:2851 +0x2f7
2022/08/10 15:28:43 http: panic serving 172.17.0.1:32964: runtime error: invalid memory address or nil pointer dereference
goroutine 8 [running]:
net/http.(*conn).serve.func1(0xc00035c1e0)
	/usr/lib/go/src/net/http/server.go:1746 +0xd2
panic(0x55cfedc341c0, 0x55cfede94b40)
	/usr/lib/go/src/runtime/panic.go:513 +0x1bd
github.com/puma/puma-dev/dev.makeCert(0x0, 0xc0000244e0, 0x13, 0x0, 0x0, 0x55cfed856c00)
	/root/go/src/github.com/puma/puma-dev/dev/ssl.go:188 +0x48c
github.com/puma/puma-dev/dev.(*certCache).GetCertificate(0xc0000a8df0, 0xc0003f6160, 0x0, 0x0, 0x0)
	/root/go/src/github.com/puma/puma-dev/dev/ssl.go:144 +0x156
github.com/puma/puma-dev/dev.(*certCache).GetCertificate-fm(0xc0003f6160, 0xc00006fa78, 0x55cfed8574ea, 0xb0)
	/root/go/src/github.com/puma/puma-dev/dev/http_linux.go:12 +0x36
crypto/tls.(*Config).getCertificate(0xc000092c00, 0xc0003f6160, 0x2, 0xc0000c4420, 0x2)
	/usr/lib/go/src/crypto/tls/common.go:726 +0x311
crypto/tls.(*serverHandshakeState).readClientHello(0xc00006fc50, 0xc00006fc40, 0x10, 0x8)
	/usr/lib/go/src/crypto/tls/handshake_server.go:217 +0x3be
crypto/tls.(*Conn).serverHandshake(0xc000061500, 0x55cfedc99b38, 0xc000061620)
	/usr/lib/go/src/crypto/tls/handshake_server.go:47 +0xb8
crypto/tls.(*Conn).Handshake(0xc000061500, 0x0, 0x0)
	/usr/lib/go/src/crypto/tls/conn.go:1274 +0x179
net/http.(*conn).serve(0xc00035c1e0, 0x55cfedc9ed00, 0xc00014f410)
	/usr/lib/go/src/net/http/server.go:1762 +0x189
created by net/http.(*Server).Serve
	/usr/lib/go/src/net/http/server.go:2851 +0x2f7
2022/08/10 15:28:43 http: panic serving 172.17.0.1:32972: runtime error: invalid memory address or nil pointer dereference
goroutine 9 [running]:
net/http.(*conn).serve.func1(0xc00035c280)
	/usr/lib/go/src/net/http/server.go:1746 +0xd2
panic(0x55cfedc341c0, 0x55cfede94b40)
	/usr/lib/go/src/runtime/panic.go:513 +0x1bd
github.com/puma/puma-dev/dev.makeCert(0x0, 0xc000448020, 0x13, 0x0, 0x0, 0x55cfed856c00)
	/root/go/src/github.com/puma/puma-dev/dev/ssl.go:188 +0x48c
github.com/puma/puma-dev/dev.(*certCache).GetCertificate(0xc0000a8df0, 0xc000450000, 0x0, 0x0, 0x0)
	/root/go/src/github.com/puma/puma-dev/dev/ssl.go:144 +0x156
github.com/puma/puma-dev/dev.(*certCache).GetCertificate-fm(0xc000450000, 0xc000438a78, 0x55cfed8574ea, 0xb0)
	/root/go/src/github.com/puma/puma-dev/dev/http_linux.go:12 +0x36
crypto/tls.(*Config).getCertificate(0xc000092c00, 0xc000450000, 0x2, 0xc0000c4420, 0x2)
	/usr/lib/go/src/crypto/tls/common.go:726 +0x311
crypto/tls.(*serverHandshakeState).readClientHello(0xc00010bc50, 0xc000438c40, 0x10, 0x8)
	/usr/lib/go/src/crypto/tls/handshake_server.go:217 +0x3be
crypto/tls.(*Conn).serverHandshake(0xc000061880, 0x55cfedc99b38, 0xc0000619a0)
	/usr/lib/go/src/crypto/tls/handshake_server.go:47 +0xb8
crypto/tls.(*Conn).Handshake(0xc000061880, 0x0, 0x0)
	/usr/lib/go/src/crypto/tls/conn.go:1274 +0x179
net/http.(*conn).serve(0xc00035c280, 0x55cfedc9ed00, 0xc00043e000)
	/usr/lib/go/src/net/http/server.go:1762 +0x189
created by net/http.(*Server).Serve
	/usr/lib/go/src/net/http/server.go:2851 +0x2f7
2022/08/10 15:28:43 http: panic serving 172.17.0.1:32978: runtime error: invalid memory address or nil pointer dereference
goroutine 15 [running]:
net/http.(*conn).serve.func1(0xc0000c83c0)
	/usr/lib/go/src/net/http/server.go:1746 +0xd2
panic(0x55cfedc341c0, 0x55cfede94b40)
	/usr/lib/go/src/runtime/panic.go:513 +0x1bd
github.com/puma/puma-dev/dev.makeCert(0x0, 0xc000448080, 0x13, 0x0, 0x0, 0x55cfed856c00)
	/root/go/src/github.com/puma/puma-dev/dev/ssl.go:188 +0x48c
github.com/puma/puma-dev/dev.(*certCache).GetCertificate(0xc0000a8df0, 0xc0001082c0, 0x0, 0x0, 0x0)
	/root/go/src/github.com/puma/puma-dev/dev/ssl.go:144 +0x156
github.com/puma/puma-dev/dev.(*certCache).GetCertificate-fm(0xc0001082c0, 0xc000071a78, 0x55cfed8574ea, 0xb0)
	/root/go/src/github.com/puma/puma-dev/dev/http_linux.go:12 +0x36
crypto/tls.(*Config).getCertificate(0xc000092c00, 0xc0001082c0, 0x2, 0xc0000c4420, 0x2)
	/usr/lib/go/src/crypto/tls/common.go:726 +0x311
crypto/tls.(*serverHandshakeState).readClientHello(0xc00010dc50, 0xc000071c40, 0x10, 0x8)
	/usr/lib/go/src/crypto/tls/handshake_server.go:217 +0x3be
crypto/tls.(*Conn).serverHandshake(0xc0003be000, 0x55cfedc99b38, 0xc0003be120)
	/usr/lib/go/src/crypto/tls/handshake_server.go:47 +0xb8
crypto/tls.(*Conn).Handshake(0xc0003be000, 0x0, 0x0)
	/usr/lib/go/src/crypto/tls/conn.go:1274 +0x179
net/http.(*conn).serve(0xc0000c83c0, 0x55cfedc9ed00, 0xc00043e0f0)
	/usr/lib/go/src/net/http/server.go:1762 +0x189
created by net/http.(*Server).Serve
	/usr/lib/go/src/net/http/server.go:2851 +0x2f7

BTW, as previously mentioned, running with an existing CA, with docker run -p 80:80 -p 443:443 -v "${HOME}/.puma-dev-ssl:/root/.puma-dev-ssl" b0c500dc84d doesn't produce this error, but results in unknown app

@dentarg
Copy link
Member

dentarg commented Sep 26, 2023

I got this on macOS (Monterey), but it worked the second time (starting puma-dev again after the panic) (using latest master, db9ec15)

arm64 $ ./puma-dev -debug
* Adding certification to login keychain as trusted
! There is probably a dialog open that requires you to authenticate
* Certificates setup, ready for https operations!
* Directory for apps: /Users/dentarg/.puma-dev
* Domains: test
* DNS Server port: 9253
* HTTP Server port: 9280
* HTTPS Server port: 9283
! Puma dev running...
2023/09/26 20:26:53 http: panic serving 127.0.0.1:58189: runtime error: invalid memory address or nil pointer dereference
goroutine 40 [running]:
net/http.(*conn).serve.func1()
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/net/http/server.go:1868 +0xb0
panic({0x1006dda00?, 0x1009450c0?})
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/runtime/panic.go:920 +0x26c
github.com/puma/puma-dev/dev.makeCert(0x0, {0x14000010210, 0xa})
	/Users/dentarg/src/puma-dev/dev/ssl.go:188 +0x3f8
github.com/puma/puma-dev/dev.(*certCache).GetCertificate(0x1400019a020, 0x10072b860?)
	/Users/dentarg/src/puma-dev/dev/ssl.go:144 +0x144
crypto/tls.(*Config).getCertificate(0x140001829c0, 0x140001a2340)
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/common.go:1116 +0x44
crypto/tls.(*serverHandshakeStateTLS13).pickCertificate(0x140001f37c0)
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/handshake_server_tls13.go:435 +0x2ac
crypto/tls.(*serverHandshakeStateTLS13).handshake(0x140001f37c0)
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/handshake_server_tls13.go:59 +0x40
crypto/tls.(*Conn).serverHandshake(0x140001b4000, {0x100746868, 0x1400012a870})
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/handshake_server.go:53 +0x130
crypto/tls.(*Conn).handshakeContext(0x140001b4000, {0x100746830, 0x1400055e600})
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/conn.go:1552 +0x340
crypto/tls.(*Conn).HandshakeContext(...)
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/conn.go:1492
net/http.(*conn).serve(0x14000090120, {0x100746830, 0x140001a1290})
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/net/http/server.go:1891 +0xb24
created by net/http.(*Server).Serve in goroutine 39
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/net/http/server.go:3086 +0x4cc
2023/09/26 20:26:53 http: panic serving 127.0.0.1:58190: runtime error: invalid memory address or nil pointer dereference
goroutine 41 [running]:
net/http.(*conn).serve.func1()
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/net/http/server.go:1868 +0xb0
panic({0x1006dda00?, 0x1009450c0?})
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/runtime/panic.go:920 +0x26c
github.com/puma/puma-dev/dev.makeCert(0x0, {0x140000103b0, 0xa})
	/Users/dentarg/src/puma-dev/dev/ssl.go:188 +0x3f8
github.com/puma/puma-dev/dev.(*certCache).GetCertificate(0x1400019a020, 0x10072b860?)
	/Users/dentarg/src/puma-dev/dev/ssl.go:144 +0x144
crypto/tls.(*Config).getCertificate(0x140001829c0, 0x140001a24e0)
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/common.go:1116 +0x44
crypto/tls.(*serverHandshakeStateTLS13).pickCertificate(0x140001f37c0)
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/handshake_server_tls13.go:435 +0x2ac
crypto/tls.(*serverHandshakeStateTLS13).handshake(0x140001f37c0)
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/handshake_server_tls13.go:59 +0x40
crypto/tls.(*Conn).serverHandshake(0x140001b5180, {0x100746868, 0x1400012a960})
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/handshake_server.go:53 +0x130
crypto/tls.(*Conn).handshakeContext(0x140001b5180, {0x100746830, 0x1400055e720})
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/conn.go:1552 +0x340
crypto/tls.(*Conn).HandshakeContext(...)
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/conn.go:1492
net/http.(*conn).serve(0x140000901b0, {0x100746830, 0x140001a1290})
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/net/http/server.go:1891 +0xb24
created by net/http.(*Server).Serve in goroutine 39
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/net/http/server.go:3086 +0x4cc
2023/09/26 20:26:54 http: panic serving 127.0.0.1:58191: runtime error: invalid memory address or nil pointer dereference
goroutine 42 [running]:
net/http.(*conn).serve.func1()
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/net/http/server.go:1868 +0xb0
panic({0x1006dda00?, 0x1009450c0?})
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/runtime/panic.go:920 +0x26c
github.com/puma/puma-dev/dev.makeCert(0x0, {0x14000010450, 0xa})
	/Users/dentarg/src/puma-dev/dev/ssl.go:188 +0x3f8
github.com/puma/puma-dev/dev.(*certCache).GetCertificate(0x1400019a020, 0x10072b860?)
	/Users/dentarg/src/puma-dev/dev/ssl.go:144 +0x144
crypto/tls.(*Config).getCertificate(0x140001829c0, 0x140001a2a90)
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/common.go:1116 +0x44
crypto/tls.(*serverHandshakeStateTLS13).pickCertificate(0x140001f37c0)
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/handshake_server_tls13.go:435 +0x2ac
crypto/tls.(*serverHandshakeStateTLS13).handshake(0x140001f37c0)
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/handshake_server_tls13.go:59 +0x40
crypto/tls.(*Conn).serverHandshake(0x140001b5500, {0x100746868, 0x1400012aa00})
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/handshake_server.go:53 +0x130
crypto/tls.(*Conn).handshakeContext(0x140001b5500, {0x100746830, 0x1400055e840})
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/conn.go:1552 +0x340
crypto/tls.(*Conn).HandshakeContext(...)
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/conn.go:1492
net/http.(*conn).serve(0x14000090240, {0x100746830, 0x140001a1290})
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/net/http/server.go:1891 +0xb24
created by net/http.(*Server).Serve in goroutine 39
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/net/http/server.go:3086 +0x4cc
2023/09/26 20:26:54 http: panic serving 127.0.0.1:58192: runtime error: invalid memory address or nil pointer dereference
goroutine 43 [running]:
net/http.(*conn).serve.func1()
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/net/http/server.go:1868 +0xb0
panic({0x1006dda00?, 0x1009450c0?})
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/runtime/panic.go:920 +0x26c
github.com/puma/puma-dev/dev.makeCert(0x0, {0x14000010500, 0xa})
	/Users/dentarg/src/puma-dev/dev/ssl.go:188 +0x3f8
github.com/puma/puma-dev/dev.(*certCache).GetCertificate(0x1400019a020, 0x10072b860?)
	/Users/dentarg/src/puma-dev/dev/ssl.go:144 +0x144
crypto/tls.(*Config).getCertificate(0x140001829c0, 0x140001a2dd0)
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/common.go:1116 +0x44
crypto/tls.(*serverHandshakeStateTLS13).pickCertificate(0x140001f37c0)
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/handshake_server_tls13.go:435 +0x2ac
crypto/tls.(*serverHandshakeStateTLS13).handshake(0x140001f37c0)
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/handshake_server_tls13.go:59 +0x40
crypto/tls.(*Conn).serverHandshake(0x140001b5880, {0x100746868, 0x1400012aaa0})
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/handshake_server.go:53 +0x130
crypto/tls.(*Conn).handshakeContext(0x140001b5880, {0x100746830, 0x1400055e960})
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/conn.go:1552 +0x340
crypto/tls.(*Conn).HandshakeContext(...)
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/conn.go:1492
net/http.(*conn).serve(0x140000902d0, {0x100746830, 0x140001a1290})
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/net/http/server.go:1891 +0xb24
created by net/http.(*Server).Serve in goroutine 39
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/net/http/server.go:3086 +0x4cc
2023/09/26 20:26:59 http: panic serving 127.0.0.1:58194: runtime error: invalid memory address or nil pointer dereference
goroutine 44 [running]:
net/http.(*conn).serve.func1()
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/net/http/server.go:1868 +0xb0
panic({0x1006dda00?, 0x1009450c0?})
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/runtime/panic.go:920 +0x26c
github.com/puma/puma-dev/dev.makeCert(0x0, {0x14000010170, 0xa})
	/Users/dentarg/src/puma-dev/dev/ssl.go:188 +0x3f8
github.com/puma/puma-dev/dev.(*certCache).GetCertificate(0x1400019a020, 0x10072b860?)
	/Users/dentarg/src/puma-dev/dev/ssl.go:144 +0x144
crypto/tls.(*Config).getCertificate(0x140001829c0, 0x140001a2340)
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/common.go:1116 +0x44
crypto/tls.(*serverHandshakeStateTLS13).pickCertificate(0x140001f37c0)
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/handshake_server_tls13.go:435 +0x2ac
crypto/tls.(*serverHandshakeStateTLS13).handshake(0x140001f37c0)
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/handshake_server_tls13.go:59 +0x40
crypto/tls.(*Conn).serverHandshake(0x140001b4000, {0x100746868, 0x1400012a0a0})
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/handshake_server.go:53 +0x130
crypto/tls.(*Conn).handshakeContext(0x140001b4000, {0x100746830, 0x1400055e150})
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/conn.go:1552 +0x340
crypto/tls.(*Conn).HandshakeContext(...)
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/conn.go:1492
net/http.(*conn).serve(0x140001ec120, {0x100746830, 0x140001a1290})
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/net/http/server.go:1891 +0xb24
created by net/http.(*Server).Serve in goroutine 39
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/net/http/server.go:3086 +0x4cc
2023/09/26 20:26:59 http: panic serving 127.0.0.1:58195: runtime error: invalid memory address or nil pointer dereference
goroutine 45 [running]:
net/http.(*conn).serve.func1()
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/net/http/server.go:1868 +0xb0
panic({0x1006dda00?, 0x1009450c0?})
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/runtime/panic.go:920 +0x26c
github.com/puma/puma-dev/dev.makeCert(0x0, {0x140000b0080, 0xa})
	/Users/dentarg/src/puma-dev/dev/ssl.go:188 +0x3f8
github.com/puma/puma-dev/dev.(*certCache).GetCertificate(0x1400019a020, 0x10072b860?)
	/Users/dentarg/src/puma-dev/dev/ssl.go:144 +0x144
crypto/tls.(*Config).getCertificate(0x140001829c0, 0x140000a0000)
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/common.go:1116 +0x44
crypto/tls.(*serverHandshakeStateTLS13).pickCertificate(0x140001f37c0)
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/handshake_server_tls13.go:435 +0x2ac
crypto/tls.(*serverHandshakeStateTLS13).handshake(0x140001f37c0)
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/handshake_server_tls13.go:59 +0x40
crypto/tls.(*Conn).serverHandshake(0x140001b5180, {0x100746868, 0x1400012a140})
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/handshake_server.go:53 +0x130
crypto/tls.(*Conn).handshakeContext(0x140001b5180, {0x100746830, 0x1400055e270})
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/conn.go:1552 +0x340
crypto/tls.(*Conn).HandshakeContext(...)
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/crypto/tls/conn.go:1492
net/http.(*conn).serve(0x140001ec1b0, {0x100746830, 0x140001a1290})
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/net/http/server.go:1891 +0xb24
created by net/http.(*Server).Serve in goroutine 39
	/opt/homebrew/Cellar/go/1.21.1/libexec/src/net/http/server.go:3086 +0x4cc
^C! Shutdown requested
~/src/puma-dev
arm64 $ ./puma-dev -debug
2023/09/26 20:27:27 Existing valid puma-dev CA keypair found. Assuming previously trusted.
* Directory for apps: /Users/dentarg/.puma-dev
* Domains: test
* DNS Server port: 9253
* HTTP Server port: 9280
* HTTPS Server port: 9283
! Puma dev running...
2023-09-26T20:27:58.000692+02:00: GET '/' (host=swiss.test:9283)
* Generated proxy connection for 'swiss' to http://127.0.0.1:5000
2023-09-26T20:27:58.079498+02:00: GET '/favicon.ico' (host=swiss.test:9283)

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

No branches or pull requests

2 participants