Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nsqd: panic when sending garbage to binary /mpub #822

Closed
yangyifeng01 opened this issue Dec 14, 2016 · 3 comments · Fixed by #835
Closed

nsqd: panic when sending garbage to binary /mpub #822

yangyifeng01 opened this issue Dec 14, 2016 · 3 comments · Fixed by #835
Labels

Comments

@yangyifeng01
Copy link

yangyifeng01 commented Dec 14, 2016

I tried to use nsqd v0.3.8 (built w/go1.6.2), but just when I enter the command below

curl -d "<message>\n<message>\n<message>" "http://192.168.1.73:4151/mpub?topic=test&binary=true"

after one second , nsqd crashed!
No matter how much nsqd and nsqlookupd run.

Here's the error logs:

[nsqd] 2016/12/14 04:20:34.834652 TCP: new client(192.168.0.20:39366)
[nsqd] 2016/12/14 04:20:34.834715 CLIENT(192.168.0.20:39366): desired protocol magic '  V2'
[nsqd] 2016/12/14 04:20:34.835156 [192.168.0.20:39366] IDENTIFY: {ShortID:yyf LongID:yyf.junction ClientID:yyf Hostname:yyf.junction HeartbeatInterval:30000 OutputBufferSize:16384 OutputBufferTimeout:250 FeatureNegotiation:true TLSv1:false Deflate:false DeflateLevel:6 Snappy:false SampleRate:0 UserAgent:nsq_to_file/0.3.8 go-nsq/1.0.5 MsgTimeout:0}
[nsqd] 2016/12/14 04:20:45.666063 LOOKUPD(192.168.1.61:4160): sending heartbeat
[nsqd] 2016/12/14 04:20:45.667319 LOOKUPD(192.168.1.62:4160): sending heartbeat
[nsqd] 2016/12/14 04:20:45.668173 LOOKUPD(192.168.1.63:4160): sending heartbeat
fatal error: runtime: out of memory

runtime stack:
runtime.throw(0x9e4170, 0x16)
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/panic.go:547 +0x90
runtime.sysMap(0xc820300000, 0x1e36c0000, 0xffffffff00109100, 0xc33778)
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/mem_linux.go:206 +0x9b
runtime.(*mheap).sysAlloc(0xc198e0, 0x1e36c0000, 0x0)
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/malloc.go:429 +0x191
runtime.(*mheap).grow(0xc198e0, 0xf1b60, 0x0)
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/mheap.go:651 +0x63
runtime.(*mheap).allocSpanLocked(0xc198e0, 0xf1b5a, 0xc81ffefe00)
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/mheap.go:553 +0x4f6
runtime.(*mheap).alloc_m(0xc198e0, 0xf1b5a, 0x100000000, 0xc1be80)
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/mheap.go:437 +0x119
runtime.(*mheap).alloc.func1()
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/mheap.go:502 +0x41
runtime.systemstack(0xc82010dee0)
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/asm_amd64.s:307 +0xab
runtime.(*mheap).alloc(0xc198e0, 0xf1b5a, 0x10100000000, 0xc82001b500)
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/mheap.go:503 +0x63
runtime.largeAlloc(0x1e36b2b98, 0xc800000000, 0x456930)
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/malloc.go:766 +0xb3
runtime.mallocgc.func3()
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/malloc.go:664 +0x33
runtime.systemstack(0xc82001a000)
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/asm_amd64.s:291 +0x79
runtime.mstart()
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/proc.go:1051

goroutine 32 [running]:
runtime.systemstack_switch()
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/asm_amd64.s:245 fp=0xc8201091f0 sp=0xc8201091e8
runtime.mallocgc(0x1e36b2b98, 0x8bf140, 0x0, 0x4)
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/malloc.go:665 +0x9eb fp=0xc8201092c8 sp=0xc8201091f0
runtime.newarray(0x8bf140, 0x3c6d6573, 0xc82011b840)
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/malloc.go:798 +0xc9 fp=0xc820109308 sp=0xc8201092c8
runtime.makeslice(0x7fdc40, 0x0, 0x3c6d6573, 0x0, 0x0, 0x0)
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/slice.go:32 +0x165 fp=0xc820109358 sp=0xc820109308
github.com/nsqio/nsq/nsqd.readMPUB(0x7f43e0e6d048, 0xc82011b840, 0xc8201b6c08, 0x4, 0x4, 0xc82014e000, 0x100000, 0x0, 0x0, 0x0, ...)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/protocol_v2.go:944 +0x51f fp=0xc8201095a0 sp=0xc820109358
github.com/nsqio/nsq/nsqd.(*httpServer).doMPUB(0xc82014d200, 0x7f43e0e6d010, 0xc820120d00, 0xc82013e0e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/http.go:269 +0x336 fp=0xc820109830 sp=0xc8201095a0
github.com/nsqio/nsq/nsqd.(*httpServer).(github.com/nsqio/nsq/nsqd.doMPUB)-fm(0x7f43e0e6d010, 0xc820120d00, 0xc82013e0e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/http.go:53 +0x8e fp=0xc820109890 sp=0xc820109830
github.com/nsqio/nsq/internal/http_api.NegotiateVersion.func1(0x7f43e0e6d010, 0xc820120d00, 0xc82013e0e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/internal/http_api/api_response.go:59 +0x99 fp=0xc820109930 sp=0xc820109890
github.com/nsqio/nsq/internal/http_api.Decorate.func1(0x7f43e0e6d010, 0xc820120d00, 0xc82013e0e0, 0x0, 0x0, 0x0)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/internal/http_api/api_response.go:161 +0x5a fp=0xc820109988 sp=0xc820109930
github.com/julienschmidt/httprouter.(*Router).ServeHTTP(0xc82011b300, 0x7f43e0e6d010, 0xc820120d00, 0xc82013e0e0)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/.godeps/src/github.com/julienschmidt/httprouter/router.go:299 +0x193 fp=0xc820109ac8 sp=0xc820109988
github.com/nsqio/nsq/nsqd.(*httpServer).ServeHTTP(0xc82014d200, 0x7f43e0e6d010, 0xc820120d00, 0xc82013e0e0)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/http.go:126 +0x23a fp=0xc820109b70 sp=0xc820109ac8
net/http.serverHandler.ServeHTTP(0xc820056280, 0x7f43e0e6d010, 0xc820120d00, 0xc82013e0e0)
	/usr/local/Cellar/go/1.6.2/libexec/src/net/http/server.go:2081 +0x19e fp=0xc820109bd0 sp=0xc820109b70
net/http.(*conn).serve(0xc820134500)
	/usr/local/Cellar/go/1.6.2/libexec/src/net/http/server.go:1472 +0xf2e fp=0xc820109f98 sp=0xc820109bd0
runtime.goexit()
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/asm_amd64.s:1998 +0x1 fp=0xc820109fa0 sp=0xc820109f98
created by net/http.(*Server).Serve
	/usr/local/Cellar/go/1.6.2/libexec/src/net/http/server.go:2137 +0x44e

goroutine 1 [chan receive]:
github.com/judwhite/go-svc/svc.Run(0x7f43e0e670e0, 0xc820122010, 0xc8201181a0, 0x2, 0x2, 0x0, 0x0)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/.godeps/src/github.com/judwhite/go-svc/svc/svc_other.go:30 +0x2d3
main.main()
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/apps/nsqd/nsqd.go:181 +0x1d5

goroutine 5 [syscall]:
os/signal.signal_recv(0x0)
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/sigqueue.go:116 +0x132
os/signal.loop()
	/usr/local/Cellar/go/1.6.2/libexec/src/os/signal/signal_unix.go:22 +0x18
created by os/signal.init.1
	/usr/local/Cellar/go/1.6.2/libexec/src/os/signal/signal_unix.go:28 +0x37

goroutine 17 [select]:
github.com/nsqio/nsq/nsqd.(*diskQueue).ioLoop(0xc820182000)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/diskqueue.go:606 +0x71b
created by github.com/nsqio/nsq/nsqd.newDiskQueue
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/diskqueue.go:97 +0x449

goroutine 18 [select]:
github.com/nsqio/nsq/nsqd.(*Topic).messagePump(0xc82012c3c0)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/topic.go:230 +0xda6
github.com/nsqio/nsq/nsqd.NewTopic.func1()
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/topic.go:66 +0x20
github.com/nsqio/nsq/internal/util.(*WaitGroupWrapper).Wrap.func1(0xc8201292e0, 0xc82012c420)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/internal/util/wait_group_wrapper.go:14 +0x1d
created by github.com/nsqio/nsq/internal/util.(*WaitGroupWrapper).Wrap
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/internal/util/wait_group_wrapper.go:16 +0x5d

goroutine 20 [select]:
github.com/nsqio/nsq/nsqd.(*diskQueue).ioLoop(0xc820182600)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/diskqueue.go:606 +0x71b
created by github.com/nsqio/nsq/nsqd.newDiskQueue
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/diskqueue.go:97 +0x449

goroutine 22 [select]:
github.com/nsqio/nsq/nsqd.(*diskQueue).ioLoop(0xc820182a80)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/diskqueue.go:606 +0x71b
created by github.com/nsqio/nsq/nsqd.newDiskQueue
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/diskqueue.go:97 +0x449

goroutine 24 [IO wait]:
net.runtime_pollWait(0x7f43e0e6ca28, 0x72, 0x0)
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).Wait(0xc820126920, 0x72, 0x0, 0x0)
	/usr/local/Cellar/go/1.6.2/libexec/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc820126920, 0x0, 0x0)
	/usr/local/Cellar/go/1.6.2/libexec/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).accept(0xc8201268c0, 0x0, 0x7f43e0e6cbd8, 0xc8200b0ec0)
	/usr/local/Cellar/go/1.6.2/libexec/src/net/fd_unix.go:426 +0x27c
net.(*TCPListener).AcceptTCP(0xc820122130, 0xc82003de20, 0x0, 0x0)
	/usr/local/Cellar/go/1.6.2/libexec/src/net/tcpsock_posix.go:254 +0x4d
net.(*TCPListener).Accept(0xc820122130, 0x0, 0x0, 0x0, 0x0)
	/usr/local/Cellar/go/1.6.2/libexec/src/net/tcpsock_posix.go:264 +0x3d
github.com/nsqio/nsq/internal/protocol.TCPServer(0x7f43e0e6baa8, 0xc820122130, 0x7f43e0e6cb38, 0xc820122138, 0x7f43e0e6cae8, 0xc82012a1e0)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/internal/protocol/tcp_server.go:20 +0x18f
github.com/nsqio/nsq/nsqd.(*NSQD).Main.func1()
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/nsqd.go:226 +0xf2
github.com/nsqio/nsq/internal/util.(*WaitGroupWrapper).Wrap.func1(0xc82014d140, 0xc8201363e0)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/internal/util/wait_group_wrapper.go:14 +0x1d
created by github.com/nsqio/nsq/internal/util.(*WaitGroupWrapper).Wrap
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/internal/util/wait_group_wrapper.go:16 +0x5d

goroutine 25 [IO wait]:
net.runtime_pollWait(0x7f43e0e6c968, 0x72, 0x0)
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).Wait(0xc820126990, 0x72, 0x0, 0x0)
	/usr/local/Cellar/go/1.6.2/libexec/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc820126990, 0x0, 0x0)
	/usr/local/Cellar/go/1.6.2/libexec/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).accept(0xc820126930, 0x0, 0x7f43e0e6cbd8, 0xc82014dc60)
	/usr/local/Cellar/go/1.6.2/libexec/src/net/fd_unix.go:426 +0x27c
net.(*TCPListener).AcceptTCP(0xc820122140, 0xc8201cecd8, 0x0, 0x0)
	/usr/local/Cellar/go/1.6.2/libexec/src/net/tcpsock_posix.go:254 +0x4d
net.(*TCPListener).Accept(0xc820122140, 0x0, 0x0, 0x0, 0x0)
	/usr/local/Cellar/go/1.6.2/libexec/src/net/tcpsock_posix.go:264 +0x3d
net/http.(*Server).Serve(0xc820056280, 0x7f43e0e6baa8, 0xc820122140, 0x0, 0x0)
	/usr/local/Cellar/go/1.6.2/libexec/src/net/http/server.go:2117 +0x129
github.com/nsqio/nsq/internal/http_api.Serve(0x7f43e0e6baa8, 0xc820122140, 0x7f43e0eab750, 0xc82014d200, 0x97bc20, 0x4, 0x7f43e0e6cae8, 0xc82012a1e0)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/internal/http_api/http_server.go:29 +0x3d7
github.com/nsqio/nsq/nsqd.(*NSQD).Main.func3()
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/nsqd.go:253 +0xfe
github.com/nsqio/nsq/internal/util.(*WaitGroupWrapper).Wrap.func1(0xc82014d860, 0xc8201363e0)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/internal/util/wait_group_wrapper.go:14 +0x1d
created by github.com/nsqio/nsq/internal/util.(*WaitGroupWrapper).Wrap
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/internal/util/wait_group_wrapper.go:16 +0x5d

goroutine 26 [select]:
github.com/nsqio/nsq/nsqd.(*NSQD).queueScanLoop(0xc820136300)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/nsqd.go:667 +0x564
github.com/nsqio/nsq/nsqd.(*NSQD).Main.func4()
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/nsqd.go:256 +0x20
github.com/nsqio/nsq/internal/util.(*WaitGroupWrapper).Wrap.func1(0xc8201b60f0, 0xc8201363e0)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/internal/util/wait_group_wrapper.go:14 +0x1d
created by github.com/nsqio/nsq/internal/util.(*WaitGroupWrapper).Wrap
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/internal/util/wait_group_wrapper.go:16 +0x5d

goroutine 27 [select]:
github.com/nsqio/nsq/nsqd.(*NSQD).idPump(0xc820136300)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/nsqd.go:543 +0x40d
github.com/nsqio/nsq/nsqd.(*NSQD).Main.func5()
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/nsqd.go:257 +0x20
github.com/nsqio/nsq/internal/util.(*WaitGroupWrapper).Wrap.func1(0xc8201b6100, 0xc8201363e0)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/internal/util/wait_group_wrapper.go:14 +0x1d
created by github.com/nsqio/nsq/internal/util.(*WaitGroupWrapper).Wrap
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/internal/util/wait_group_wrapper.go:16 +0x5d

goroutine 28 [select]:
github.com/nsqio/nsq/nsqd.(*NSQD).lookupLoop(0xc820136300)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/lookup.go:80 +0x3165
github.com/nsqio/nsq/nsqd.(*NSQD).Main.func6()
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/nsqd.go:258 +0x20
github.com/nsqio/nsq/internal/util.(*WaitGroupWrapper).Wrap.func1(0xc8201b6110, 0xc8201363e0)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/internal/util/wait_group_wrapper.go:14 +0x1d
created by github.com/nsqio/nsq/internal/util.(*WaitGroupWrapper).Wrap
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/internal/util/wait_group_wrapper.go:16 +0x5d

goroutine 29 [select, locked to thread]:
runtime.gopark(0xa6ad28, 0xc8201bcf28, 0x981f10, 0x6, 0x18, 0x2)
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/proc.go:262 +0x163
runtime.selectgoImpl(0xc8201bcf28, 0x0, 0x18)
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/select.go:392 +0xa67
runtime.selectgo(0xc8201bcf28)
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/select.go:215 +0x12
runtime.ensureSigM.func1()
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/signal1_unix.go:279 +0x358
runtime.goexit()
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/asm_amd64.s:1998 +0x1

goroutine 8 [select]:
github.com/nsqio/nsq/nsqd.(*NSQD).queueScanWorker(0xc820136300, 0xc8200543c0, 0xc820056200, 0xc820054420)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/nsqd.go:625 +0x1a7
github.com/nsqio/nsq/nsqd.(*NSQD).resizePool.func1()
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/nsqd.go:614 +0x3b
github.com/nsqio/nsq/internal/util.(*WaitGroupWrapper).Wrap.func1(0xc8200196e0, 0xc8201363e0)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/internal/util/wait_group_wrapper.go:14 +0x1d
created by github.com/nsqio/nsq/internal/util.(*WaitGroupWrapper).Wrap
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/internal/util/wait_group_wrapper.go:16 +0x5d

goroutine 11 [select]:
github.com/nsqio/nsq/nsqd.(*protocolV2).messagePump(0xc8200260f8, 0xc8201e8000, 0xc820054840)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/protocol_v2.go:265 +0xc91
created by github.com/nsqio/nsq/nsqd.(*protocolV2).IOLoop
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/protocol_v2.go:51 +0x165

goroutine 10 [IO wait]:
net.runtime_pollWait(0x7f43e0e6c668, 0x72, 0xc8201e0000)
	/usr/local/Cellar/go/1.6.2/libexec/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).Wait(0xc82004a680, 0x72, 0x0, 0x0)
	/usr/local/Cellar/go/1.6.2/libexec/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc82004a680, 0x0, 0x0)
	/usr/local/Cellar/go/1.6.2/libexec/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).Read(0xc82004a620, 0xc8201e0000, 0x4000, 0x4000, 0x0, 0x7f43e0ea7168, 0xc82000e1b0)
	/usr/local/Cellar/go/1.6.2/libexec/src/net/fd_unix.go:250 +0x23a
net.(*conn).Read(0xc8200260f0, 0xc8201e0000, 0x4000, 0x4000, 0x0, 0x0, 0x0)
	/usr/local/Cellar/go/1.6.2/libexec/src/net/net.go:172 +0xe4
bufio.(*Reader).fill(0xc820054720)
	/usr/local/Cellar/go/1.6.2/libexec/src/bufio/bufio.go:97 +0x1e9
bufio.(*Reader).ReadSlice(0xc820054720, 0xecfe3060a, 0x0, 0x0, 0x0, 0x0, 0x0)
	/usr/local/Cellar/go/1.6.2/libexec/src/bufio/bufio.go:328 +0x21a
github.com/nsqio/nsq/nsqd.(*protocolV2).IOLoop(0xc8200260f8, 0x7f43e0eab7a0, 0xc8200260f0, 0x0, 0x0)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/protocol_v2.go:63 +0x2c1
github.com/nsqio/nsq/nsqd.(*tcpServer).Handle(0xc820122138, 0x7f43e0eab7a0, 0xc8200260f0)
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/tcp.go:43 +0x5c9
created by github.com/nsqio/nsq/internal/protocol.TCPServer
	/Users/mreiferson/dev/src/github.com/nsqio/nsq/internal/protocol/tcp_server.go:33 +0x6ac
root@ubuntu73:~# 
@ploxiln
Copy link
Member

ploxiln commented Dec 14, 2016

The relevant part of all those backtraces is this:

runtime.newarray(0x8bf140, 0x3c6d6573, 0xc82011b840)
/usr/local/Cellar/go/1.6.2/libexec/src/runtime/malloc.go:798 +0xc9 fp=0xc820109308 sp=0xc8201092c8
runtime.makeslice(0x7fdc40, 0x0, 0x3c6d6573, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.6.2/libexec/src/runtime/slice.go:32 +0x165 fp=0xc820109358 sp=0xc820109308
github.com/nsqio/nsq/nsqd.readMPUB(0x7f43e0e6d048, 0xc82011b840, 0xc8201b6c08, 0x4, 0x4, 0xc82014e000, 0x100000, 0x0, 0x0, 0x0, ...)
/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/protocol_v2.go:944 +0x51f fp=0xc8201095a0 sp=0xc820109358
github.com/nsqio/nsq/nsqd.(*httpServer).doMPUB(0xc82014d200, 0x7f43e0e6d010, 0xc820120d00, 0xc82013e0e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/Users/mreiferson/dev/src/github.com/nsqio/nsq/nsqd/http.go:269 +0x336 fp=0xc820109830 sp=0xc8201095a0

So, because you specified binary=true, the data is supposed to start with the number of messages (in binary), so \n\n (and some other bytes, I'm not sure which exactly) were interpreted as "number of messages" which was a very large number.

@mreiferson there could probably be a limit of messages per mpub.

@mreiferson
Copy link
Member

@mreiferson there could probably be a limit of messages per mpub.

Yes, definitely.

@yangyifeng01 thanks for the report!

@mreiferson mreiferson added the bug label Dec 15, 2016
@mreiferson mreiferson changed the title nsqd crashed after request /mpub?topic=test&binary=true nsqd: panic when sending garbage to binary /mpub Dec 15, 2016
@mreiferson
Copy link
Member

fixed in #835

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

Successfully merging a pull request may close this issue.

3 participants