measurexlite: implement robust conn.RemoteAddr access
Closed this issue · 0 comments
bassosimone commented
Sometimes, when using GVisor, we see this kind of QA crashes:
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x113a83a]
goroutine 10346 [running]:
github.com/ooni/probe-cli/v3/internal/measurexlite.(*connTrace).Write(0xc005d2fa28, {0xc00c192000, 0x18, 0x180})
/home/runner/work/probe-cli/probe-cli/internal/measurexlite/conn.go:102 +0x7a
github.com/ooni/oocrypto/tls.(*Conn).write(0xc0022b7c00, {0xc00c192000, 0x18, 0x180})
/home/runner/go/pkg/mod/github.com/ooni/oocrypto@v0.5.8/tls/conn.go:924 +0x1b3
github.com/ooni/oocrypto/tls.(*Conn).writeRecordLocked(0xc0022b7c00, 0x15, {0xc0022b7f44, 0x2, 0x10})
/home/runner/go/pkg/mod/github.com/ooni/oocrypto@v0.5.8/tls/conn.go:992 +0x4df
github.com/ooni/oocrypto/tls.(*Conn).sendAlertLocked(0xc0022b7c00, 0x0)
/home/runner/go/pkg/mod/github.com/ooni/oocrypto@v0.5.8/tls/conn.go:825 +0xc7
github.com/ooni/oocrypto/tls.(*Conn).closeNotify(0xc0022b7c00)
/home/runner/go/pkg/mod/github.com/ooni/oocrypto@v0.5.8/tls/conn.go:1402 +0x156
github.com/ooni/oocrypto/tls.(*Conn).Close(0xc0022b7c00)
/home/runner/go/pkg/mod/github.com/ooni/oocrypto@v0.5.8/tls/conn.go:1371 +0xba
github.com/ooni/oohttp.(*persistConn).closeLocked(0xc00571f8c0, {0x1b57600, 0xc0001df480})
/home/runner/go/pkg/mod/github.com/ooni/oohttp@v0.6.8/transport.go:2734 +0x223
github.com/ooni/oohttp.(*persistConn).close(0xc00571f8c0, {0x1b57600, 0xc0001df480})
/home/runner/go/pkg/mod/github.com/ooni/oohttp@v0.6.8/transport.go:2719 +0xac
github.com/ooni/oohttp.(*persistConn).readLoop.func1()
/home/runner/go/pkg/mod/github.com/ooni/oohttp@v0.6.8/transport.go:2077 +0x50
github.com/ooni/oohttp.(*persistConn).readLoop(0xc00571f8c0)
/home/runner/go/pkg/mod/github.com/ooni/oohttp@v0.6.8/transport.go:2252 +0x105a
created by github.com/ooni/oohttp.(*Transport).dialConn
/home/runner/go/pkg/mod/github.com/ooni/oohttp@v0.6.8/transport.go:1767 +0x25a6
FAIL github.com/ooni/probe-cli/v3/internal/experiment/webconnectivitylte 48.055s
The line of code that fails is https://github.com/ooni/probe-cli/blob/release/3.21/internal/measurexlite/conn.go#L102.
We can avoid them by being more defensive when accessing the RemoteAddr
.