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

To avoid hanging test case, always mine until txpool empty #4122

Merged
merged 1 commit into from
Jun 8, 2023

Conversation

uwiger
Copy link
Member

@uwiger uwiger commented Mar 28, 2023

A hanging test case in aecore_forking_SUITE manifested as follows (from log on dev1):

2023-03-20 10:28:41.901 [debug] <0.490.0>@aec_tx_pool:handle_info:516 [0] Msg = {gproc_ps_event,top_changed,#{info => #{block_hash => <<114,42,102,250,120,216,158,150,151,209,220,100,185,192,153,20,249,237,156,11,213,4,213,39,41,244,113,193,54,248,50,76>>,block_type => micro,height => 23,prev_hash => <<4,71,42,121,145,171,133,228,235,139,54,1,23,155,118,132,157,2,51,178,4,14,179,109,33,38,40,55,151,2,123,242>>},sender => <0.498.0>,time => {1679,308121,901649}}}
2023-03-20 10:28:41.901 [debug] <0.497.0>@aec_block_generator:handle_info:119 ignored event top_changed
2023-03-20 10:28:41.906 [debug] <0.497.0>@aec_block_generator:handle_info:119 ignored event tx_received
2023-03-20 10:28:41.907 [debug] <0.498.0>@aec_conductor:handle_add_block:1368 insert_block -> {ok,true,{key_header,23,<<27,31,57,141,53,191,129,20,78,253,20,14,29,8,98,227,94,3,3,100,226,124,151,249,137,35,2,199,185,86,54,141>>,<<27,31,57,141,53,191,129,20,78,253,20,14,29,8,98,227,94,3,3,100,226,124,151,249,137,35,2,199,185,86,54,141>>,<<43,239,74,146,79,98,161,26,199,80,4,68,99,233,43,197,194,140,95,109,131,170,69,209,17,41,63,108,253,210,54,140>>,553713663,3750491570719023204,1679308120572,6,[190,427,486,818,1217,1320,2223,2486,3118,3270,3556,4783,5875,6868,8015,8740,8837,8937,10191,10380,10802,10958,11394,13110,13412,13700,14289,15796,18576,19883,20306,20389,21041,22980,25267,25441,26841,27648,30003,30201,31137,31584],<<172,242,11,25,225,183,174,210,42,187,82,216,134,39,154,216,75,144,177,200,25,173,70,9,101,4,58,20,21,84,115,110>>,<<40,25,191,50,209,111,19,239,98,126,125,211,15,133,93,12,13,125,167,137,94,138,27,55,23,50,106,33,28,222,180,102>>,<<0,0,2,169>>,#{consensus => aec_consensus_bitcoin_ng}},[]}
2023-03-20 10:28:41.907 [debug] <0.490.0>@aec_tx_pool:enter_tx_gc:809 Adding "<<140,204,61,43,...,95,218,251,162>>" for GC at 1023
2023-03-20 10:28:41.908 [debug] <0.490.0>@aec_tx_pool:handle_call:403 [840] Msg = {top_change,#{new_hash => <<251,93,75,66,148,247,129,117,161,132,143,189,3,125,140,124,128,62,73,182,188,239,117,44,16,181,211,140,94,180,88,14>>,new_height => 24,old_hash => <<114,42,102,250,120,216,158,150,151,209,220,100,185,192,153,20,249,237,156,11,213,4,213,39,41,244,113,193,54,248,50,76>>,old_height => 23,prev_new_hash => <<4,71,42,121,145,171,133,228,235,139,54,1,23,155,118,132,157,2,51,178,4,14,179,109,33,38,40,55,151,2,123,242>>,type => key}}
2023-03-20 10:28:41.908 [debug] <0.490.0>@aec_tx_pool:handle_info:516 [5] Msg = {gproc_ps_event,top_changed,#{info => #{block_hash => <<251,93,75,66,148,247,129,117,161,132,143,189,3,125,140,124,128,62,73,182,188,239,117,44,16,181,211,140,94,180,88,14>>,block_type => key,height => 24,prev_hash => <<4,71,42,121,145,171,133,228,235,139,54,1,23,155,118,132,157,2,51,178,4,14,179,109,33,38,40,55,151,2,123,242>>},sender => <0.498.0>,time => {1679,308121,908286}}}
2023-03-20 10:28:41.908 [debug] <0.497.0>@aec_block_generator:handle_info:119 ignored event top_changed
2023-03-20 10:28:41.908 [debug] <0.834.0>@aec_tx_pool:do_update_sync_top:722 do_update_sync_top(24,23,<0.490.0>), LocalTop = 24
2023-03-20 10:28:41.908 [debug] <0.490.0>@aec_tx_pool:handle_info:516 [2] Msg = {<0.834.0>,new_gc_height,24}
2023-03-20 10:28:41.909 [debug] <0.498.0>@aec_tx_pool:garbage_collect:247 garbage_collect()
2023-03-20 10:28:41.909 [debug] <0.490.0>@aec_tx_pool:handle_cast:500 [4] Msg = garbage_collect
2023-03-20 10:28:41.909 [debug] <0.837.0>@aec_tx_pool:do_update_sync_top:722 do_update_sync_top(24,24,<0.490.0>), LocalTop = 24
2023-03-20 10:28:41.909 [debug] <0.497.0>@aec_block_generator:handle_call:83 stop_generation
2023-03-20 10:28:41.909 [debug] <0.490.0>@aec_tx_pool:handle_info:516 [1] Msg = {<0.837.0>,new_gc_height,24}
2023-03-20 10:28:42.048 [debug] <0.490.0>@aec_tx_pool:handle_call:403 [12] Msg = {peek,infinity,all}
...

The assumption is that the preceding test case, mining exactly one microblock on dev2, didn't empty the mempool, after which, the following test case would wait endlessly (= until time trap) for its mempool to become empty.

This change ensures that dev2 keeps producing microblocks as long as there is something in its mempool.

@uwiger uwiger merged commit 3ff97ee into master Jun 8, 2023
@uwiger uwiger deleted the uw-forking-suite-timeout branch June 8, 2023 16:38
@dincho dincho added the release/ignore Ignore in the release notes label Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release/ignore Ignore in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants