Closed hanwen closed 6 years ago
this is the line:
frag := Fragment{
Pre: string(line[lastEnd:l]),
maybe the indices are out of bound, but that should not generate segv?
unexpected fault address 0x7fa52bc92b69 fatal error: fault [signal SIGSEGV: segmentation violation code=0x1 addr=0x7fa52bc92b69 pc=0x5702ca] goroutine 24375608 [running]: runtime.throw(0x93589e, 0x5) /usr/lib/google-golang/src/runtime/panic.go:622 +0x8a fp=0xc78cf1b1e8 sp=0xc78cf1b1c8 pc=0x54224a runtime.sigpanic() /usr/lib/google-golang/src/runtime/signal_unix.go:395 +0x211 fp=0xc78cf1b238 sp=0xc78cf1b1e8 pc=0x5579d1 runtime.aeshashbody() /usr/lib/google-golang/src/runtime/asm_amd64.s:962 +0x5a fp=0xc78cf1b240 sp=0xc78cf1b238 pc=0x5702ca runtime.mapaccess2_faststr(0x8bddc0, 0xc78cf1b430, 0x7fa52bc92b69, 0x8, 0x1, 0xcabeb28a00) /usr/lib/google-golang/src/runtime/hashmap_fast.go:322 +0x1df fp=0xc78cf1b2b0 sp=0xc78cf1b240 pc=0x521f1f github.com/google/zoekt/web.(Server).formatResults(0xc8c30f4000, 0xcab91ee120, 0xcab8a6f228, 0x8, 0xcab898b200, 0xc /usr/local/google/home/hanwen/go/src/github.com/google/zoekt/web/snippets.go:100 +0xa04 fp=0xc78cf1ba70 sp=0 github.com/google/zoekt/web.(Server).serveSearchErr(0xc8c30f4000, 0x98a2c0, 0xca94640a80, 0xc8289af800, 0x0, 0x0) /usr/local/google/home/hanwen/go/src/github.com/google/zoekt/web/server.go:244 +0x48e fp=0xc78cf1bc68 sp=0xc github.com/google/zoekt/web.(Server).serveSearch(0xc8c30f4000, 0x98a2c0, 0xca94640a80, 0xc8289af800) /usr/local/google/home/hanwen/go/src/github.com/google/zoekt/web/server.go:157 +0x4d fp=0xc78cf1bcc0 sp=0xc7 github.com/google/zoekt/web.(Server).(github.com/google/zoekt/web.serveSearch)-fm(0x98a2c0, 0xca94640a80, 0xc8289af /usr/local/google/home/hanwen/go/src/github.com/google/zoekt/web/server.go:146 +0x48 fp=0xc78cf1bcf0 sp=0xc7 net/http.HandlerFunc.ServeHTTP(0xc8b6c8d0e0, 0x98a2c0, 0xca94640a80, 0xc8289af800) /usr/lib/google-golang/src/net/http/server.go:1946 +0x44 fp=0xc78cf1bd18 sp=0xc78cf1bcf0 pc=0x7c64d4 net/http.(ServeMux).ServeHTTP(0xc894d09890, 0x98a2c0, 0xca94640a80, 0xc8289af800) /usr/lib/google-golang/src/net/http/server.go:2336 +0x130 fp=0xc78cf1bd58 sp=0xc78cf1bd18 pc=0x7c8140 net/http.serverHandler.ServeHTTP(0xc8c30f6000, 0x98a2c0, 0xca94640a80, 0xc8289af800) /usr/lib/google-golang/src/net/http/server.go:2693 +0xbc fp=0xc78cf1bd88 sp=0xc78cf1bd58 pc=0x7c917c net/http.(conn).serve(0xc8a8914500, 0x98a740, 0xca946915c0) /usr/lib/google-golang/src/net/http/server.go:1829 +0x651 fp=0xc78cf1bfc8 sp=0xc78cf1bd88 pc=0x7c54f1 Ma
https://github.com/google/zoekt/blob/ce72fc5eefdbb9ab76d38505e374674b0334700c/web/snippets.go#L100
if dup, ok := seenFiles[string(f.Checksum)]; ok {
fMatch.DuplicateID = dup
version was zoekt-2018-03-02T1238-0897ee3/zoekt-webserver
(gdb) p 'runtime.buildVersion' $1 = 0x9365b5 "go1.10"
probably compiled with
$ dpkg -s google-golang Package: google-golang Status: install ok installed Priority: extra Section: misc Maintainer: gophers@google.com Architecture: amd64 Version: 1.186670733 Description: Go compiler toolchain (Google) Installs the Go compiler and other auxiliary tools such as gofmt and godoc.
source code doesn't use unsafe (anymore).
CheckSum is mmapped directly from the index shard. This data is probably not accessed under lock, so an munmap for reload of shard data will cause trouble.
Idea for test:
https://cs.bazel.build/search?q=register+syncCallback+case%3Ano&num=50
unexpected fault address 0x7fdb75ef1ef1 fatal error: fault [signal SIGSEGV: segmentation violation code=0x1 addr=0x7fdb75ef1ef1 pc=0x571cf6] goroutine 3568545 [running]: runtime.throw(0x93589e, 0x5) /usr/lib/google-golang/src/runtime/panic.go:622 +0x8a fp=0xc530c07228 sp=0xc530c07208 pc=0x54224a runtime.sigpanic() /usr/lib/google-golang/src/runtime/signal_unix.go:395 +0x211 fp=0xc530c07278 sp=0xc530c07228 pc=0x5579d1 runtime.memmove(0xc42083e270, 0x7fdb75ef1ef1, 0xc) /usr/lib/google-golang/src/runtime/memmove_amd64.s:172 +0x136 fp=0xc530c07280 sp=0xc530c07278 pc=0x571cf6 runtime.slicebytetostring(0x0, 0x7fdb75ef1ef1, 0xc, 0x4d10f, 0xc42083e270, 0xc) /usr/lib/google-golang/src/runtime/string.go:98 +0x6f fp=0xc530c072b0 sp=0xc530c07280 pc=0x55c1ef github.com/google/zoekt/web.(Server).formatResults(0xc8ca5a8000, 0xc8a4e8aab0, 0xc71bc56f70, 0xb, 0xc42276ff00, 0xc7d3747200, 0xc8a4e8aab0, 0x0, 0x0, 0 xc707ebeb78) /usr/local/google/home/hanwen/go/src/github.com/google/zoekt/web/snippets.go:127 +0x29c fp=0xc530c07a70 sp=0xc530c072b0 pc=0x8523dc github.com/google/zoekt/web.(Server).serveSearchErr(0xc8ca5a8000, 0x98a2c0, 0xc7d93be380, 0xc5fb950700, 0x0, 0x0) /usr/local/google/home/hanwen/go/src/github.com/google/zoekt/web/server.go:244 +0x48e fp=0xc530c07c68 sp=0xc530c07a70 pc=0x84f8be github.com/google/zoekt/web.(Server).serveSearch(0xc8ca5a8000, 0x98a2c0, 0xc7d93be380, 0xc5fb950700) /usr/local/google/home/hanwen/go/src/github.com/google/zoekt/web/server.go:157 +0x4d fp=0xc530c07cc0 sp=0xc530c07c68 pc=0x84f28d github.com/google/zoekt/web.(Server).(github.com/google/zoekt/web.serveSearch)-fm(0x98a2c0, 0xc7d93be380, 0xc5fb950700) /usr/local/google/home/hanwen/go/src/github.com/google/zoekt/web/server.go:146 +0x48 fp=0xc530c07cf0 sp=0xc530c07cc0 pc=0x8549f8 net/http.HandlerFunc.ServeHTTP(0xc88e6c68e0, 0x98a2c0, 0xc7d93be380, 0xc5fb950700) /usr/lib/google-golang/src/net/http/server.go:1946 +0x44 fp=0xc530c07d18 sp=0xc530c07cf0 pc=0x7c64d4 net/http.(ServeMux).ServeHTTP(0xc88151bd40, 0x98a2c0, 0xc7d93be380, 0xc5fb950700) /usr/lib/google-golang/src/net/http/server.go:2336 +0x130 fp=0xc530c07d58 sp=0xc530c07d18 pc=0x7c8140 net/http.serverHandler.ServeHTTP(0xc88a00d5f0, 0x98a2c0, 0xc7d93be380, 0xc5fb950700) /usr/lib/google-golang/src/net/http/server.go:2693 +0xbc fp=0xc530c07d88 sp=0xc530c07d58 pc=0x7c917c net/http.(conn).serve(0xc5008774a0, 0x98a740, 0xc89b37d080) /usr/lib/google-golang/src/net/http/server.go:1829 +0x651 fp=0xc530c07fc8 sp=0xc530c07d88 pc=0x7c54f1 runtime.goexit() /usr/lib/google-golang/src/runtime/asm_amd64.s:2361 +0x1 fp=0xc530c07fd0 sp=0xc530c07fc8 pc=0x571351 created by net/http.(Server).Serve /usr/lib/google-golang/src/net/http/server.go:2794 +0x27b goroutine 1 [IO wait]: internal/poll.runtime_pollWait(0x7fdf5b1d0e30, 0x72, 0x0) /usr/lib/google-golang/src/runtime/netpoll.go:173 +0x57 internal/poll.(pollDesc).wait(0xc88b4d1a98, 0x72, 0xc420570000, 0x0, 0x0) /usr/lib/google-golang/src/internal/poll/fd_poll_runtime.go:85 +0x9b internal/poll.(*pollDesc).waitRead(0xc88b4d1a98, 0xffffffffffffff00, 0x0, 0x0) /usr/lib/google-golang/src/internal/poll/fd_poll_runtime.go:90 +0x3d