refraction-networking / utls

Fork of the Go standard TLS library, providing low-level access to the ClientHello for mimicry purposes.
BSD 3-Clause "New" or "Revised" License
1.57k stars 230 forks source link

panic: tls: setSessionTicketExt failed: invalid state #260

Open let4be opened 7 months ago

let4be commented 7 months ago

I'm doing multiple http requests with uTLS being set on a transport level.

Recently caught this while doing mass requests, unfortunately no context on the exact server that caused this

panic: tls: setSessionTicketExt failed: invalid state

goroutine 1946 [running]:
modules/go-net/utls.uAssert(...)
        /opt/modules/go-net/utls/u_common.go:764
modules/go-net/utls.(*sessionController).setSessionTicketToUConn(0xc001942d80)
        /opt/modules/go-net/utls/u_session_controller.go:188 +0x1fd
modules/go-net/utls.(*UConn).uLoadSession(0xc0004da600)
        /opt/modules/go-net/utls/u_conn.go:163 +0x40b
modules/go-net/utls.(*UConn).BuildHandshakeState(0xc0004da600)
        /opt/modules/go-net/utls/u_conn.go:125 +0x71b
modules/go-net/utls.(*UConn).handshakeContext(0xc0004da600, {0x2440068, 0x40f5b60})
        /opt/modules/go-net/utls/u_conn.go:354 +0x651
modules/go-net/utls.(*UConn).HandshakeContext(...)
        /opt/modules/go-net/utls/u_conn.go:292
modules/go-net/utls.(*UConn).Handshake(...)
        /opt/modules/go-net/utls/u_conn.go:279
proxy_saver/pkg/performer.(*TlsFactoryWithSpec).NewUTLSConn(0xc000c4b6a0, {0x2446cd0, 0xc0001724a0}, 0xc0022349c0)
        /opt/proxy-saver/pkg/performer/utls.go:127 +0x5c5
packages/go-net/http.(*Transport).tlsClientFactory(0xc001e96c60, {0x2446cd0, 0xc0001724a0}, 0x0?)
        /opt/modules/packages/go-net/http/tlsconn.go:41 +0x88
packages/go-net/http.(*persistConn).addTLS(0xc000b65200, {0x2440068?, 0x40f5b60}, {0xc001cf84e0, 0x1c}, 0x0)
        /opt/modules/packages/go-net/http/transport.go:1543 +0x2a5
packages/go-net/http.(*Transport).dialConn(0xc001e96c60, {0x2440068, 0x40f5b60}, {{}, 0x0, {0x1ff07b9, 0x5}, {0xc001cf84e0, 0x20}, 0x0})
        /opt/modules/packages/go-net/http/transport.go:1640 +0x1274
packages/go-net/http.(*Transport).dialConnFor(0x7fa6ccb2c700?, 0xc000316bb0)
        /opt/modules/packages/go-net/http/transport.go:1465 +0x12a
created by packages/go-net/http.(*Transport).queueForDial in goroutine 1944
        /opt/modules/packages/go-net/http/transport.go:1434 +0x16b
let4be commented 7 months ago

Last visited URLs in logs: https://worldofwarcraft.blizzard.com/en-us/ https://www.gstatic.com/

let4be commented 7 months ago

PSK resumption is enabled by setting PSK extension and setting ClientSessionCache via utls.Config

gaukas commented 7 months ago

It would help if you could provide a minimal example to replicate the error.