Yes, you are right, Ben Pfaff. I wrote some debug code to measure the recursive 
level. And the deepest is only eleven.


------------------ ???????? ------------------
??????: "Ben Pfaff";<b...@ovn.org>;
????????: 2017??4??17??(??????) ????0:49
??????: "????????"<netbrea...@foxmail.com>; 
????: "ovs-dev"<ovs-dev@openvswitch.org>; 
????: Re:  ?????? [ovs-dev] Is there a non recursive version of json_destroy 
and json_serialize?



Large numbers of interfaces would not cause deep nesting, only large
messages.

On Sun, Apr 16, 2017 at 02:36:57PM +0800, ???????? wrote:
> Thanks for you reply!
> This problem occurred when I was running OpenSwitch on my embedded system. As 
> you know, the OpenSwitch use OVS as its control-plane. And It have much more 
> configurations. For example, there are more than one hundred interfaces. When 
> your program monitor this kind of messages, there will be a deeply nested 
> JSON.
> 
> 
> 
> 
> ------------------ ???????? ------------------
> ??????: "Ben Pfaff";<b...@ovn.org>;
> ????????: 2017??4??14??(??????) ????11:54
> ??????: "????????"<netbrea...@foxmail.com>; 
> ????: "ovs-dev"<ovs-dev@openvswitch.org>; 
> ????: Re: [ovs-dev] Is there a non recursive version of json_destroy 
> andjson_serialize?
> 
> 
> 
> It seems unlikely that recursion would be the problem, because OVS does
> not serialize deeply nested JSON.
> 
> On Fri, Apr 14, 2017 at 05:50:06PM +0800, ???????? wrote:
> > Hello, everyone!
> > I am trying to port openvswitch to MIPS64 platform. A segfault problem was 
> > occurred  when it was sending a huge json buffer between ovsdb-server and 
> > ovsdb-client through its monitor ALL command. I found that, in the OVS 
> > version I use, the json_destroy  and json_serialize function are recursive 
> > function.  I am deeply doubting the stack was overflowed by these operation.
> > I send this mail to see if anyone else have encountered this problem and is 
> > there a non recursive version of json_destroy and json_serialize? Or if 
> > anyone could give me some suggestion on how to resolve it?
> > The following are two typical call trace, and the ovsdb-server program core 
> > dumped at very different place every time.
> > 
> > 1.
> > Program terminated with signal SIGSEGV, Segmentation fault.
> > #0  0x000000fff464a154 in hmap_remove (node=0xfff36e89c0, 
> > hmap=0xfff36313c0) at 
> > /usr/src/debug/ops-openvswitch/git999-r0/lib/hmap.h:245
> > 245     /usr/src/debug/ops-openvswitch/git999-r0/lib/hmap.h: No such file 
> > or directory.
> > (gdb) bt
> > #0  0x000000fff464a154 in hmap_remove (node=0xfff36e89c0, 
> > hmap=0xfff36313c0) at 
> > /usr/src/debug/ops-openvswitch/git999-r0/lib/hmap.h:245
> > #1  shash_steal (sh=0xfff36313c0, node=0xfff36e89c0) at 
> > /usr/src/debug/ops-openvswitch/git999-r0/lib/shash.c:187
> > #2  0x000000fff464a1cc in shash_delete (sh=<optimized out>, node=<optimized 
> > out>) at /usr/src/debug/ops-openvswitch/git999-r0/lib/shash.c:176
> > #3  0x000000fff463ae34 in json_destroy_object (object=0xfff36313c0) at 
> > /usr/src/debug/ops-openvswitch/git999-r0/lib/json.c:386
> > #4  json_destroy (json=0xfff36313a0) at 
> > /usr/src/debug/ops-openvswitch/git999-r0/lib/json.c:352
> > #5  0x000000fff463ae24 in json_destroy_object (object=0xfff38e9420) at 
> > /usr/src/debug/ops-openvswitch/git999-r0/lib/json.c:385
> > #6  json_destroy (json=0xfff38e9400) at 
> > /usr/src/debug/ops-openvswitch/git999-r0/lib/json.c:352
> > #7  0x000000fff463ae24 in json_destroy_object (object=0xfff38cd600) at 
> > /usr/src/debug/ops-openvswitch/git999-r0/lib/json.c:385
> > #8  json_destroy (json=0xfff38cd620) at 
> > /usr/src/debug/ops-openvswitch/git999-r0/lib/json.c:352
> > #9  0x000000fff465e100 in jsonrpc_send (rpc=0xfff3832680, msg=<optimized 
> > out>) at /usr/src/debug/ops-openvswitch/git999-r0/lib/jsonrpc.c:261
> > #10 0x000000fff465ed30 in jsonrpc_session_send (s=<optimized out>, 
> > msg=<optimized out>)
> >     at /usr/src/debug/ops-openvswitch/git999-r0/lib/jsonrpc.c:1029
> > #11 0x000000fff43ee87c in ovsdb_jsonrpc_session_send 
> > (s=s@entry=0xfff3619e00, msg=0xfff36dd170)
> >     at /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/jsonrpc-server.c:1290
> > #12 0x000000fff43f2ac4 in ovsdb_jsonrpc_session_got_request 
> > (request=0xfff381cbd0, s=<optimized out>)
> >     at /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/jsonrpc-server.c:1256
> > #13 ovsdb_jsonrpc_session_run (s=<optimized out>) at 
> > /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/jsonrpc-server.c:523
> > #14 ovsdb_jsonrpc_session_run_all (remote=<optimized out>) at 
> > /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/jsonrpc-server.c:562
> > #15 ovsdb_jsonrpc_server_run (svr=0x0) at 
> > /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/jsonrpc-server.c:366
> > #16 0x0000000120005d60 in main_loop (exiting=0xffdfaaf8d0, run_process=0x0, 
> > remotes=0xffdfaaf888, unixctl=0x12010e4a0, all_dbs=0xffdfaaf818, 
> >     jsonrpc=0x0) at 
> > /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/ovsdb-server.c:161
> > #17 main (argc=1, argv=0x12fc19e90) at 
> > /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/ovsdb-server.c:357
> > 
> > 
> > 
> > (gdb) bt
> > #0  json_serialize (json=0x3fd28f747, s=s@entry=0xffdfecf5a0) at 
> > /usr/src/debug/ops-openvswitch/git999-r0/lib/json.c:1499
> > #1  0x000000ffe999a024 in json_serialize_array (s=0xffdfecf5a0, 
> > array=0xffe8818ec8)
> >     at /usr/src/debug/ops-openvswitch/git999-r0/lib/json.c:1617
> > #2  json_serialize (json=0xffe8818ec0, s=s@entry=0xffdfecf5a0) at 
> > /usr/src/debug/ops-openvswitch/git999-r0/lib/json.c:1517
> > #3  0x000000ffe9999c80 in json_serialize_object_member (i=i@entry=0, 
> > node=node@entry=0xffe8818d60, s=s@entry=0xffdfecf5a0)
> >     at /usr/src/debug/ops-openvswitch/git999-r0/lib/json.c:1563
> > #4  0x000000ffe9999e60 in json_serialize_object (s=0xffdfecf5a0, 
> > object=0xffe8818de0)
> >     at /usr/src/debug/ops-openvswitch/git999-r0/lib/json.c:1592
> > #5  json_serialize (json=<optimized out>, s=s@entry=0xffdfecf5a0)
> >     at /usr/src/debug/ops-openvswitch/git999-r0/lib/json.c:1513
> > #6  0x000000ffe999d210 in json_to_ds (json=<optimized out>, 
> > flags=<optimized out>, ds=<optimized out>)
> >     at /usr/src/debug/ops-openvswitch/git999-r0/lib/json.c:1491
> > #7  0x000000ffe99bde70 in jsonrpc_send (rpc=0xffe8c32680, msg=<optimized 
> > out>)
> >     at /usr/src/debug/ops-openvswitch/git999-r0/lib/jsonrpc.c:252
> > #8  0x000000ffe99be9a8 in jsonrpc_session_send (s=<optimized out>, 
> > msg=<optimized out>)
> >     at /usr/src/debug/ops-openvswitch/git999-r0/lib/jsonrpc.c:1013
> > #9  0x000000ffe974e87c in ovsdb_jsonrpc_session_send 
> > (s=s@entry=0xffe89b8600, msg=0xffe8a85060)
> >     at /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/jsonrpc-server.c:1290
> > #10 0x000000ffe9752ac4 in ovsdb_jsonrpc_session_got_request 
> > (request=0xffe8a85150, s=<optimized out>)
> >     at /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/jsonrpc-server.c:1256
> > #11 ovsdb_jsonrpc_session_run (s=<optimized out>) at 
> > /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/jsonrpc-server.c:523
> > #12 ovsdb_jsonrpc_session_run_all (remote=<optimized out>)
> >     at /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/jsonrpc-server.c:562
> > #13 ovsdb_jsonrpc_server_run (svr=0x0) at 
> > /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/jsonrpc-server.c:366
> > #14 0x0000000120005d3c in main_loop (exiting=0xffdfecf8b0, run_process=0x0, 
> > remotes=0xffdfecf868, unixctl=0x12010e4a0,
> >     all_dbs=0xffdfecf7f8, jsonrpc=0x0) at 
> > /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/ovsdb-server.c:161
> > #15 main (argc=1, argv=0x12cf24060) at 
> > /usr/src/debug/ops-openvswitch/git999-r0/ovsdb/ovsdb-server.c:357
> > _______________________________________________
> > dev mailing list
> > d...@openvswitch.org
> > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to