Open someonewithpc opened 2 years ago
I got this on macOS (Monterey), but it worked the second time (starting puma-dev again after the panic) (using latest master, db9ec15c986ec978c2534d628e8694a8e5efc250)
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)
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 withdocker build .
from the Dockerfile below:Running with
This is the full output:
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 inunknown app