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

fix: flaky tcp test #2369

Merged
merged 1 commit into from
Mar 7, 2024
Merged

fix: flaky tcp test #2369

merged 1 commit into from
Mar 7, 2024

Conversation

Green-Sky
Copy link
Member

@Green-Sky Green-Sky commented Jan 4, 2023

UPDATE: I am not pretty sure that the fail occurs when the creation of tcp sockets takes a while, because other processes need to run first. In my case its the firewall (eg opensnitch) which needs to check and allow the connection first.

Adding a sleep of 50ms after every tcp connection creation fixes the test case, but it might still point to real error, because waiting longer after the actions and before the asserts does not make it recover.


This change is Reviewable

@codecov
Copy link

codecov bot commented Jan 4, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.14%. Comparing base (32e67ab) to head (b03b571).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2369      +/-   ##
==========================================
+ Coverage   73.09%   73.14%   +0.04%     
==========================================
  Files         149      149              
  Lines       30516    30516              
==========================================
+ Hits        22305    22320      +15     
+ Misses       8211     8196      -15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Green-Sky
Copy link
Member Author

Green-Sky commented Mar 7, 2024

EDIT: ignore the trace, it is useless

Trace of new error
$ auto_tests/auto_TCP_test
[#0] DEBUG TCP_server.c:947	new_listening_tcp_socket:	successfully bound to TCP port 13215
[#0] DEBUG TCP_server.c:947	new_listening_tcp_socket:	successfully bound to TCP port 33445
[#0] DEBUG TCP_server.c:947	new_listening_tcp_socket:	successfully bound to TCP port 25643
[#0] DEBUG network.c:1957	net_connect:	connecting socket 6 to ::1:13215
[#0] DEBUG network.c:1957	net_connect:	connecting socket 6 to ::1:33445
[#0] DEBUG network.c:1957	net_connect:	connecting socket 6 to ::1:25643
[#0] TRACE network.c:799	loglogdata:	[30 = <unknown>            ] T=> 127= ::1:25643 (0: OK) | 90607ad6355dee13...c6
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 0
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 1
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 2
[#0] TRACE TCP_common.c:214	read_tcp_packet:	recv buffer has 127 bytes, but requested 128 bytes
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE network.c:799	loglogdata:	[3e = <unknown>            ] T=>   1= ::1:25643 (0: OK) | 0000000000000000...3e
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 0
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 1
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 2
[#0] TRACE network.c:799	loglogdata:	[30 = <unknown>            ] =>T 128= (IP invalid, family 0):0 (0: OK) | 90607ad6355dee13...3e
[#0] TRACE network.c:799	loglogdata:	[fb = <unknown>            ] T=>  96= (IP invalid, family 0):0 (0: OK) | def4bf2927f4b5d5...d2
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 0
[#0] TRACE network.c:799	loglogdata:	[fb = <unknown>            ] =>T  96= ::1:25643 (0: OK) | def4bf2927f4b5d5...d2
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>   4= ::1:25643 (0: OK) | 0000000000000000...54
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 0
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 1
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 0
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= (IP invalid, family 0):0 (0: OK) | 0000000000000000...31
[#0] TRACE TCP_common.c:214	read_tcp_packet:	recv buffer has 2 bytes, but requested 49 bytes
[#0] TRACE network.c:799	loglogdata:	[1e = <unknown>            ] T=>   2= ::1:25643 (0: OK) | 0000000000000000...b4
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 0
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 1
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 0
[#0] TRACE TCP_common.c:214	read_tcp_packet:	recv buffer has 4 bytes, but requested 49 bytes
[#0] TRACE network.c:799	loglogdata:	[2c = <unknown>            ] T=>   3= ::1:25643 (0: OK) | 0000000000000000...b4
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 0
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 1
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 0
[#0] TRACE TCP_common.c:214	read_tcp_packet:	recv buffer has 7 bytes, but requested 49 bytes
[#0] TRACE network.c:799	loglogdata:	[ae = <unknown>            ] T=>   1= ::1:25643 (0: OK) | 0000000000000000...ae
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 0
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 1
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 0
[#0] TRACE TCP_common.c:214	read_tcp_packet:	recv buffer has 8 bytes, but requested 49 bytes
[#0] TRACE network.c:799	loglogdata:	[8a = <unknown>            ] T=>   4= ::1:25643 (0: OK) | 0000000000000000...57
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 0
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 1
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 0
[#0] TRACE TCP_common.c:214	read_tcp_packet:	recv buffer has 12 bytes, but requested 49 bytes
[#0] TRACE network.c:799	loglogdata:	[ed = <unknown>            ] T=>   1= ::1:25643 (0: OK) | 0000000000000000...ed
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 0
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 1
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 0
[#0] TRACE TCP_common.c:214	read_tcp_packet:	recv buffer has 13 bytes, but requested 49 bytes
[#0] TRACE network.c:799	loglogdata:	[21 = LAN_DISCOVERY        ] T=>   2= ::1:25643 (0: OK) | 0000000000000000...15
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 0
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 1
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 0
[#0] TRACE TCP_common.c:214	read_tcp_packet:	recv buffer has 15 bytes, but requested 49 bytes
[#0] TRACE network.c:799	loglogdata:	[aa = <unknown>            ] T=>   3= ::1:25643 (0: OK) | 0000000000000000...ae
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 0
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 1
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 0
[#0] TRACE TCP_common.c:214	read_tcp_packet:	recv buffer has 18 bytes, but requested 49 bytes
[#0] TRACE network.c:799	loglogdata:	[cc = <unknown>            ] T=>   5= ::1:25643 (0: OK) | e70a507300000000...73
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 0
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 1
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 0
[#0] TRACE TCP_common.c:214	read_tcp_packet:	recv buffer has 23 bytes, but requested 49 bytes
[#0] TRACE network.c:799	loglogdata:	[a5 = <unknown>            ] T=>   2= ::1:25643 (0: OK) | 0000000000000000...94
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 0
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 1
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 0
[#0] TRACE TCP_common.c:214	read_tcp_packet:	recv buffer has 25 bytes, but requested 49 bytes
[#0] TRACE network.c:799	loglogdata:	[80 = ONION_SEND_INITIAL   ] T=>   3= ::1:25643 (0: OK) | 0000000000000000...af
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 0
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 1
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 0
[#0] TRACE TCP_common.c:214	read_tcp_packet:	recv buffer has 28 bytes, but requested 49 bytes
[#0] TRACE network.c:799	loglogdata:	[82 = ONION_SEND_2         ] T=>   3= ::1:25643 (0: OK) | 0000000000000000...84
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 0
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 1
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 0
[#0] TRACE TCP_common.c:214	read_tcp_packet:	recv buffer has 31 bytes, but requested 49 bytes
[#0] TRACE network.c:799	loglogdata:	[fe = <unknown>            ] T=>   1= ::1:25643 (0: OK) | 0000000000000000...fe
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 0
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 1
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 0
[#0] TRACE TCP_common.c:214	read_tcp_packet:	recv buffer has 32 bytes, but requested 49 bytes
[#0] TRACE network.c:799	loglogdata:	[16 = <unknown>            ] T=>   5= ::1:25643 (0: OK) | bb01c9ff00000000...ff
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 0
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 1
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 0
[#0] TRACE TCP_common.c:214	read_tcp_packet:	recv buffer has 37 bytes, but requested 49 bytes
[#0] TRACE network.c:799	loglogdata:	[de = <unknown>            ] T=>   4= ::1:25643 (0: OK) | 0000000000000000...53
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 0
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 1
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 0
[#0] TRACE TCP_common.c:214	read_tcp_packet:	recv buffer has 41 bytes, but requested 49 bytes
[#0] TRACE network.c:799	loglogdata:	[92 = FORWARD_REPLY        ] T=>   2= ::1:25643 (0: OK) | 0000000000000000...01
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 0
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 1
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 0
[#0] TRACE TCP_common.c:214	read_tcp_packet:	recv buffer has 43 bytes, but requested 49 bytes
[#0] TRACE network.c:799	loglogdata:	[09 = <unknown>            ] T=>   1= ::1:25643 (0: OK) | 0000000000000000...09
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 0
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 1
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 0
[#0] TRACE TCP_common.c:214	read_tcp_packet:	recv buffer has 44 bytes, but requested 49 bytes
[#0] TRACE network.c:799	loglogdata:	[d5 = <unknown>            ] T=>   2= ::1:25643 (0: OK) | 0000000000000000...d6
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 0
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 1
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 0
[#0] TRACE TCP_common.c:214	read_tcp_packet:	recv buffer has 46 bytes, but requested 49 bytes
[#0] TRACE network.c:799	loglogdata:	[fc = <unknown>            ] T=>   3= ::1:25643 (0: OK) | 0000000000000000...f6
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 0
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 1
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 0
[#0] TRACE network.c:799	loglogdata:	[51 = <unknown>            ] =>T  49= (IP invalid, family 0):0 (0: OK) | 541eb42c6db4ae8a...f6
[#0] TRACE TCP_server.c:690	handle_tcp_packet:	handling routing request for 0
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  52= (IP invalid, family 0):0 (0: OK) | 321e7735c7524ae4...80
[#0] TRACE TCP_server.c:1138	tcp_process_secure_packet:	processing packet for 0: 0
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T  52= ::1:25643 (0: OK) | 321e7735c7524ae4...80
<<<<<<<<<<<<<< start here
/home/green/workspace/tox/c-toxcore/auto_tests/TCP_test.c:608: failed `oob_data_callback_good == 1': OOB callback not called

not an expert on the tcp code, but it slowly fills up the buffer, while expecting more bytes.

@Green-Sky
Copy link
Member Author

found a rare potentially unrelated crash:

Details
$ auto_tests/auto_TCP_test
[#0] DEBUG TCP_server.c:947	new_listening_tcp_socket:	successfully bound to TCP port 13215
[#0] DEBUG TCP_server.c:947	new_listening_tcp_socket:	successfully bound to TCP port 33445
[#0] DEBUG TCP_server.c:947	new_listening_tcp_socket:	successfully bound to TCP port 25643
[#0] DEBUG network.c:1957	net_connect:	connecting socket 6 to ::1:13215
[#0] TRACE network.c:799	loglogdata:	[1b = CRYPTO_DATA          ] T=> 128= ::1:13215 (0: OK) | a1d05130d8287453...a4
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 0
[#0] TRACE network.c:799	loglogdata:	[1b = CRYPTO_DATA          ] =>T 128= (IP invalid, family 0):0 (0: OK) | a1d05130d8287453...a4
[#0] TRACE network.c:799	loglogdata:	[0d = <unknown>            ] T=>  96= (IP invalid, family 0):0 (0: OK) | 15047ad658f6743e...46
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 0
[#0] TRACE network.c:799	loglogdata:	[0d = <unknown>            ] =>T  96= ::1:13215 (0: OK) | 15047ad658f6743e...46
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  27= ::1:13215 (0: OK) | 19040ad420bde8a5...4c
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 0
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= (IP invalid, family 0):0 (0: OK) | 0000000000000000...19
[#0] TRACE network.c:799	loglogdata:	[04 = SEND_NODES_IPV6      ] =>T  25= (IP invalid, family 0):0 (0: OK) | 0ad420bde8a56a0c...4c
[#0] TRACE TCP_server.c:717	handle_tcp_packet:	handling ping for 0
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  27= (IP invalid, family 0):0 (0: OK) | 190cb945d646b61e...a4
[#0] TRACE TCP_server.c:1138	tcp_process_secure_packet:	processing packet for 0: 0
[#0] DEBUG network.c:1957	net_connect:	connecting socket 13 to ::1:33445
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= ::1:13215 (0: OK) | 0000000000000000...19
[#0] TRACE network.c:799	loglogdata:	[0c = <unknown>            ] =>T  25= ::1:13215 (0: OK) | b945d646b61ea36e...a4
[#0] TRACE network.c:791	loglogdata:	[38 = <unknown>            ] T=> 128E ::1:33445 (11: Resource temporarily unavailable) | a90a711affe1b227...e8
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 1
[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
[#0] TRACE TCP_server.c:1138	tcp_process_secure_packet:	processing packet for 0: 0
[#0] TRACE network.c:799	loglogdata:	[38 = <unknown>            ] T=> 128= ::1:33445 (0: OK) | a90a711affe1b227...e8
<<<<<<<<<<<<<< start here
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  56= ::1:33445 (0: OK) | 369408546b176b03...c8
sob conn2 1
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  51= ::1:13215 (0: OK) | 316cb67497e35313...bd
srr conn 1
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  51= ::1:33445 (0: OK) | 31bfe5df7bcd5763...49
srr conn2 1
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 1
[#0] TRACE network.c:799	loglogdata:	[38 = <unknown>            ] =>T 128= (IP invalid, family 0):0 (0: OK) | a90a711affe1b227...e8
[#0] TRACE network.c:799	loglogdata:	[17 = <unknown>            ] T=>  96= (IP invalid, family 0):0 (0: OK) | b548e4700ee292c7...e6
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 1
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= (IP invalid, family 0):0 (0: OK) | 0000000000000000...36
[#0] TRACE network.c:799	loglogdata:	[94 = DATA_SEARCH_RESPONSE ] =>T  54= (IP invalid, family 0):0 (0: OK) | 08546b176b0393b1...c8
[#0] ERROR TCP_common.c:311	read_packet_tcp_secure_connection:	decrypted length 15 does not match expected length 54
Aborting test program
Aborted (core dumped)

@Green-Sky
Copy link
Member Author

this is how a successful run looks like:

Details
$ nice auto_tests/auto_TCP_test
[#0] DEBUG TCP_server.c:947	new_listening_tcp_socket:	successfully bound to TCP port 13215
[#0] DEBUG TCP_server.c:947	new_listening_tcp_socket:	successfully bound to TCP port 33445
[#0] DEBUG TCP_server.c:947	new_listening_tcp_socket:	successfully bound to TCP port 25643
[#0] DEBUG network.c:1957	net_connect:	connecting socket 6 to ::1:25643
[#0] TRACE network.c:799	loglogdata:	[d8 = <unknown>            ] T=> 128= ::1:25643 (0: OK) | 63a8e5ac873338c9...70
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 0
[#0] TRACE network.c:799	loglogdata:	[d8 = <unknown>            ] =>T 128= (IP invalid, family 0):0 (0: OK) | 63a8e5ac873338c9...70
[#0] TRACE network.c:799	loglogdata:	[b0 = <unknown>            ] T=>  96= (IP invalid, family 0):0 (0: OK) | 31fb6456f6f74339...94
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 0
[#0] TRACE network.c:799	loglogdata:	[b0 = <unknown>            ] =>T  96= ::1:25643 (0: OK) | 31fb6456f6f74339...94
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  27= ::1:25643 (0: OK) | 19c725c83c4bbaf9...e0
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 0
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= (IP invalid, family 0):0 (0: OK) | 0000000000000000...19
[#0] TRACE network.c:799	loglogdata:	[c7 = <unknown>            ] =>T  25= (IP invalid, family 0):0 (0: OK) | 25c83c4bbaf92326...e0
[#0] TRACE TCP_server.c:717	handle_tcp_packet:	handling ping for 0
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  27= (IP invalid, family 0):0 (0: OK) | 193768089de4521e...86
[#0] TRACE TCP_server.c:1138	tcp_process_secure_packet:	processing packet for 0: 0
[#0] DEBUG network.c:1957	net_connect:	connecting socket 13 to ::1:13215
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= ::1:25643 (0: OK) | 0000000000000000...19
[#0] TRACE network.c:799	loglogdata:	[37 = <unknown>            ] =>T  25= ::1:25643 (0: OK) | 68089de4521e4b56...86
[#0] TRACE network.c:799	loglogdata:	[c5 = <unknown>            ] T=> 128= ::1:13215 (0: OK) | 2241ad026b473556...4c
[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 1
[#0] TRACE network.c:799	loglogdata:	[c5 = <unknown>            ] =>T 128= (IP invalid, family 0):0 (0: OK) | 2241ad026b473556...4c
[#0] TRACE network.c:799	loglogdata:	[5c = GC_LOSSY             ] T=>  96= (IP invalid, family 0):0 (0: OK) | a25d5296f8ca1136...68
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 1
[#0] TRACE TCP_server.c:1138	tcp_process_secure_packet:	processing packet for 0: 0
[#0] TRACE network.c:799	loglogdata:	[5c = GC_LOSSY             ] =>T  96= ::1:13215 (0: OK) | a25d5296f8ca1136...68
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  27= ::1:13215 (0: OK) | 191307214f1a136d...d6
<<<<<<<<<<<<<< start here
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  56= ::1:13215 (0: OK) | 36583aac532afc13...3c
sob conn2 1
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  51= ::1:25643 (0: OK) | 311749adf3838544...a6
srr conn 1
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  51= ::1:13215 (0: OK) | 31f8ca47877456e0...b8
srr conn2 1
[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 1
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= (IP invalid, family 0):0 (0: OK) | 0000000000000000...19
[#0] TRACE network.c:799	loglogdata:	[13 = <unknown>            ] =>T  25= (IP invalid, family 0):0 (0: OK) | 07214f1a136dd60b...d6
[#0] TRACE TCP_server.c:717	handle_tcp_packet:	handling ping for 3
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  27= (IP invalid, family 0):0 (0: OK) | 19dfcb5e50e6dfa4...34
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= (IP invalid, family 0):0 (0: OK) | 0000000000000000...31
[#0] TRACE network.c:799	loglogdata:	[17 = <unknown>            ] =>T  49= (IP invalid, family 0):0 (0: OK) | 49adf3838544bd3f...a6
[#0] TRACE TCP_server.c:1138	tcp_process_secure_packet:	processing packet for 0: 33
[#0] TRACE TCP_server.c:690	handle_tcp_packet:	handling routing request for 0
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  52= (IP invalid, family 0):0 (0: OK) | 3299b3ead3587572...f3
[#0] TRACE TCP_server.c:1138	tcp_process_secure_packet:	processing packet for 0: 0
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= (IP invalid, family 0):0 (0: OK) | 0000000000000000...36
[#0] TRACE network.c:799	loglogdata:	[58 = <unknown>            ] =>T  54= (IP invalid, family 0):0 (0: OK) | 3aac532afc139d62...3c
[#0] TRACE TCP_server.c:1138	tcp_process_secure_packet:	processing packet for 3: 38
[#0] TRACE TCP_server.c:752	handle_tcp_packet:	handling oob send for 3
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  56= (IP invalid, family 0):0 (0: OK) | 369642db5f2be229...c5
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= (IP invalid, family 0):0 (0: OK) | 0000000000000000...31
[#0] TRACE network.c:799	loglogdata:	[f8 = <unknown>            ] =>T  49= (IP invalid, family 0):0 (0: OK) | ca47877456e098d7...b8
[#0] TRACE TCP_server.c:1138	tcp_process_secure_packet:	processing packet for 3: 33
[#0] TRACE TCP_server.c:690	handle_tcp_packet:	handling routing request for 3
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  52= (IP invalid, family 0):0 (0: OK) | 3238e9a52a7fcdb2...1d
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  20= (IP invalid, family 0):0 (0: OK) | 12618b65558e4859...26
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  20= (IP invalid, family 0):0 (0: OK) | 12fde490b4031b04...97
[#0] TRACE TCP_server.c:1138	tcp_process_secure_packet:	processing packet for 3: 0
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= ::1:25643 (0: OK) | 0000000000000000...32
[#0] TRACE network.c:799	loglogdata:	[99 = <unknown>            ] =>T  50= ::1:25643 (0: OK) | b3ead35875729780...f3
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= ::1:25643 (0: OK) | 0000000000000000...36
[#0] TRACE network.c:799	loglogdata:	[96 = DATA_RETRIEVE_RESPONSE] =>T  54= ::1:25643 (0: OK) | 42db5f2be22986d9...c5
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= ::1:25643 (0: OK) | 0000000000000000...12
[#0] TRACE network.c:799	loglogdata:	[fd = <unknown>            ] =>T  18= ::1:25643 (0: OK) | e490b4031b04ce67...97
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= ::1:13215 (0: OK) | 0000000000000000...19
[#0] TRACE network.c:799	loglogdata:	[df = <unknown>            ] =>T  25= ::1:13215 (0: OK) | cb5e50e6dfa42c24...34
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= ::1:13215 (0: OK) | 0000000000000000...32
[#0] TRACE network.c:799	loglogdata:	[38 = <unknown>            ] =>T  50= ::1:13215 (0: OK) | e9a52a7fcdb2097b...1d
[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= ::1:13215 (0: OK) | 0000000000000000...12
[#0] TRACE network.c:799	loglogdata:	[61 = <unknown>            ] =>T  18= ::1:13215 (0: OK) | 8b65558e485966f4...26

@Green-Sky
Copy link
Member Author

Green-Sky commented Mar 7, 2024

fixed the rng and here is the diff between a successful run and a fail:

--- runfail1.txt	2024-03-07 14:51:26.525643885 +0100
+++ runsucc.txt	2024-03-07 14:51:06.842938060 +0100
@@ -1,42 +1,72 @@
 $ auto_tests/auto_TCP_test
 [#0] DEBUG TCP_server.c:947	new_listening_tcp_socket:	successfully bound to TCP port 13215
 [#0] DEBUG TCP_server.c:947	new_listening_tcp_socket:	successfully bound to TCP port 33445
 [#0] DEBUG TCP_server.c:947	new_listening_tcp_socket:	successfully bound to TCP port 25643
 [#0] DEBUG network.c:1957	net_connect:	connecting socket 6 to ::1:33445
 [#0] TRACE network.c:799	loglogdata:	[24 = <unknown>            ] T=> 128= ::1:33445 (0: OK) | 0f0d97658ead7a0f...67
 [#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 0
 [#0] TRACE network.c:799	loglogdata:	[24 = <unknown>            ] =>T 128= (IP invalid, family 0):0 (0: OK) | 0f0d97658ead7a0f...67
 [#0] TRACE network.c:799	loglogdata:	[55 = <unknown>            ] T=>  96= (IP invalid, family 0):0 (0: OK) | 5e05f0f2a5352257...2d
 [#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 0
 [#0] TRACE network.c:799	loglogdata:	[55 = <unknown>            ] =>T  96= ::1:33445 (0: OK) | 5e05f0f2a5352257...2d
 [#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  27= ::1:33445 (0: OK) | 19260fee4ef34458...1f
 [#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 0
 [#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= (IP invalid, family 0):0 (0: OK) | 0000000000000000...19
 [#0] TRACE network.c:799	loglogdata:	[26 = <unknown>            ] =>T  25= (IP invalid, family 0):0 (0: OK) | 0fee4ef34458c993...1f
 [#0] TRACE TCP_server.c:717	handle_tcp_packet:	handling ping for 0
 [#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  27= (IP invalid, family 0):0 (0: OK) | 19a15235169fbec4...cb
 [#0] TRACE TCP_server.c:1138	tcp_process_secure_packet:	processing packet for 0: 0
 [#0] DEBUG network.c:1957	net_connect:	connecting socket 13 to ::1:33445
 [#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= ::1:33445 (0: OK) | 0000000000000000...19
 [#0] TRACE network.c:799	loglogdata:	[a1 = <unknown>            ] =>T  25= ::1:33445 (0: OK) | 5235169fbec430f1...cb
-[#0] TRACE network.c:791	loglogdata:	[57 = <unknown>            ] T=> 128E ::1:33445 (11: Resource temporarily unavailable) | 422bb14bf9e54680...8a
+[#0] TRACE network.c:799	loglogdata:	[57 = <unknown>            ] T=> 128= ::1:33445 (0: OK) | 422bb14bf9e54680...8a
 [#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 1
-[#0] TRACE TCP_server.c:385	read_connection_handshake:	connection handshake is not ready yet
+[#0] TRACE network.c:799	loglogdata:	[57 = <unknown>            ] =>T 128= (IP invalid, family 0):0 (0: OK) | 422bb14bf9e54680...8a
+[#0] TRACE network.c:799	loglogdata:	[d2 = <unknown>            ] T=>  96= (IP invalid, family 0):0 (0: OK) | 726d18e950da70ca...15
+[#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 1
 [#0] TRACE TCP_server.c:1138	tcp_process_secure_packet:	processing packet for 0: 0
-[#0] TRACE network.c:799	loglogdata:	[57 = <unknown>            ] T=> 128= ::1:33445 (0: OK) | 422bb14bf9e54680...8a
+[#0] TRACE network.c:799	loglogdata:	[d2 = <unknown>            ] =>T  96= ::1:33445 (0: OK) | 726d18e950da70ca...15
+[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  27= ::1:33445 (0: OK) | 19105a8fcc40a8cb...5d
 <<<<<<<<<<<<<< start here
-[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  56= ::1:33445 (0: OK) | 36244303110a3f8f...d1
+[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  56= ::1:33445 (0: OK) | 36a1046c37b52550...7e
 sob conn2 1
 [#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  51= ::1:33445 (0: OK) | 315a8f49b3a39036...44
 srr conn 1
-[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  51= ::1:33445 (0: OK) | 31617933b8cf4d09...09
+[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  51= ::1:33445 (0: OK) | 319181538a199080...22
 srr conn2 1
-[#0] TRACE TCP_server.c:1074	do_incoming:	handling incoming TCP connection 1
-[#0] TRACE network.c:799	loglogdata:	[57 = <unknown>            ] =>T 128= (IP invalid, family 0):0 (0: OK) | 422bb14bf9e54680...8a
-[#0] TRACE network.c:799	loglogdata:	[d2 = <unknown>            ] T=>  96= (IP invalid, family 0):0 (0: OK) | 726d18e950da70ca...15
 [#0] TRACE TCP_server.c:1112	do_unconfirmed:	handling unconfirmed TCP connection 1
+[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= (IP invalid, family 0):0 (0: OK) | 0000000000000000...19
+[#0] TRACE network.c:799	loglogdata:	[10 = <unknown>            ] =>T  25= (IP invalid, family 0):0 (0: OK) | 5a8fcc40a8cba540...5d
+[#0] TRACE TCP_server.c:717	handle_tcp_packet:	handling ping for 3
+[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  27= (IP invalid, family 0):0 (0: OK) | 19f59dd151e997c8...6f
+[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= (IP invalid, family 0):0 (0: OK) | 0000000000000000...31
+[#0] TRACE network.c:799	loglogdata:	[5a = GC_HANDSHAKE         ] =>T  49= (IP invalid, family 0):0 (0: OK) | 8f49b3a39036aff4...44
+[#0] TRACE TCP_server.c:1138	tcp_process_secure_packet:	processing packet for 0: 33
+[#0] TRACE TCP_server.c:690	handle_tcp_packet:	handling routing request for 0
+[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  52= (IP invalid, family 0):0 (0: OK) | 325ec6825af21172...e7
+[#0] TRACE TCP_server.c:1138	tcp_process_secure_packet:	processing packet for 0: 0
 [#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= (IP invalid, family 0):0 (0: OK) | 0000000000000000...36
-[#0] TRACE network.c:799	loglogdata:	[24 = <unknown>            ] =>T  54= (IP invalid, family 0):0 (0: OK) | 4303110a3f8f8183...d1
-[#0] ERROR TCP_common.c:311	read_packet_tcp_secure_connection:	decrypted length 15 does not match expected length 54
-Aborting test program
-Aborted (core dumped)
+[#0] TRACE network.c:799	loglogdata:	[a1 = <unknown>            ] =>T  54= (IP invalid, family 0):0 (0: OK) | 046c37b52550cb09...7e
+[#0] TRACE TCP_server.c:1138	tcp_process_secure_packet:	processing packet for 3: 38
+[#0] TRACE TCP_server.c:752	handle_tcp_packet:	handling oob send for 3
+[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  56= (IP invalid, family 0):0 (0: OK) | 368fac8735926ab1...20
+[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= (IP invalid, family 0):0 (0: OK) | 0000000000000000...31
+[#0] TRACE network.c:799	loglogdata:	[91 = FORWARDING           ] =>T  49= (IP invalid, family 0):0 (0: OK) | 81538a1990805e3c...22
+[#0] TRACE TCP_server.c:1138	tcp_process_secure_packet:	processing packet for 3: 33
+[#0] TRACE TCP_server.c:690	handle_tcp_packet:	handling routing request for 3
+[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  52= (IP invalid, family 0):0 (0: OK) | 32ac530bde428601...3c
+[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  20= (IP invalid, family 0):0 (0: OK) | 12a726457fd8387f...06
+[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] T=>  20= (IP invalid, family 0):0 (0: OK) | 1215fa85b4f99b7b...3a
+[#0] TRACE TCP_server.c:1138	tcp_process_secure_packet:	processing packet for 3: 0
+[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= ::1:33445 (0: OK) | 0000000000000000...32
+[#0] TRACE network.c:799	loglogdata:	[5e = <unknown>            ] =>T  50= ::1:33445 (0: OK) | c6825af21172d71b...e7
+[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= ::1:33445 (0: OK) | 0000000000000000...36
+[#0] TRACE network.c:799	loglogdata:	[8f = <unknown>            ] =>T  54= ::1:33445 (0: OK) | ac8735926ab1dcdc...20
+[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= ::1:33445 (0: OK) | 0000000000000000...12
+[#0] TRACE network.c:799	loglogdata:	[15 = <unknown>            ] =>T  18= ::1:33445 (0: OK) | fa85b4f99b7bcdb2...3a
+[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= ::1:33445 (0: OK) | 0000000000000000...19
+[#0] TRACE network.c:799	loglogdata:	[f5 = <unknown>            ] =>T  25= ::1:33445 (0: OK) | 9dd151e997c837d5...6f
+[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= ::1:33445 (0: OK) | 0000000000000000...32
+[#0] TRACE network.c:799	loglogdata:	[ac = <unknown>            ] =>T  50= ::1:33445 (0: OK) | 530bde428601cfea...3c
+[#0] TRACE network.c:799	loglogdata:	[00 = PING_REQUEST         ] =>T   2= ::1:33445 (0: OK) | 0000000000000000...12
+[#0] TRACE network.c:799	loglogdata:	[a7 = <unknown>            ] =>T  18= ::1:33445 (0: OK) | 26457fd8387fb57b...06

@Green-Sky Green-Sky changed the title wip: trying to fix tcp auto test fix: flaky tcp test Mar 7, 2024
@Green-Sky Green-Sky marked this pull request as ready for review March 7, 2024 14:27
@Green-Sky Green-Sky modified the milestones: v0.2.20, v0.2.19 Mar 7, 2024
@Green-Sky Green-Sky force-pushed the fix_tests_1 branch 2 times, most recently from 0453f7f to 4f2c59b Compare March 7, 2024 16:08
Copy link
Member

@JFreegman JFreegman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r1.
Reviewable status: :shipit: complete! 1 of 1 approvals obtained

This only fixes the symptoms, not the real problem.
Sometimes or consistently on some platforms a socket might need a moment
before it can be written to.
@Green-Sky Green-Sky merged commit b03b571 into TokTok:master Mar 7, 2024
63 checks passed
@Green-Sky Green-Sky deleted the fix_tests_1 branch March 8, 2024 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants