Closed Nagaws closed 6 years ago
Hello @Nagaws! Thank you very much for your report, in some cases ETH transaction might fail to send and ETH node provide unexpectable response which is not handled properly by marketmaker. I will implement additional response verifications to avoid this crash.
we need to make sure all ETH side tx are completed properly and if not, to abort the swap. we also need to make sure that no matter at what step the swap is aborted that all ends well, ie. both sides get what they started with (or close to it) or the swap completes
@Nagaws there was a chance of null pointer referencing upon sending ETH transactions. This should be fixed now - changes were merged to jl777/SuperNET/dev branch.
Crash details, While undergoing BEER/EBR swap, found When order get connected I see, Order get struck at Bobdeposit and Found The debug Output as below
found mini.6 1.99343773 for targetval 1.00004999 -> targetval2 0.00131706, ratio 1.99 set inuse until 1519324633 lag.120 for cb4f80ba5432c5f679dccb6316cf188812e0a7ed5f286602fa45b5bfb68026a0/v1 set inuse until 1519324633 lag.120 for 4aff90960e9b247f8b36167d8e7ffe09f866f9ae5778caefff0a315da77d1aec/v1 LP_trade BEER/EBR 0.05002051 vol 1.00001000 dest.(0000000000000000000000000000000000000000000000000000000000000000) maxprice 20.02000000 etomicdest.(0x03d76a0329c441c8064825d1db8c172034f05cde)
. 1st refht BEER 79e1c975583838863abcd71933f4134ec231338ca4df6898c625aa0f5d18139d <- 14006, scan 0 0 . 1st refht ETOMIC 4aff90960e9b247f8b36167d8e7ffe09f866f9ae5778caefff0a315da77d1aec <- 6349, scan 0 0 2113 (1507254906 2888540503) request id.5749854903066034177 BEER/EBR 0.05002051 -> 1.00001000 (19.99199928) | RT.0 0 n169 2114 (543275228 2470591370) reserved id.5749854903066034177 BEER/EBR 0.20828532 -> 1.00001000 ( 4.80115449) | RT.0 0 n169 updated eae11b910c2392570b1616903ad3dcc88d2dad133588cd67ad3e6601523cff95/v0 BEER/EBR 20828532 price 4.80138501
received quote BEER/EBR 4.80138501 aliceid.5749854903066034177 got new bestprice 4.80138501 dynamictrust -0.20828532 (unconf 0.00000000) slowresponse.0 New priority.1 max_Reserved_msgs.2 2116 (543275228 2470591370) connect id.5749854903066034177 BEER/EBR 0.20828532 -> 1.00001000 ( 4.80115449) | RT.0 0 n169 2116 (543275228 1680505311) connected id.5749854903066034177 BEER/EBR 0.20828532 -> 1.00001000 ( 4.80115449) | RT.0 0 n169 alice ff1362b81c859ced6aebb2877b31007d3b62b3a37a339d3dbad39e25536af624 received CONNECTED.(5749854903066034177) CONNECTED ALICE CONNECTED numpending.0 tradeid.989474840 requestid.543275228 quoteid.1680505311 pairstr.tcp://51.255.38.28:24890 BEER/EBR bid 20.02000000 ask 0.00000000 values 0.00000000 0.00000000 LP_swapinit request.543275228 iambob.0 (BEER/EBR) quoteid.1680505311 jumblrflag.-2 <<<<<<<<< r.543275228 q.1680505311, 0.20827532 bobconfs.1, 1.00000000 aliceconfs.0 taddr.0 0 etomic src ( 0x012f7e74120d3d002e8f215ccc6f6f65618f00cb) dest (0x354ad7bd20ec1c8919a80d7ff40c854202301e78 0x03d76a0329c441c8064825d1db8c172034f05cde) alice pairstr.(tcp://51.255.38.28:24890) pairsock.2 pthread_t 8 [New Thread 0x7fffb7fff700 (LWP 27899)] start swap iamalice pair.2 send >>>>>>>>> r.543275228 q.1680505311 datalen.16046 MISMATCHED required confirms me.(0 1) vs (1 1) max.(6 6) othermax.(6 6) NUMCONFIRMS for SWAP alice.1 bob.1, otheristrusted.0 othertrusts.0 SEND pubA0/1 cbfb56e70ea3beed4f176a095ae920cad2ecd1334a4854b608d2a2eb78d991f3 CUT VERIFIED reset ETOMIC ap->utxos added 15 from ETOMIC listunspents dustcombine.0 numpre.1 min0.(nil) min1.(nil) numutxos.13 amount 1.00002999 preselected[0]: cb4f80ba5432c5f679dccb6316cf188812e0a7ed5f286602fa45b5bfb68026a0/v1 1.99343773 numunspents.13 vini.0 value 1.99343773, total 1.99343773 remains -0.99340774 interest 0.00000000 sum 0.00000000 cb4f80ba5432c5f679dccb6316cf188812e0a7ed5f286602fa45b5bfb68026a0/v1 set inuse until 1519325117 lag.600 for cb4f80ba5432c5f679dccb6316cf188812e0a7ed5f286602fa45b5bfb68026a0/v1 reset ETOMIC ap->utxos added 15 from ETOMIC listunspents dustcombine.0 numpre.1 min0.(nil) min1.(nil) numutxos.13 amount 0.00129700 preselected[0]: 4aff90960e9b247f8b36167d8e7ffe09f866f9ae5778caefff0a315da77d1aec/v1 0.09819297 numunspents.13 vini.0 value 0.09819297, total 0.09819297 remains -0.09689597 interest 0.00000000 sum 0.00000000 4aff90960e9b247f8b36167d8e7ffe09f866f9ae5778caefff0a315da77d1aec/v1 set inuse until 1519325117 lag.600 for 4aff90960e9b247f8b36167d8e7ffe09f866f9ae5778caefff0a315da77d1aec/v1 ETH txid received: 0x0000000000000000000000000000000000000000000000000000000000000000 0 wait for bobdeposit bDAeZVuvW8e3ZdnZj2XKC3SfGQsyMS7w5L numconfs.1 BEER 0cb3db7eec7e892a78b602e858b12e1f1d88df8f591eb697219353f7f5a30769 0 wait for bobdeposit bDAeZVuvW8e3ZdnZj2XKC3SfGQsyMS7w5L numconfs.1 BEER 0cb3db7eec7e892a78b602e858b12e1f1d88df8f591eb697219353f7f5a30769 [New Thread 0x7fffb77fe700 (LWP 27901)] [Thread 0x7fffb77fe700 (LWP 27901) exited] [New Thread 0x7fffb77fe700 (LWP 27902)] [Thread 0x7fffb77fe700 (LWP 27902) exited]
Thread 19 "marketmaker" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffb7fff700 (LWP 27899)] 0x0000000000621fcb in sendRawTx ( rawTx=rawTx@entry=0x7fffac5c2170 "0xf9012a3485174876e800830493e094e1d4236c5774d35dc47dcc2e5e0ccfc463a3289c80b8c4184db3bfcb4f80ba5432c5f679dccb6316cf188812e0a7ed5f286602fa45b5bfb68026a", '0' <repeats 50 times>, "d"...) at /root/SuperNET/iguana/exchanges/etomicswap/etomiccurl.c:86 86 char* tmp = cJSON_GetObjectItem(json, "result")->valuestring; (gdb) (gdb) (gdb) (gdb) (gdb) backtrace
#0 0x0000000000621fcb in sendRawTx ( rawTx=rawTx@entry=0x7fffac5c2170 "0xf9012a3485174876e800830493e094e1d4236c5774d35dc47dcc2e5e0ccfc463a3289c80b8c4184db3bfcb4f80ba5432c5f679dccb6316cf188812e0a7ed5f286602fa45b5bfb68026a", '0' <repeats 50 times>, "d"...) at /root/SuperNET/iguana/exchanges/etomicswap/etomiccurl.c:86 #1 0x00000000004dd584 in aliceSendsErc20Payment (input=..., txData=...) at /root/SuperNET/iguana/exchanges/etomicswap/etomiclib.cpp:103 #2 0x000000000042bae5 in LP_etomicalice_send_payment (swap=swap@entry=0x7fffb0003ad0) at /root/SuperNET/iguana/exchanges/LP_etomic.c:63 #3 0x000000000042d34e in sendEthTx (swap=swap@entry=0x7fffb0003ad0, rawtx=rawtx@entry=0x7fffb00139a0) at /root/SuperNET/iguana/exchanges/LP_etomic.c:353 #4 0x00000000004425c3 in LP_swapdata_rawtxsend (pairsock=2, swap=0x7fffb0003ad0, msgbits=4096, rawtx=0x7fffb00139a0, nextbits=2048, suppress_swapsend=0, maxlen=<optimized out>, data=<optimized out>) at /root/SuperNET/iguana/exchanges/LP_swap.c:701 #5 0x0000000000465e9f in LP_aliceloop (_swap=0x7fffb0003ad0) at /root/SuperNET/iguana/exchanges/LP_swap.c:919 #6 0x00007ffff796c6ba in start_thread (arg=0x7fffb7fff700) at pthread_create.c:333 #7 0x00007ffff6b8a41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109 (gdb)
Crash details, While undergoing BEER/EBR swap, found When order get connected I see, Order get struck at Bobdeposit and Found The debug Output as below
found mini.6 1.99343773 for targetval 1.00004999 -> targetval2 0.00131706, ratio 1.99 set inuse until 1519324633 lag.120 for cb4f80ba5432c5f679dccb6316cf188812e0a7ed5f286602fa45b5bfb68026a0/v1 set inuse until 1519324633 lag.120 for 4aff90960e9b247f8b36167d8e7ffe09f866f9ae5778caefff0a315da77d1aec/v1 LP_trade BEER/EBR 0.05002051 vol 1.00001000 dest.(0000000000000000000000000000000000000000000000000000000000000000) maxprice 20.02000000 etomicdest.(0x03d76a0329c441c8064825d1db8c172034f05cde)
Thread 19 "marketmaker" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffb7fff700 (LWP 27899)] 0x0000000000621fcb in sendRawTx ( rawTx=rawTx@entry=0x7fffac5c2170 "0xf9012a3485174876e800830493e094e1d4236c5774d35dc47dcc2e5e0ccfc463a3289c80b8c4184db3bfcb4f80ba5432c5f679dccb6316cf188812e0a7ed5f286602fa45b5bfb68026a", '0' <repeats 50 times>, "d"...) at /root/SuperNET/iguana/exchanges/etomicswap/etomiccurl.c:86 86 char* tmp = cJSON_GetObjectItem(json, "result")->valuestring; (gdb) (gdb) (gdb) (gdb) (gdb) backtrace `#0 0x0000000000621fcb in sendRawTx ( rawTx=rawTx@entry=0x7fffac5c2170 "0xf9012a3485174876e800830493e094e1d4236c5774d35dc47dcc2e5e0ccfc463a3289c80b8c4184db3bfcb4f80ba5432c5f679dccb6316cf188812e0a7ed5f286602fa45b5bfb68026a", '0' <repeats 50 times>, "d"...) at /root/SuperNET/iguana/exchanges/etomicswap/etomiccurl.c:86
1 0x00000000004dd584 in aliceSendsErc20Payment (input=..., txData=...) at /root/SuperNET/iguana/exchanges/etomicswap/etomiclib.cpp:103
2 0x000000000042bae5 in LP_etomicalice_send_payment (swap=swap@entry=0x7fffb0003ad0) at /root/SuperNET/iguana/exchanges/LP_etomic.c:63
3 0x000000000042d34e in sendEthTx (swap=swap@entry=0x7fffb0003ad0, rawtx=rawtx@entry=0x7fffb00139a0) at /root/SuperNET/iguana/exchanges/LP_etomic.c:353
4 0x00000000004425c3 in LP_swapdata_rawtxsend (pairsock=2, swap=0x7fffb0003ad0, msgbits=4096, rawtx=0x7fffb00139a0, nextbits=2048, suppress_swapsend=0, maxlen=, data=)
5 0x0000000000465e9f in LP_aliceloop (_swap=0x7fffb0003ad0) at /root/SuperNET/iguana/exchanges/LP_swap.c:919
6 0x00007ffff796c6ba in start_thread (arg=0x7fffb7fff700) at pthread_create.c:333
7 0x00007ffff6b8a41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
(gdb) `