Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
0.11.0
-
None
-
None
-
1、debian: 9.4
glib:.2.50
thrift:0.11.0
---------------------------
2、i tested in centos7,the result is the same.
Description
1、using THRIFT_TYPE_BUFFERED_TRANSPORT to connect server. if read data is little (< 5M bytes) ,it is ok. if data is bigger ,my program is crashed.
gdb log--------------------------------------------------------------------------------------------------
0 0x00007ffff66c8448 in thrift_buffered_transport_read_slow (transport=<optimized out>, buf=0x7fffd504f010, len=23165572, error=0x7ffff0b53898)
at src/thrift/c_glib/transport/thrift_buffered_transport.c:101
#1 0x00007ffff66c5744 in thrift_transport_real_read_all (transport=0x7fffe8004040, buf=0x7fffd504f010, len=23165572, error=0x7ffff0b53898)
at src/thrift/c_glib/transport/thrift_transport.c:122
#2 0x00007ffff66c2598 in thrift_binary_protocol_read_binary (protocol=0x5555557f1a20, buf=0x7ffff0b53428, len=0x7ffff0b53434, error=0x7ffff0b53898)
at src/thrift/c_glib/protocol/thrift_binary_protocol.c:840
#3 0x0000555555589834 in val_read (object=0x55559e1b5e30, protocol=0x5555557f1a20, error=0x7ffff0b53898) at /mnt/hgfs/work/code/scdsvr/src/adbt_types.c:207
#4 0x000055555558acc9 in read_result_read (object=0x555559d37ac0, protocol=0x5555557f1a20, error=0x7ffff0b53898) at /mnt/hgfs/work/code/scdsvr/src/adbt_types.c:788
#5 0x000055555558d4f6 in result_read (object=0x7fffe8003e00, protocol=0x5555557f1a20, error=0x7ffff0b53898) at /mnt/hgfs/work/code/scdsvr/src/adbt_types.c:1951
#6 0x000055555557355e in actordb_client_recv_exec_sql (iface=0x55557d660a10, _return=0x7ffff0b53890, ire=0x7ffff0b538a0, error=0x7ffff0b53898)
at /mnt/hgfs/work/code/scdsvr/src/actordb.c:2314
#7 0x00005555555737f4 in actordb_client_exec_sql (iface=0x55557d660a10, _return=0x7ffff0b53890,
sql=0x7ffff0b53690 "ACTOR scd(54379f348dc39d6897dd9fbf6b3414d1)CREATE; SELECT DISTINCT * FROM marshal WHERE marshalKey='RPT_TABLE';", ire=0x7ffff0b538a0,
error=0x7ffff0b53898) at /mnt/hgfs/work/code/scdsvr/src/actordb.c:2382
#8 0x000055555557e3e6 in DB_exec (conn=0x7fffe8005a50, actortype=0x5555555bb004 "scd", actorname=0x7fffe811fd60 "54379f348dc39d6897dd9fbf6b3414d1",
sql=0x7ffff0b53900 "SELECT DISTINCT * FROM marshal WHERE marshalKey='RPT_TABLE';", bindingvals=0x0, return_rows=0x7ffff0b538e0)
at /mnt/hgfs/work/code/scdsvr/src/scd_db.c:588
#9 0x000055555557ef04 in DB_get_marshal_data (conn=0x5555557eb4a0, actorname=0x7fffe811fd60 "54379f348dc39d6897dd9fbf6b3414d1", marshalKey=0x5555555be1c7 "RPT_TABLE")
at /mnt/hgfs/work/code/scdsvr/src/scd_db.c:877
#10 0x00005555555af6f2 in get_marshal_data (conn=0x5555557eb4a0, actorname=0x7fffe811fd60 "54379f348dc39d6897dd9fbf6b3414d1", marshalKey=0x5555555be1c7 "RPT_TABLE",
format=0x5555555bdf39 "(a{iv})") at /mnt/hgfs/work/code/scdsvr/src/scd_dbus.c:772
#11 0x00005555555af999 in handle_get_rpt_table (user_data=0x7fffe8004fd0, rpt_table=0x7ffff0b53be0, parameters=0x55557d5df690)
at /mnt/hgfs/work/code/scdsvr/src/scd_dbus.c:832
#12 0x00005555555b7f53 in scd_method_call (connection=0x5555557f7060, sender=0x7fffdc004b40 ":1.68", object_path=0x7fffdc001da0 "/pts/scd/man",
interface_name=0x7fffdc002e60 "pts.scd.man", method_name=0x7fffdc002af0 "GetRptTable", parameters=0x55557d5df690, invocation=0x7fffdc005d60, user_data=0x0)
at /mnt/hgfs/work/code/scdsvr/src/scd_dbus.c:3092
#13 0x00007ffff6dfde6c in ?? () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#14 0x00007ffff71226aa in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#15 0x00007ffff7122a60 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#16 0x00007ffff7122d82 in g_main_loop_run () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#17 0x00005555555b8649 in scd_dbus_main_loop_thread (param=0x5555557d1640 <scdSvrT+32>) at /mnt/hgfs/work/code/scdsvr/src/scd_dbus.c:3305
#18 0x00007ffff79bb494 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#19 0x00007ffff63fcacf in clone () from /lib/x86_64-linux-gnu/libc.so.6
-----------------------------
2、using THRIFT_TYPE_FRAMED_TRANSPORT type to connect server.when write data to server ,my progam crash.
(gdb) bt
#0 thrift_framed_transport_flush (transport=<optimized out>, error=0x7fffffffcb68) at src/thrift/c_glib/transport/thrift_framed_transport.c:236
#1 0x0000555555573c51 in actordb_client_send_exec_sql_param (iface=0x55558d02e380,
sql=0x7fffffffc960 "ACTOR scd(54379f348dc39d6897dd9fbf6b3414d1)CREATE; INSERT INTO marshal VALUES(?1,?2,?3);", bindingvals=0x555580113f60, error=0x7fffffffcb68)
at /mnt/hgfs/work/code/scdsvr/src/actordb.c:2463
#2 0x00005555555742ee in actordb_client_exec_sql_param (iface=0x55558d02e380, _return=0x7fffffffcb60,
sql=0x7fffffffc960 "ACTOR scd(54379f348dc39d6897dd9fbf6b3414d1)CREATE; INSERT INTO marshal VALUES(?1,?2,?3);", bindingvals=0x555580113f60, ire=0x7fffffffcb70,
error=0x7fffffffcb68) at /mnt/hgfs/work/code/scdsvr/src/actordb.c:2624
#3 0x000055555557e3b3 in DB_exec (conn=0x55558d02dbd0, actortype=0x5555555bb004 "scd", actorname=0x555555d12310 "54379f348dc39d6897dd9fbf6b3414d1",
sql=0x7fffffffcbb0 "INSERT INTO marshal VALUES(?1,?2,?3);", bindingvals=0x555580113f60, return_rows=0x0) at /mnt/hgfs/work/code/scdsvr/src/scd_db.c:585
#4 0x000055555557ede9 in DB_insert_marshal_data (conn=0x5555557eb4a0, actorname=0x555555d12310 "54379f348dc39d6897dd9fbf6b3414d1", marshalKey=0x5555555bdc9f "RPT_TABLE",
marshalVariant=0x55558d02e290) at /mnt/hgfs/work/code/scdsvr/src/scd_db.c:853
#5 0x00005555555abd22 in db_update_scddb (scdfile=0x555555d121e0) at /mnt/hgfs/work/code/scdsvr/src/scd.c:2922
#6 0x00005555555ac4ee in scd_init (scdfile=0x555555d121e0) at /mnt/hgfs/work/code/scdsvr/src/scd.c:3054
#7 0x0000555555588ce4 in scdsvr_main_loop () at /mnt/hgfs/work/code/scdsvr/src/scd_svr.c:257
#8 0x0000555555589132 in main (argc=1, argv=0x7fffffffdfc8) at /mnt/hgfs/work/code/scdsvr/src/scd_svr.c:400
3、 when i used actordb ,the progam occured。and i report to actordb's author,buf he said it is thrift bug.
https://github.com/biokoda/actordb/issues/56
-------------------
4、the code connect to server.
// actordb->socket = g_object_new (THRIFT_TYPE_SOCKET,"hostname", hostname, "port", port,NULL);
// actordb->transport = g_object_new (THRIFT_TYPE_BUFFERED_TRANSPORT,"transport", actordb->socket,NULL);
/ actordb->protocol = g_object_new (THRIFT_TYPE_BINARY_PROTOCOL,"transport", actordb->transport,NULL);
actordb->socket = g_object_new (THRIFT_TYPE_SOCKET, "hostname", hostname,"port", port, NULL);
actordb->transport = g_object_new (THRIFT_TYPE_FRAMED_TRANSPORT,"transport", actordb->socket,NULL);
actordb->protocol = g_object_new (THRIFT_TYPE_BINARY_PROTOCOL,"transport", actordb->transport,NULL);