Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

"fatal error: concurrent map writes" panic #52

Open
1ma opened this issue Mar 19, 2023 · 1 comment
Open

"fatal error: concurrent map writes" panic #52

1ma opened this issue Mar 19, 2023 · 1 comment

Comments

@1ma
Copy link

1ma commented Mar 19, 2023

On [email protected]. Similar to #21, it happened using noscl publish. It managed to publish the note, though.

fatal error: concurrent map writes

goroutine 32 [running]:
github.com/fiatjaf/go-nostr.(*RelayPool).Sub(0xc000017050, {0xc00027c960, 0x1, 0x1})
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:199 +0x36f
github.com/fiatjaf/go-nostr.(*RelayPool).PublishEvent.func1({0xc0003d3420, 0x1c}, 0x0?)
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:240 +0x28f
created by github.com/fiatjaf/go-nostr.(*RelayPool).PublishEvent
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:232 +0x3fa

goroutine 1 [runnable]:
main.printPublishStatus(0xc0001ce680, 0xc0001ce680?)
	/home/user/go/pkg/mod/github.com/1ma/[email protected]/printer.go:81 +0x56
main.publish(0x6e6a40?)
	/home/user/go/pkg/mod/github.com/1ma/[email protected]/publish.go:61 +0x649
main.main()
	/home/user/go/pkg/mod/github.com/1ma/[email protected]/main.go:86 +0x465

goroutine 40 [IO wait]:
internal/poll.runtime_pollWait(0x7f4acddedf98, 0x72)
	/usr/local/go/src/runtime/netpoll.go:306 +0x89
internal/poll.(*pollDesc).wait(0xc0001ce000?, 0xc0001e4000?, 0x0)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0x32
internal/poll.(*pollDesc).waitRead(...)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Read(0xc0001ce000, {0xc0001e4000, 0x1300, 0x1300})
	/usr/local/go/src/internal/poll/fd_unix.go:167 +0x299
net.(*netFD).Read(0xc0001ce000, {0xc0001e4000?, 0x7?, 0x19b?})
	/usr/local/go/src/net/fd_posix.go:55 +0x29
net.(*conn).Read(0xc0000a0d48, {0xc0001e4000?, 0xc00004d720?, 0xc00004d708?})
	/usr/local/go/src/net/net.go:183 +0x45
crypto/tls.(*atLeastReader).Read(0xc000012b58, {0xc0001e4000?, 0xc000012b58?, 0x0?})
	/usr/local/go/src/crypto/tls/conn.go:788 +0x3d
bytes.(*Buffer).ReadFrom(0xc0000cb790, {0x8cc840, 0xc000012b58})
	/usr/local/go/src/bytes/buffer.go:202 +0x98
crypto/tls.(*Conn).readFromUntil(0xc0000cb500, {0x8ccc40?, 0xc0000a0d48}, 0x1a0?)
	/usr/local/go/src/crypto/tls/conn.go:810 +0xe5
crypto/tls.(*Conn).readRecordOrCCS(0xc0000cb500, 0x0)
	/usr/local/go/src/crypto/tls/conn.go:617 +0x116
crypto/tls.(*Conn).readRecord(...)
	/usr/local/go/src/crypto/tls/conn.go:583
crypto/tls.(*Conn).Read(0xc0000cb500, {0xc000128000, 0x1000, 0x0?})
	/usr/local/go/src/crypto/tls/conn.go:1316 +0x16f
bufio.(*Reader).fill(0xc0000a33e0)
	/usr/local/go/src/bufio/bufio.go:106 +0xff
bufio.(*Reader).Peek(0xc0000a33e0, 0x2)
	/usr/local/go/src/bufio/bufio.go:144 +0x5d
github.com/gorilla/websocket.(*Conn).read(0xc000306160, 0x0?)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:370 +0x2c
github.com/gorilla/websocket.(*Conn).advanceFrame(0xc000306160)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:798 +0x7b
github.com/gorilla/websocket.(*Conn).NextReader(0xc000306160)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:980 +0xcc
github.com/gorilla/websocket.(*Conn).ReadMessage(0x0?)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:1064 +0x19
github.com/fiatjaf/go-nostr.(*RelayPool).Add.func1()
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:99 +0x6b
created by github.com/fiatjaf/go-nostr.(*RelayPool).Add
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:97 +0x445

goroutine 29 [runnable]:
encoding/json.sliceEncoder.encode({0x4b4ba0?}, 0xc0001ce880, {0x6b10c0?, 0xc000012ee8?, 0x6b10c0?}, {0x0?, 0x23?})
	/usr/local/go/src/encoding/json/encode.go:887 +0x32f
encoding/json.(*encodeState).reflectValue(0xc00020f8e8?, {0x6b10c0?, 0xc000012ee8?, 0xc0001d2048?}, {0x80?, 0xde?})
	/usr/local/go/src/encoding/json/encode.go:358 +0x78
encoding/json.(*encodeState).marshal(0x6ed020?, {0x6b10c0?, 0xc000012ee8?}, {0xb8?, 0xc5?})
	/usr/local/go/src/encoding/json/encode.go:330 +0xfa
encoding/json.(*Encoder).Encode(0xc00020fa10, {0x6b10c0, 0xc000012ee8})
	/usr/local/go/src/encoding/json/stream.go:209 +0xf3
github.com/gorilla/websocket.(*Conn).WriteJSON(0xc0001cb0d8?, {0x6b10c0, 0xc000012ee8})
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/json.go:28 +0xc5
github.com/fiatjaf/go-nostr.(*Connection).WriteJSON(0xc0000ced40?, {0x6b10c0?, 0xc000012ee8?})
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/connection.go:22 +0xb0
github.com/fiatjaf/go-nostr.Subscription.Sub({{0xc0001da270, 0xe}, 0xc000017b60, {0xc0003500c0, 0x1, 0x1}, 0xc000285020, 0x0, 0xc000285080, 0x0})
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/subscription.go:48 +0x8b
github.com/fiatjaf/go-nostr.(*RelayPool).Sub(0xc000017050, {0xc0003500c0, 0x1, 0x1})
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:201 +0x3b8
github.com/fiatjaf/go-nostr.(*RelayPool).PublishEvent.func1({0xc000294168, 0x16}, 0x5?)
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:240 +0x28f
created by github.com/fiatjaf/go-nostr.(*RelayPool).PublishEvent
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:232 +0x3fa

goroutine 28 [runnable]:
github.com/fiatjaf/go-nostr.(*RelayPool).PublishEvent.func2()
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:232
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:1598 +0x1
created by github.com/fiatjaf/go-nostr.(*RelayPool).PublishEvent
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:232 +0x3fa

goroutine 46 [IO wait]:
internal/poll.runtime_pollWait(0x7f4acddeddb8, 0x72)
	/usr/local/go/src/runtime/netpoll.go:306 +0x89
internal/poll.(*pollDesc).wait(0xc0001ce400?, 0xc00021e000?, 0x0)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0x32
internal/poll.(*pollDesc).waitRead(...)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Read(0xc0001ce400, {0xc00021e000, 0x1800, 0x1800})
	/usr/local/go/src/internal/poll/fd_unix.go:167 +0x299
net.(*netFD).Read(0xc0001ce400, {0xc00021e000?, 0x7f4ac46a2e18?, 0xc00004f770?})
	/usr/local/go/src/net/fd_posix.go:55 +0x29
net.(*conn).Read(0xc000014008, {0xc00021e000?, 0x421f45?, 0xab28e0?})
	/usr/local/go/src/net/net.go:183 +0x45
crypto/tls.(*atLeastReader).Read(0xc000012060, {0xc00021e000?, 0xc000012060?, 0x0?})
	/usr/local/go/src/crypto/tls/conn.go:788 +0x3d
bytes.(*Buffer).ReadFrom(0xc000300610, {0x8cc840, 0xc000012060})
	/usr/local/go/src/bytes/buffer.go:202 +0x98
crypto/tls.(*Conn).readFromUntil(0xc000300380, {0x8ccc40?, 0xc000014008}, 0xc0001ce400?)
	/usr/local/go/src/crypto/tls/conn.go:810 +0xe5
crypto/tls.(*Conn).readRecordOrCCS(0xc000300380, 0x0)
	/usr/local/go/src/crypto/tls/conn.go:617 +0x116
crypto/tls.(*Conn).readRecord(...)
	/usr/local/go/src/crypto/tls/conn.go:583
crypto/tls.(*Conn).Read(0xc000300380, {0xc00035e000, 0x1000, 0x0?})
	/usr/local/go/src/crypto/tls/conn.go:1316 +0x16f
bufio.(*Reader).fill(0xc00027daa0)
	/usr/local/go/src/bufio/bufio.go:106 +0xff
bufio.(*Reader).Peek(0xc00027daa0, 0x2)
	/usr/local/go/src/bufio/bufio.go:144 +0x5d
github.com/gorilla/websocket.(*Conn).read(0xc0002406e0, 0x0?)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:370 +0x2c
github.com/gorilla/websocket.(*Conn).advanceFrame(0xc0002406e0)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:798 +0x7b
github.com/gorilla/websocket.(*Conn).NextReader(0xc0002406e0)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:980 +0xcc
github.com/gorilla/websocket.(*Conn).ReadMessage(0x0?)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:1064 +0x19
github.com/fiatjaf/go-nostr.(*RelayPool).Add.func1()
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:99 +0x6b
created by github.com/fiatjaf/go-nostr.(*RelayPool).Add
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:97 +0x445

goroutine 5 [IO wait]:
internal/poll.runtime_pollWait(0x7f4acddedea8, 0x72)
	/usr/local/go/src/runtime/netpoll.go:306 +0x89
internal/poll.(*pollDesc).wait(0xc0001ce500?, 0xc0001e6600?, 0x0)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0x32
internal/poll.(*pollDesc).waitRead(...)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Read(0xc0001ce500, {0xc0001e6600, 0x1300, 0x1300})
	/usr/local/go/src/internal/poll/fd_unix.go:167 +0x299
net.(*netFD).Read(0xc0001ce500, {0xc0001e6600?, 0x0?, 0x45c2b8?})
	/usr/local/go/src/net/fd_posix.go:55 +0x29
net.(*conn).Read(0xc000014018, {0xc0001e6600?, 0x0?, 0xc00004b700?})
	/usr/local/go/src/net/net.go:183 +0x45
crypto/tls.(*atLeastReader).Read(0xc0002ae000, {0xc0001e6600?, 0xc0002ae000?, 0x0?})
	/usr/local/go/src/crypto/tls/conn.go:788 +0x3d
bytes.(*Buffer).ReadFrom(0xc000300990, {0x8cc840, 0xc0002ae000})
	/usr/local/go/src/bytes/buffer.go:202 +0x98
crypto/tls.(*Conn).readFromUntil(0xc000300700, {0x8ccc40?, 0xc000014018}, 0x0?)
	/usr/local/go/src/crypto/tls/conn.go:810 +0xe5
crypto/tls.(*Conn).readRecordOrCCS(0xc000300700, 0x0)
	/usr/local/go/src/crypto/tls/conn.go:617 +0x116
crypto/tls.(*Conn).readRecord(...)
	/usr/local/go/src/crypto/tls/conn.go:583
crypto/tls.(*Conn).Read(0xc000300700, {0xc000156000, 0x1000, 0x0?})
	/usr/local/go/src/crypto/tls/conn.go:1316 +0x16f
bufio.(*Reader).fill(0xc000283ec0)
	/usr/local/go/src/bufio/bufio.go:106 +0xff
bufio.(*Reader).Peek(0xc000283ec0, 0x2)
	/usr/local/go/src/bufio/bufio.go:144 +0x5d
github.com/gorilla/websocket.(*Conn).read(0xc0003062c0, 0x0?)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:370 +0x2c
github.com/gorilla/websocket.(*Conn).advanceFrame(0xc0003062c0)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:798 +0x7b
github.com/gorilla/websocket.(*Conn).NextReader(0xc0003062c0)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:980 +0xcc
github.com/gorilla/websocket.(*Conn).ReadMessage(0x0?)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:1064 +0x19
github.com/fiatjaf/go-nostr.(*RelayPool).Add.func1()
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:99 +0x6b
created by github.com/fiatjaf/go-nostr.(*RelayPool).Add
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:97 +0x445

goroutine 11 [runnable]:
internal/poll.runtime_pollWait(0x7f4acddedbd8, 0x72)
	/usr/local/go/src/runtime/netpoll.go:306 +0x89
internal/poll.(*pollDesc).wait(0xc000132300?, 0xc00021f800?, 0x0)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0x32
internal/poll.(*pollDesc).waitRead(...)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Read(0xc000132300, {0xc00021f800, 0x1800, 0x1800})
	/usr/local/go/src/internal/poll/fd_unix.go:167 +0x299
net.(*netFD).Read(0xc000132300, {0xc00021f800?, 0x0?, 0x0?})
	/usr/local/go/src/net/fd_posix.go:55 +0x29
net.(*conn).Read(0xc0001d2048, {0xc00021f800?, 0x0?, 0x0?})
	/usr/local/go/src/net/net.go:183 +0x45
crypto/tls.(*atLeastReader).Read(0xc00031ef30, {0xc00021f800?, 0xc00031ef30?, 0x0?})
	/usr/local/go/src/crypto/tls/conn.go:788 +0x3d
bytes.(*Buffer).ReadFrom(0xc0000cb090, {0x8cc840, 0xc00031ef30})
	/usr/local/go/src/bytes/buffer.go:202 +0x98
crypto/tls.(*Conn).readFromUntil(0xc0000cae00, {0x8ccc40?, 0xc0001d2048}, 0x0?)
	/usr/local/go/src/crypto/tls/conn.go:810 +0xe5
crypto/tls.(*Conn).readRecordOrCCS(0xc0000cae00, 0x0)
	/usr/local/go/src/crypto/tls/conn.go:617 +0x116
crypto/tls.(*Conn).readRecord(...)
	/usr/local/go/src/crypto/tls/conn.go:583
crypto/tls.(*Conn).Read(0xc0000cae00, {0xc0000f8000, 0x1000, 0x0?})
	/usr/local/go/src/crypto/tls/conn.go:1316 +0x16f
bufio.(*Reader).fill(0xc0000a3da0)
	/usr/local/go/src/bufio/bufio.go:106 +0xff
bufio.(*Reader).Peek(0xc0000a3da0, 0x2)
	/usr/local/go/src/bufio/bufio.go:144 +0x5d
github.com/gorilla/websocket.(*Conn).read(0xc000306840, 0x0?)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:370 +0x2c
github.com/gorilla/websocket.(*Conn).advanceFrame(0xc000306840)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:798 +0x7b
github.com/gorilla/websocket.(*Conn).NextReader(0xc000306840)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:980 +0xcc
github.com/gorilla/websocket.(*Conn).ReadMessage(0x0?)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:1064 +0x19
github.com/fiatjaf/go-nostr.(*RelayPool).Add.func1()
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:99 +0x6b
created by github.com/fiatjaf/go-nostr.(*RelayPool).Add
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:97 +0x445

goroutine 15 [IO wait]:
internal/poll.runtime_pollWait(0x7f4acddedae8, 0x72)
	/usr/local/go/src/runtime/netpoll.go:306 +0x89
internal/poll.(*pollDesc).wait(0xc0001ce480?, 0xc000221000?, 0x0)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0x32
internal/poll.(*pollDesc).waitRead(...)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Read(0xc0001ce480, {0xc000221000, 0x1800, 0x1800})
	/usr/local/go/src/internal/poll/fd_unix.go:167 +0x299
net.(*netFD).Read(0xc0001ce480, {0xc000221000?, 0x0?, 0xc00029d770?})
	/usr/local/go/src/net/fd_posix.go:55 +0x29
net.(*conn).Read(0xc000014118, {0xc000221000?, 0x0?, 0xc00029d730?})
	/usr/local/go/src/net/net.go:183 +0x45
crypto/tls.(*atLeastReader).Read(0xc0002ae048, {0xc000221000?, 0xc0002ae048?, 0x0?})
	/usr/local/go/src/crypto/tls/conn.go:788 +0x3d
bytes.(*Buffer).ReadFrom(0xc000301410, {0x8cc840, 0xc0002ae048})
	/usr/local/go/src/bytes/buffer.go:202 +0x98
crypto/tls.(*Conn).readFromUntil(0xc000301180, {0x8ccc40?, 0xc000014118}, 0xc0001ce480?)
	/usr/local/go/src/crypto/tls/conn.go:810 +0xe5
crypto/tls.(*Conn).readRecordOrCCS(0xc000301180, 0x0)
	/usr/local/go/src/crypto/tls/conn.go:617 +0x116
crypto/tls.(*Conn).readRecord(...)
	/usr/local/go/src/crypto/tls/conn.go:583
crypto/tls.(*Conn).Read(0xc000301180, {0xc000204000, 0x1000, 0xc000014118?})
	/usr/local/go/src/crypto/tls/conn.go:1316 +0x16f
bufio.(*Reader).fill(0xc0000fde60)
	/usr/local/go/src/bufio/bufio.go:106 +0xff
bufio.(*Reader).Peek(0xc0000fde60, 0x2)
	/usr/local/go/src/bufio/bufio.go:144 +0x5d
github.com/gorilla/websocket.(*Conn).read(0xc000306c60, 0x415234?)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:370 +0x2c
github.com/gorilla/websocket.(*Conn).advanceFrame(0xc000306c60)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:798 +0x7b
github.com/gorilla/websocket.(*Conn).NextReader(0xc000306c60)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:980 +0xcc
github.com/gorilla/websocket.(*Conn).ReadMessage(0xc00029def8?)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:1064 +0x19
github.com/fiatjaf/go-nostr.(*RelayPool).Add.func1()
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:99 +0x6b
created by github.com/fiatjaf/go-nostr.(*RelayPool).Add
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:97 +0x445

goroutine 27 [runnable]:
strconv.appendEscapedRune({0xc000384700, 0x10a, 0x301}, 0x6e, 0x22?, 0x0?, 0x0)
	/usr/local/go/src/strconv/quote.go:68 +0x71b
strconv.appendQuotedWith({0xc00035c140?, 0x8f?, 0x6e8600?}, {0xc000226280, 0x270}, 0x22, 0x0?, 0x0?)
	/usr/local/go/src/strconv/quote.go:52 +0x31a
strconv.AppendQuote(...)
	/usr/local/go/src/strconv/quote.go:135
github.com/valyala/fastjson.escapeString({0xc00035c140, 0x8f, 0xa0}, {0xc000226280, 0x270})
	/home/user/go/pkg/mod/github.com/valyala/[email protected]/parser.go:279 +0x14a
github.com/valyala/fastjson.(*Arena).NewString(0xc00012a600, {0xc000226280?, 0x0?})
	/home/user/go/pkg/mod/github.com/valyala/[email protected]/arena.go:62 +0x150
github.com/fiatjaf/go-nostr.Event.MarshalJSON({{0xc0000c50c0, 0x40}, {0xc0000c4780, 0x40}, {0xc0fe011416f42db6, 0x73722fe4, 0xa82680}, 0x1, {0x0, 0x0, ...}, ...})
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/event_aux.go:123 +0x245
encoding/json.marshalerEncoder(0xc0004c6280, {0x6dc9e0?, 0xc0001ce680?, 0xc00012a808?}, {0x92?, 0xc9?})
	/usr/local/go/src/encoding/json/encode.go:477 +0xbe
encoding/json.(*encodeState).reflectValue(0x6bc8c0?, {0x6dc9e0?, 0xc0001ce680?, 0xc00012a860?}, {0x32?, 0x5c?})
	/usr/local/go/src/encoding/json/encode.go:358 +0x78
encoding/json.interfaceEncoder(0xc0004c6280, {0x6bc8c0?, 0xc0000b60f0?, 0x6b4b20?}, {0xc0?, 0xe6?})
	/usr/local/go/src/encoding/json/encode.go:714 +0xc8
encoding/json.arrayEncoder.encode({0x4?}, 0xc0004c6280, {0x6b10c0?, 0xc00031ef78?, 0xc0001012a0?}, {0x4?, 0x0?})
	/usr/local/go/src/encoding/json/encode.go:914 +0xd5
encoding/json.sliceEncoder.encode({0x416890?}, 0xc0004c6280, {0x6b10c0?, 0xc00031ef78?, 0xc00012aab0?}, {0x0?, 0xa2?})
	/usr/local/go/src/encoding/json/encode.go:887 +0x32f
encoding/json.typeEncoder.func1(0x6b10c0?, {0x6b10c0?, 0xc00031ef78?, 0xc0004c6280?}, {0x80?, 0x0?})
	/usr/local/go/src/encoding/json/encode.go:395 +0x85
encoding/json.(*encodeState).reflectValue(0xc0004c6280?, {0x6b10c0?, 0xc00031ef78?, 0x40ed47?}, {0x78?, 0x0?})
	/usr/local/go/src/encoding/json/encode.go:358 +0x78
encoding/json.(*encodeState).marshal(0x1e?, {0x6b10c0?, 0xc00031ef78?}, {0x68?, 0xca?})
	/usr/local/go/src/encoding/json/encode.go:330 +0xfa
encoding/json.(*Encoder).Encode(0xc00012aca8, {0x6b10c0, 0xc00031ef78})
	/usr/local/go/src/encoding/json/stream.go:209 +0xf3
github.com/gorilla/websocket.(*Conn).WriteJSON(0x7f4acd4fd718?, {0x6b10c0, 0xc00031ef78})
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/json.go:28 +0xc5
github.com/fiatjaf/go-nostr.(*Connection).WriteJSON(0xc0000b60e0?, {0x6b10c0?, 0xc00031ef78?})
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/connection.go:22 +0xb0
github.com/fiatjaf/go-nostr.(*RelayPool).PublishEvent.func1({0xc00027e0a0, 0x1c}, 0x4?)
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:233 +0xce
created by github.com/fiatjaf/go-nostr.(*RelayPool).PublishEvent
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:232 +0x3fa

goroutine 52 [runnable]:
internal/poll.runtime_pollWait(0x7f4acddedcc8, 0x72)
	/usr/local/go/src/runtime/netpoll.go:306 +0x89
internal/poll.(*pollDesc).wait(0xc0004c6180?, 0xc000244000?, 0x0)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0x32
internal/poll.(*pollDesc).waitRead(...)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Read(0xc0004c6180, {0xc000244000, 0x1300, 0x1300})
	/usr/local/go/src/internal/poll/fd_unix.go:167 +0x299
net.(*netFD).Read(0xc0004c6180, {0xc000244000?, 0x6b4b20?, 0xc00007ec50?})
	/usr/local/go/src/net/fd_posix.go:55 +0x29
net.(*conn).Read(0xc000014190, {0xc000244000?, 0xc000101bc0?, 0x4?})
	/usr/local/go/src/net/net.go:183 +0x45
crypto/tls.(*atLeastReader).Read(0xc00031ef60, {0xc000244000?, 0xc00031ef60?, 0x0?})
	/usr/local/go/src/crypto/tls/conn.go:788 +0x3d
bytes.(*Buffer).ReadFrom(0xc000301b10, {0x8cc840, 0xc00031ef60})
	/usr/local/go/src/bytes/buffer.go:202 +0x98
crypto/tls.(*Conn).readFromUntil(0xc000301880, {0x8ccc40?, 0xc000014190}, 0x0?)
	/usr/local/go/src/crypto/tls/conn.go:810 +0xe5
crypto/tls.(*Conn).readRecordOrCCS(0xc000301880, 0x0)
	/usr/local/go/src/crypto/tls/conn.go:617 +0x116
crypto/tls.(*Conn).readRecord(...)
	/usr/local/go/src/crypto/tls/conn.go:583
crypto/tls.(*Conn).Read(0xc000301880, {0xc00034e000, 0x1000, 0x4?})
	/usr/local/go/src/crypto/tls/conn.go:1316 +0x16f
bufio.(*Reader).fill(0xc000207e60)
	/usr/local/go/src/bufio/bufio.go:106 +0xff
bufio.(*Reader).Peek(0xc000207e60, 0x2)
	/usr/local/go/src/bufio/bufio.go:144 +0x5d
github.com/gorilla/websocket.(*Conn).read(0xc000307080, 0x6b4b20?)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:370 +0x2c
github.com/gorilla/websocket.(*Conn).advanceFrame(0xc000307080)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:798 +0x7b
github.com/gorilla/websocket.(*Conn).NextReader(0xc000307080)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:980 +0xcc
github.com/gorilla/websocket.(*Conn).ReadMessage(0x0?)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:1064 +0x19
github.com/fiatjaf/go-nostr.(*RelayPool).Add.func1()
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:99 +0x6b
created by github.com/fiatjaf/go-nostr.(*RelayPool).Add
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:97 +0x445

goroutine 25 [runnable]:
internal/poll.runtime_pollWait(0x7f4acdded908, 0x72)
	/usr/local/go/src/runtime/netpoll.go:306 +0x89
internal/poll.(*pollDesc).wait(0xc000132580?, 0xc0002b4000?, 0x0)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:84 +0x32
internal/poll.(*pollDesc).waitRead(...)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:89
internal/poll.(*FD).Read(0xc000132580, {0xc0002b4000, 0x1500, 0x1500})
	/usr/local/go/src/internal/poll/fd_unix.go:167 +0x299
net.(*netFD).Read(0xc000132580, {0xc0002b4000?, 0x30847c40384080a?, 0x2f6bb68000f7683?})
	/usr/local/go/src/net/fd_posix.go:55 +0x29
net.(*conn).Read(0xc0000a0050, {0xc0002b4000?, 0xcd9f6d033fd675?, 0x211a87702767371?})
	/usr/local/go/src/net/net.go:183 +0x45
crypto/tls.(*atLeastReader).Read(0xc000012e40, {0xc0002b4000?, 0xc000012e40?, 0x0?})
	/usr/local/go/src/crypto/tls/conn.go:788 +0x3d
bytes.(*Buffer).ReadFrom(0xc00028c290, {0x8cc840, 0xc000012e40})
	/usr/local/go/src/bytes/buffer.go:202 +0x98
crypto/tls.(*Conn).readFromUntil(0xc00028c000, {0x8ccc40?, 0xc0000a0050}, 0x186e95500e2115e?)
	/usr/local/go/src/crypto/tls/conn.go:810 +0xe5
crypto/tls.(*Conn).readRecordOrCCS(0xc00028c000, 0x0)
	/usr/local/go/src/crypto/tls/conn.go:617 +0x116
crypto/tls.(*Conn).readRecord(...)
	/usr/local/go/src/crypto/tls/conn.go:583
crypto/tls.(*Conn).Read(0xc00028c000, {0xc0002e8000, 0x1000, 0xf1271903316ff4?})
	/usr/local/go/src/crypto/tls/conn.go:1316 +0x16f
bufio.(*Reader).fill(0xc0002e4180)
	/usr/local/go/src/bufio/bufio.go:106 +0xff
bufio.(*Reader).Peek(0xc0002e4180, 0x2)
	/usr/local/go/src/bufio/bufio.go:144 +0x5d
github.com/gorilla/websocket.(*Conn).read(0xc000240160, 0x38eb2c3023c6f3b?)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:370 +0x2c
github.com/gorilla/websocket.(*Conn).advanceFrame(0xc000240160)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:798 +0x7b
github.com/gorilla/websocket.(*Conn).NextReader(0xc000240160)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:980 +0xcc
github.com/gorilla/websocket.(*Conn).ReadMessage(0x0?)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:1064 +0x19
github.com/fiatjaf/go-nostr.(*RelayPool).Add.func1()
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:99 +0x6b
created by github.com/fiatjaf/go-nostr.(*RelayPool).Add
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:97 +0x445

goroutine 26 [chan receive]:
main.initNostr.func1()
	/home/user/go/pkg/mod/github.com/1ma/[email protected]/nostr.go:29 +0xc5
created by main.initNostr
	/home/user/go/pkg/mod/github.com/1ma/[email protected]/nostr.go:28 +0x289

goroutine 30 [runnable]:
sync.runtime_Semacquire(0xc000014210?)
	/usr/local/go/src/runtime/sema.go:62 +0x27
sync.(*WaitGroup).Wait(0x6b10c0?)
	/usr/local/go/src/sync/waitgroup.go:116 +0x4b
encoding/json.typeEncoder.func1(0x6b10c0?, {0x6b10c0?, 0xc0002ae3a8?, 0xc0001ce800?}, {0x80?, 0x0?})
	/usr/local/go/src/encoding/json/encode.go:394 +0x55
encoding/json.(*encodeState).reflectValue(0xc0001ce800?, {0x6b10c0?, 0xc0002ae3a8?, 0x40ed47?}, {0x78?, 0x0?})
	/usr/local/go/src/encoding/json/encode.go:358 +0x78
encoding/json.(*encodeState).marshal(0x6ed020?, {0x6b10c0?, 0xc0002ae3a8?}, {0xb8?, 0xc5?})
	/usr/local/go/src/encoding/json/encode.go:330 +0xfa
encoding/json.(*Encoder).Encode(0xc00029cca8, {0x6b10c0, 0xc0002ae3a8})
	/usr/local/go/src/encoding/json/stream.go:209 +0xf3
github.com/gorilla/websocket.(*Conn).WriteJSON(0x7f4ac46a09d8?, {0x6b10c0, 0xc0002ae3a8})
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/json.go:28 +0xc5
github.com/fiatjaf/go-nostr.(*Connection).WriteJSON(0xc0001e28c0?, {0x6b10c0?, 0xc0002ae3a8?})
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/connection.go:22 +0xb0
github.com/fiatjaf/go-nostr.(*RelayPool).PublishEvent.func1({0xc0002943a8, 0x18}, 0x1?)
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:233 +0xce
created by github.com/fiatjaf/go-nostr.(*RelayPool).PublishEvent
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:232 +0x3fa

goroutine 31 [chan send]:
github.com/fiatjaf/go-nostr.(*RelayPool).PublishEvent.func1({0xc0000abae0, 0xd}, 0x0?)
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:238 +0x208
created by github.com/fiatjaf/go-nostr.(*RelayPool).PublishEvent
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:232 +0x3fa

goroutine 33 [runnable]:
syscall.Syscall(0xc000492480?, 0xc00020b938?, 0x4b3812?, 0x7ffff80000000000?)
	/usr/local/go/src/syscall/syscall_linux.go:69 +0x27
syscall.write(0xc0001ce000?, {0xc000492480?, 0xc000492400?, 0x416890?})
	/usr/local/go/src/syscall/zsyscall_linux_amd64.go:939 +0x45
syscall.Write(...)
	/usr/local/go/src/syscall/syscall_unix.go:206
internal/poll.ignoringEINTRIO(...)
	/usr/local/go/src/internal/poll/fd_unix.go:794
internal/poll.(*FD).Write(0xc0001ce000, {0xc000492480, 0x429, 0x480})
	/usr/local/go/src/internal/poll/fd_unix.go:383 +0x385
net.(*netFD).Write(0xc0001ce000, {0xc000492480?, 0x40e430?, 0x6d95e0?})
	/usr/local/go/src/net/fd_posix.go:96 +0x29
net.(*conn).Write(0xc0000a0d48, {0xc000492480?, 0xc000040c00?, 0xc000330018?})
	/usr/local/go/src/net/net.go:195 +0x45
crypto/tls.(*Conn).write(0xc0000cb500, {0xc000492480?, 0x5?, 0x5?})
	/usr/local/go/src/crypto/tls/conn.go:923 +0x10d
crypto/tls.(*Conn).writeRecordLocked(0xc0000cb500, 0x17, {0xc0001e5306, 0x413, 0x1008})
	/usr/local/go/src/crypto/tls/conn.go:991 +0x354
crypto/tls.(*Conn).Write(0x1000000000078?, {0xc0001e5306, 0x413, 0x1008})
	/usr/local/go/src/crypto/tls/conn.go:1186 +0x411
github.com/gorilla/websocket.(*Conn).write(0xc000306160, 0x1, {0xab1850?, 0x3?, 0x0?}, {0xc0001e5306, 0x413, 0x1008}, {0x0, 0x0, ...})
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:391 +0x1a4
github.com/gorilla/websocket.(*messageWriter).flushFrame(0xc00019ee40, 0x1, {0x0?, 0x0?, 0x0?})
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:614 +0x3e5
github.com/gorilla/websocket.(*messageWriter).Close(0xc00020bca8?)
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:724 +0x45
github.com/gorilla/websocket.(*Conn).WriteJSON(0x7f4ac46a09d8?, {0x6b10c0, 0xc0002ae378})
	/home/user/go/pkg/mod/github.com/gorilla/[email protected]/json.go:29 +0xdf
github.com/fiatjaf/go-nostr.(*Connection).WriteJSON(0xc0001e28a0?, {0x6b10c0?, 0xc0002ae378?})
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/connection.go:22 +0xb0
github.com/fiatjaf/go-nostr.(*RelayPool).PublishEvent.func1({0xc00001aeb0, 0xf}, 0x0?)
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:233 +0xce
created by github.com/fiatjaf/go-nostr.(*RelayPool).PublishEvent
	/home/user/go/pkg/mod/github.com/fiatjaf/[email protected]/relaypool.go:232 +0x3fa
@bndw
Copy link
Contributor

bndw commented Mar 28, 2023

Looks like the bug is actually in the since-removed relay pool in github.com/fiatjaf/go-nostr v0.6.2. This is likely blocked by #40

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants