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

TestRequestBlockBytesErrors: Various fixes #2928

Conversation

algonautshant
Copy link
Contributor

@algonautshant algonautshant commented Sep 21, 2021

Summary

The test TestRequestBlockBytesErrors has failed, and the reason is unidentifiable.
Various fixes are here, including more verbose error reporting to identify the issue when it occurs again.

  • Add waitgrop to ledger to wait before closing the ledger and blockQ when goroutines are using them.
  • In universalFetcher, return the error immediately in case of an error.
  • Proper closing of objects in TestRequestBlockBytesErrors, and more verbose error reporting.

The waitGroup is needed for the following situation:

in blockService.go listenForCatchupReq

When, immediately after calling bq.handleCatchupReq, BlockService.Stop() is called, blockQueue will be nil by the time blockQueue.getEncodedBlockCert is called.


0  0x0000000004e16846 in github.com/algorand/go-algorand/ledger.(*blockQueue).checkEntry
   at /Users/shantkarakashian/go/src/github.com/algorand/go-algorand/ledger/blockqueue.go:215
1  0x0000000004e174a9 in github.com/algorand/go-algorand/ledger.(*blockQueue).getEncodedBlockCert
   at /Users/shantkarakashian/go/src/github.com/algorand/go-algorand/ledger/blockqueue.go:295
2  0x0000000004e3a2a7 in github.com/algorand/go-algorand/ledger.(*Ledger).EncodedBlockCert
   at /Users/shantkarakashian/go/src/github.com/algorand/go-algorand/ledger/ledger.go:516
3  0x0000000004f46eed in github.com/algorand/go-algorand/rpcs.topicBlockBytes
   at /Users/shantkarakashian/go/src/github.com/algorand/go-algorand/rpcs/blockService.go:355
4  0x0000000004f45e1b in github.com/algorand/go-algorand/rpcs.(*BlockService).handleCatchupReq
   at /Users/shantkarakashian/go/src/github.com/algorand/go-algorand/rpcs/blockService.go:299
5  0x0000000004f45318 in github.com/algorand/go-algorand/rpcs.(*BlockService).listenForCatchupReq
   at /Users/shantkarakashian/go/src/github.com/algorand/go-algorand/rpcs/blockService.go:245

Test Plan

Test is enhanced.

@algonautshant algonautshant self-assigned this Sep 21, 2021
@algonautshant algonautshant linked an issue Sep 21, 2021 that may be closed by this pull request
@codecov-commenter
Copy link

codecov-commenter commented Sep 21, 2021

Codecov Report

Merging #2928 (b653bd2) into master (01d853f) will increase coverage by 0.02%.
The diff coverage is 57.14%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2928      +/-   ##
==========================================
+ Coverage   47.27%   47.30%   +0.02%     
==========================================
  Files         356      356              
  Lines       57239    57244       +5     
==========================================
+ Hits        27062    27081      +19     
+ Misses      27108    27100       -8     
+ Partials     3069     3063       -6     
Impacted Files Coverage Δ
rpcs/blockService.go 52.73% <0.00%> (-0.80%) ⬇️
catchup/universalFetcher.go 94.96% <100.00%> (+0.06%) ⬆️
ledger/roundlru.go 90.56% <0.00%> (-5.67%) ⬇️
network/wsNetwork.go 60.90% <0.00%> (ø)
ledger/acctupdates.go 63.09% <0.00%> (+0.59%) ⬆️
network/requestTracker.go 71.12% <0.00%> (+0.86%) ⬆️
catchup/peerSelector.go 100.00% <0.00%> (+1.04%) ⬆️
crypto/merkletrie/node.go 93.48% <0.00%> (+1.86%) ⬆️
crypto/merkletrie/trie.go 68.61% <0.00%> (+2.18%) ⬆️
cmd/algoh/blockWatcher.go 80.95% <0.00%> (+3.17%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 01d853f...b653bd2. Read the comment docs.

Copy link
Contributor

@tsachiherman tsachiherman left a comment

Choose a reason for hiding this comment

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

I'm not sure why the ledger need to be modfied. Wouldn't it be enough to have the wait group on the block service ? i.e. tsachiherman:tsachi/TestRequestBlockBytesErrors

@algonautshant
Copy link
Contributor Author

Yes, wait group is sufficient to be on the block service, as long as the block service is closed before the ledger service, which is already the case.
I will merge your change here.

algonautshant and others added 3 commits September 21, 2021 23:48
- Add waitgrop to ledger to wait before closing the ledger and blockQ when goroutines are using them.
- In universalFetcher, return the error immediately in case of an error.
- Proper closing of objects in TestRequestBlockBytesErrors, and more verbose error reporting.
@tsachiherman tsachiherman merged commit e4842fc into algorand:master Sep 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flaky test: TestRequestBlockBytesErrors
3 participants