nicolasff / webdis

A Redis HTTP interface with JSON output
https://webd.is
BSD 2-Clause "Simplified" License
2.82k stars 305 forks source link

Segfault when using redis MONITOR command via websockets #84

Open bneijt opened 10 years ago

bneijt commented 10 years ago

1) I've enabled websockets and started the latest webdis release. 2) I use Chrome to issue a MONITOR command via "http://localhost:8080/js/app.js" 3) I receive {"MONITOR":[true,"OK"]} back from webdis 4) I use another window to insert new data via HTTP http://127.0.0.1:7379/PUBLISH/updates/%22123%22

Expected result: see something happening on the websocket where I issues MONITOR

Actual result: I get a segfault in webdis:

$ gdb ./webdis
GNU gdb (GDB) 7.5.91.20130417-cvs-ubuntu
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/bram/program/os/webdis/webdis...done.
(gdb) run
Starting program: /home/bram/program/os/webdis/webdis 
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff73a9700 (LWP 26978)]
[New Thread 0x7ffff6ba8700 (LWP 26979)]
[New Thread 0x7ffff63a7700 (LWP 26980)]
[New Thread 0x7ffff5ba6700 (LWP 26981)]
[New Thread 0x7ffff53a5700 (LWP 26982)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff73a9700 (LWP 26978)]
0x000000000040b005 in json_wrap_redis_reply (cmd=0x7ffff0005dc0, r=0x7ffff0005f80) at formats/json.c:125
125         verb = calloc(cmd->argv_len[0]+1, 1);
(gdb) bt
#0  0x000000000040b005 in json_wrap_redis_reply (cmd=0x7ffff0005dc0, r=0x7ffff0005f80) at formats/json.c:125
#1  0x000000000040acfd in json_reply (c=0x7ffff0001d00, r=0x7ffff0005f80, privdata=0x7ffff0005dc0) at formats/json.c:34
#2  0x0000000000412b8c in __redisRunCallback (ac=0x7ffff0001d00, cb=0x7ffff73a8c90, reply=0x7ffff0005f80) at hiredis/async.c:244
#3  0x00000000004132aa in redisProcessCallbacks (ac=0x7ffff0001d00) at hiredis/async.c:442
#4  0x00000000004134a6 in redisAsyncHandleRead (ac=0x7ffff0001d00) at hiredis/async.c:506
#5  0x0000000000409684 in redisLibeventReadEvent (fd=30, event=2, arg=0x7ffff0001e30) at ./hiredis/adapters/libevent.h:15
#6  0x00007ffff7ba4744 in event_base_loop () from /usr/lib/x86_64-linux-gnu/libevent-2.0.so.5
#7  0x0000000000403442 in worker_main (p=0x627f40) at worker.c:156
#8  0x00007ffff7981f8e in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#9  0x00007ffff76abe1d in clone () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) quit
A debugging session is active.

    Inferior 1 [process 26974] will be killed.

Quit anyway? (y or n) n
Not confirmed.
(gdb) continue
Continuing.
[Thread 0x7ffff53a5700 (LWP 26982) exited]
[Thread 0x7ffff5ba6700 (LWP 26981) exited]
[Thread 0x7ffff63a7700 (LWP 26980) exited]
[Thread 0x7ffff6ba8700 (LWP 26979) exited]
[Thread 0x7ffff7fd3740 (LWP 26974) exited]

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.
(gdb) quit

My current runtime is: Linux roo 3.8.0-31-generic #46-Ubuntu SMP Tue Sep 10 20:03:44 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux git 11c1e60f5d22dde76a769e56b4c45fedaea86a87

nicolasff commented 10 years ago

Many thanks for this report, I will investigate the issue.