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

grpc-gw request is non-deterministic #703

Closed
2 of 4 tasks
tkxkd0159 opened this issue Oct 11, 2022 · 4 comments · Fixed by Finschia/ostracon#478
Closed
2 of 4 tasks

grpc-gw request is non-deterministic #703

tkxkd0159 opened this issue Oct 11, 2022 · 4 comments · Fixed by Finschia/ostracon#478
Assignees
Labels
A: bug Something isn't working

Comments

@tkxkd0159
Copy link
Member

tkxkd0159 commented Oct 11, 2022

Summary of Bug

The odd thing is that GetBlockByHash often fails with a Not Implemented error when requested as REST. There is no problem with gRPC. There seems to be a bug in grpc-gw as it often fails. (ref. #699)

Even I didn't change any code about LatestValidatorSet, it failed at #699 's latest commit

--- FAIL: TestIntegrationTestSuite (16.96s)
    service_test.go:31: setting up integration test suite
    network.go:174: acquiring test network lock
    network.go:179: created temporary directory: /tmp/TestIntegrationTestSuite2939229296/001/chain-eUzfDc3018637995
    network.go:188: preparing test network...
    network.go:382: starting test network...
    network.go:387: started test network
    --- FAIL: TestIntegrationTestSuite/TestLatestValidatorSet_GRPC (0.00s)
        --- FAIL: TestIntegrationTestSuite/TestLatestValidatorSet_GRPC/no_pagination (0.00s)
            service_test.go:199: 
                	Error Trace:	/home/runner/work/lbm-sdk/lbm-sdk/client/grpc/tmservice/service_test.go:199
                	            				/home/runner/work/lbm-sdk/lbm-sdk/client/grpc/tmservice/suite.go:91
                	Error:      	Received unexpected error:
                	            	rpc error: code = InvalidArgument desc = could not find voter params for height #16: invalid request
                	Test:       	TestIntegrationTestSuite/TestLatestValidatorSet_GRPC/no_pagination
        --- FAIL: TestIntegrationTestSuite/TestLatestValidatorSet_GRPC/with_pagination (0.00s)
            service_test.go:199: 
                	Error Trace:	/home/runner/work/lbm-sdk/lbm-sdk/client/grpc/tmservice/service_test.go:199
                	            				/home/runner/work/lbm-sdk/lbm-sdk/client/grpc/tmservice/suite.go:91
                	Error:      	Received unexpected error:
                	            	rpc error: code = InvalidArgument desc = could not find voter params for height #16: invalid request
                	Test:       	TestIntegrationTestSuite/TestLatestValidatorSet_GRPC/with_pagination
    --- FAIL: TestIntegrationTestSuite/TestLatestValidatorSet_GRPCGateway (0.02s)
        --- FAIL: TestIntegrationTestSuite/TestLatestValidatorSet_GRPCGateway/no_pagination (0.00s)
            service_test.go:232: 
                	Error Trace:	/home/runner/work/lbm-sdk/lbm-sdk/client/grpc/tmservice/service_test.go:232
                	            				/home/runner/work/lbm-sdk/lbm-sdk/client/grpc/tmservice/suite.go:91
                	Error:      	Received unexpected error:
                	            	unknown field "code" in tmservice.GetLatestValidatorSetResponse
                	Test:       	TestIntegrationTestSuite/TestLatestValidatorSet_GRPCGateway/no_pagination
        --- FAIL: TestIntegrationTestSuite/TestLatestValidatorSet_GRPCGateway/with_pagination (0.01s)
            service_test.go:232: 
                	Error Trace:	/home/runner/work/lbm-sdk/lbm-sdk/client/grpc/tmservice/service_test.go:232
                	            				/home/runner/work/lbm-sdk/lbm-sdk/client/grpc/tmservice/suite.go:91
                	Error:      	Received unexpected error:
                	            	unknown field "code" in tmservice.GetLatestValidatorSetResponse
                	Test:       	TestIntegrationTestSuite/TestLatestValidatorSet_GRPCGateway/with_pagination
    service_test.go:48: tearing down integration test suite
    network.go:512: cleaning up test network...
    network.go:535: finished cleaning up test network
    network.go:509: released test network lock
FAIL
FAIL	github.com/line/lbm-sdk/client/grpc/tmservice	17.755s

Currently, it seems that the issue has not been found because gRPC is mainly used, but similar issues may occur in other endpoints, so it needs to be tracked in the future.

Version

c8314f7

Steps to Reproduce


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@tkxkd0159 tkxkd0159 changed the title grpc-gw request is non-deterministic grpc-gw request is non-deterministic Oct 11, 2022
@tkxkd0159 tkxkd0159 changed the title grpc-gw request is non-deterministic grpc-gw request is non-deterministic Oct 11, 2022
@tkxkd0159 tkxkd0159 added the A: bug Something isn't working label Oct 11, 2022
@zemyblue
Copy link
Member

@tnasu
Copy link
Member

tnasu commented Oct 13, 2022

I found it again.

--- FAIL: TestIntegrationTestSuite (16.91s)
    service_test.go:32: setting up integration test suite
    network.go:174: acquiring test network lock
    network.go:179: created temporary directory: /tmp/TestIntegrationTestSuite2125720976/001/chain-YFc4QI3772383345
    network.go:188: preparing test network...
    network.go:382: starting test network...
    network.go:387: started test network
    --- FAIL: TestIntegrationTestSuite/TestQueryLatestValidatorSet (0.02s)
        service_test.go:172: 
            	Error Trace:	/home/runner/work/lbm-sdk/lbm-sdk/client/grpc/tmservice/service_test.go:172
            	Error:      	Received unexpected error:
            	            	unknown field "code" in tmservice.GetLatestValidatorSetResponse
            	Test:       	TestIntegrationTestSuite/TestQueryLatestValidatorSet
    service_test.go:49: tearing down integration test suite
    network.go:512: cleaning up test network...
    network.go:535: finished cleaning up test network
    network.go:509: released test network lock
FAIL
FAIL	github.com/line/lbm-sdk/client/grpc/tmservice	17.604s

@tnasu
Copy link
Member

tnasu commented Oct 17, 2022

Ostracon's process of storing(save and Bootstrap) this Block-related information has no locks. So calling RPC Validators during the save process will return error depending on the timing.

@tnasu
Copy link
Member

tnasu commented Dec 6, 2022

The root cause is in Finschia/ostracon#478

  • Validators of RPC depend on LoadVoters
  • But,
    • Save the state with the committed height on Ostracon
      • Validators
      • LastProofHash
      • LastVotersParams
    • Save the state with the uncommitted height on Ostracon
      • NextValidators
  • Then getting Validators via RPC:
    • Can get it with the committed height
    • Make an error if getting with the uncommitted height

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: bug Something isn't working
Projects
None yet
3 participants