@dfc: how would this resolve that issue? ( I don’t know the internals of bufio.newReader /NewScanner)
I was able to get the stacktrace once it crashed (compiled with --race flag ) even that is not showing me any valuable information. pasting it here…
runtime/cgo: pthread_create failed: Resource temporarily unavailable
SIGABRT: abort
PC=0x7f4671b1a625 m=41
goroutine 0 [idle]:
goroutine 71 [running]:
runtime.systemstack_switch()
/usr/local/go/src/runtime/asm_amd64.s:245 fp=0xc820048d10 sp=0xc820048d08
runtime.gcMarkTermination()
/usr/local/go/src/runtime/mgc.go:1260 +0x393 fp=0xc820048f20 sp=0xc820048d10
runtime.gcMarkDone()
/usr/local/go/src/runtime/mgc.go:1146 +0x29e fp=0xc820048f40 sp=0xc820048f20
runtime.gcBgMarkWorker(0xc820024a00)
/usr/local/go/src/runtime/mgc.go:1480 +0x448 fp=0xc820048fb8 sp=0xc820048f40
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1998 +0x1 fp=0xc820048fc0 sp=0xc820048fb8
created by runtime.gcBgMarkStartWorkers
/usr/local/go/src/runtime/mgc.go:1330 +0x92
goroutine 1 [select (no cases), 3405 minutes]:
main.main()
/home/myuser/goprog/publishmessage/publisher.go:61 +0x5ac
goroutine 17 [syscall, 3405 minutes, locked to thread]:
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1998 +0x1
goroutine 19 [IO wait]:
net.runtime_pollWait(0x7f4672121758, 0x72, 0x415d89)
/usr/local/go/src/runtime/netpoll.go:160 +0x63
net.(*pollDesc).Wait(0xc820118060, 0x72, 0x0, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:73 +0x56
net.(*pollDesc).WaitRead(0xc820118060, 0x0, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:78 +0x44
net.(*netFD).Read(0xc820118000, 0xc82011c000, 0x100000, 0x100000, 0x0, 0x7f4672118028, 0xc820092150)
/usr/local/go/src/net/fd_unix.go:250 +0x27b
net.(*conn).Read(0xc8200b6020, 0xc82011c000, 0x100000, 0x100000, 0x43833f, 0x0, 0x0)
/usr/local/go/src/net/net.go:172 +0x121
net.(*TCPConn).Read(0xc8200b6020, 0xc82011c000, 0x100000, 0x100000, 0x0, 0x0, 0x0)
:68 +0x7d
bufio.(*Reader).fill(0xc82005fee0)
/usr/local/go/src/bufio/bufio.go:97 +0x365
bufio.(*Reader).ReadSlice(0xc82005fee0, 0x46390a, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/bufio/bufio.go:328 +0x5a9
bufio.(*Reader).ReadBytes(0xc82005fee0, 0xa, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/bufio/bufio.go:406 +0xc0
main.(*TcpConnector).connect.func1(0x7f4672120788, 0xc8200b6020, 0xc820094e70)
/home/myuser/goprog/publishmessage/publisher.go:120 +0x12e
created by main.(*TcpConnector).connect
/home/myuser/goprog/publishmessage/publisher.go:133 +0x35f
goroutine 20 [runnable]:
bytes.(*Buffer).WriteString(0xc82027c000, 0xc820569c7c, 0x7, 0x0, 0x0, 0x0)
/usr/local/go/src/bytes/buffer.go:141
encoding/json.(*encodeState).string(0xc82027c000, 0xc820568000, 0x2677, 0xc820568000)
/usr/local/go/src/encoding/json/encode.go:799 +0x2a2
encoding/json.stringEncoder(0xc82027c000, 0x7a7ec0, 0xc8200125c0, 0x198, 0x0)
/usr/local/go/src/encoding/json/encode.go:551 +0x4bc
encoding/json.(*structEncoder).encode(0xc820012240, 0xc82027c000, 0x8445e0, 0xc8200125a0, 0x199, 0x100)
/usr/local/go/src/encoding/json/encode.go:587 +0x366
encoding/json.(*structEncoder).(encoding/json.encode)-fm(0xc82027c000, 0x8445e0, 0xc8200125a0, 0x199, 0xc820012500)
/usr/local/go/src/encoding/json/encode.go:601 +0x5f
encoding/json.(*ptrEncoder).encode(0xc82004e030, 0xc82027c000, 0x78c800, 0xc8200125a0, 0x16, 0x0)
/usr/local/go/src/encoding/json/encode.go:709 +0x11a
encoding/json.(*ptrEncoder).(encoding/json.encode)-fm(0xc82027c000, 0x78c800, 0xc8200125a0, 0x16, 0x0)
/usr/local/go/src/encoding/json/encode.go:714 +0x5f
encoding/json.(*encodeState).reflectValue(0xc82027c000, 0x78c800, 0xc8200125a0, 0x16)
/usr/local/go/src/encoding/json/encode.go:301 +0x79
encoding/json.(*encodeState).marshal(0xc82027c000, 0x78c800, 0xc8200125a0, 0x0, 0x0)
/usr/local/go/src/encoding/json/encode.go:274 +0xb7
encoding/json.Marshal(0x78c800, 0xc8200125a0, 0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/encoding/json/encode.go:139 +0xc0
main.doPut(0xc820274d00, 0x3a, 0xc8200125a0)
/home/myuser/goprog/publishmessage/publisher.go:66 +0xa1
main.main.func1(0xc820094e70)
/home/myuser/goprog/publishmessage/publisher.go:56 +0x418
created by main.main
/home/myuser/goprog/publishmessage/publisher.go:59 +0x5a7
rax 0x0
rbx 0x7f4671e76d98
rcx 0xffffffffffffffff
rdx 0x6
rdi 0xad65
rsi 0x1642
rbp 0x94e242
rsp 0x7f45c8d7c9b8
r8 0xa
r9 0x7f45c8d7d700
r10 0x8
r11 0x206
r12 0x7f45c8d7cbe8
r13 0xc820083000
r14 0xc82033d380
r15 0x94c7c0
rip 0x7f4671b1a625
rflags 0x206
cs 0x33
fs 0x0
gs 0x0