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

data race detected #8923

Closed
4 tasks
alessio opened this issue Mar 18, 2021 · 7 comments · Fixed by #8934
Closed
4 tasks

data race detected #8923

alessio opened this issue Mar 18, 2021 · 7 comments · Fixed by #8934
Assignees
Labels
Milestone

Comments

@alessio
Copy link
Contributor

alessio commented Mar 18, 2021

Data races were detected in 2 packages:

$ go test -mod=readonly -timeout 30m -race -tags='cgo ledger test_ledger_mock' ./x/auth/client/...
ok  	github.com/cosmos/cosmos-sdk/x/auth/client	0.513s
ok  	github.com/cosmos/cosmos-sdk/x/auth/client/cli	91.857s
==================
WARNING: DATA RACE
Write at 0x00c00011ea80 by goroutine 179:
  container/list.(*List).move()
      /usr/local/go/src/container/list/list.go:128 +0x39d
  container/list.(*List).MoveToFront()
      /usr/local/go/src/container/list/list.go:188 +0x23f
  github.com/hashicorp/golang-lru/simplelru.(*LRU).Get()
      /home/alessio/go/pkg/mod/github.com/hashicorp/golang-lru@v0.5.4/simplelru/lru.go:75 +0xed
  github.com/cosmos/cosmos-sdk/types.AccAddress.String()
      /home/alessio/work/cosmos-sdk/types/address.go:272 +0x16f
  github.com/cosmos/cosmos-sdk/x/bank/keeper.BaseSendKeeper.SendCoins()
      /home/alessio/work/cosmos-sdk/x/bank/keeper/send.go:137 +0xcd
  github.com/cosmos/cosmos-sdk/x/bank/keeper.BaseKeeper.SendCoinsFromAccountToModule()
      /home/alessio/work/cosmos-sdk/x/bank/keeper/keeper.go:314 +0x213
  github.com/cosmos/cosmos-sdk/x/bank/keeper.(*BaseKeeper).SendCoinsFromAccountToModule()
      <autogenerated>:1 +0x1ba
  github.com/cosmos/cosmos-sdk/x/auth/ante.DeductFees()
      /home/alessio/work/cosmos-sdk/x/auth/ante/fee.go:107 +0x177
  github.com/cosmos/cosmos-sdk/x/feegrant/ante.DeductGrantedFeeDecorator.AnteHandle()
      /home/alessio/work/cosmos-sdk/x/feegrant/ante/fee.go:76 +0x3d0
  github.com/cosmos/cosmos-sdk/x/feegrant/ante.(*DeductGrantedFeeDecorator).AnteHandle()
      <autogenerated>:1 +0x19e
  github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1()
      /home/alessio/work/cosmos-sdk/types/handler.go:40 +0x1d7
  github.com/cosmos/cosmos-sdk/x/auth/ante.ConsumeTxSizeGasDecorator.AnteHandle()
      /home/alessio/work/cosmos-sdk/x/auth/ante/basic.go:142 +0x2bb
  github.com/cosmos/cosmos-sdk/x/auth/ante.(*ConsumeTxSizeGasDecorator).AnteHandle()
      <autogenerated>:1 +0x184
  github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1()
      /home/alessio/work/cosmos-sdk/types/handler.go:40 +0x1d7
  github.com/cosmos/cosmos-sdk/x/auth/ante.ValidateMemoDecorator.AnteHandle()
      /home/alessio/work/cosmos-sdk/x/auth/ante/basic.go:66 +0x38c
  github.com/cosmos/cosmos-sdk/x/auth/ante.(*ValidateMemoDecorator).AnteHandle()
      <autogenerated>:1 +0x184
  github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1()
      /home/alessio/work/cosmos-sdk/types/handler.go:40 +0x1d7
  github.com/cosmos/cosmos-sdk/x/auth/ante.TxTimeoutHeightDecorator.AnteHandle()
      /home/alessio/work/cosmos-sdk/x/auth/ante/basic.go:199 +0x18c
  github.com/cosmos/cosmos-sdk/x/auth/ante.(*TxTimeoutHeightDecorator).AnteHandle()
      <autogenerated>:1 +0x11e
  github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1()
      /home/alessio/work/cosmos-sdk/types/handler.go:40 +0x1d7
  github.com/cosmos/cosmos-sdk/x/auth/ante.ValidateBasicDecorator.AnteHandle()
      /home/alessio/work/cosmos-sdk/x/auth/ante/basic.go:34 +0x1cc
  github.com/cosmos/cosmos-sdk/x/auth/ante.(*ValidateBasicDecorator).AnteHandle()
      <autogenerated>:1 +0x11e
  github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1()
      /home/alessio/work/cosmos-sdk/types/handler.go:40 +0x1d7
  github.com/cosmos/cosmos-sdk/x/auth/ante.MempoolFeeDecorator.AnteHandle()
      /home/alessio/work/cosmos-sdk/x/auth/ante/fee.go:54 +0x1db
  github.com/cosmos/cosmos-sdk/x/auth/ante.(*MempoolFeeDecorator).AnteHandle()
      <autogenerated>:1 +0x11e
  github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1()
      /home/alessio/work/cosmos-sdk/types/handler.go:40 +0x1d7
  github.com/cosmos/cosmos-sdk/x/auth/ante.RejectExtensionOptionsDecorator.AnteHandle()
      /home/alessio/work/cosmos-sdk/x/auth/ante/ext.go:35 +0x12d
  github.com/cosmos/cosmos-sdk/x/auth/ante.(*RejectExtensionOptionsDecorator).AnteHandle()
      <autogenerated>:1 +0x11e
  github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1()
      /home/alessio/work/cosmos-sdk/types/handler.go:40 +0x1d7
  github.com/cosmos/cosmos-sdk/x/auth/ante.SetUpContextDecorator.AnteHandle()
      /home/alessio/work/cosmos-sdk/x/auth/ante/setup.go:64 +0x58c
  github.com/cosmos/cosmos-sdk/x/auth/ante.(*SetUpContextDecorator).AnteHandle()
      <autogenerated>:1 +0x11e
  github.com/cosmos/cosmos-sdk/types.ChainAnteDecorators.func1()
      /home/alessio/work/cosmos-sdk/types/handler.go:40 +0x1d7
  github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).runTx()
      /home/alessio/work/cosmos-sdk/baseapp/baseapp.go:632 +0xa8a
  github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).CheckTx()
      /home/alessio/work/cosmos-sdk/baseapp/abci.go:229 +0x205
  github.com/cosmos/cosmos-sdk/simapp.(*SimApp).CheckTx()
      <autogenerated>:1 +0xde
  github.com/tendermint/tendermint/abci/client.(*localClient).CheckTxAsync()
      /home/alessio/go/pkg/mod/github.com/tendermint/tendermint@v0.34.8/abci/client/local_client.go:98 +0x148
  github.com/tendermint/tendermint/proxy.(*appConnMempool).CheckTxAsync()
      /home/alessio/go/pkg/mod/github.com/tendermint/tendermint@v0.34.8/proxy/app_conn.go:126 +0x7a
  github.com/tendermint/tendermint/mempool.(*CListMempool).CheckTx()
      /home/alessio/go/pkg/mod/github.com/tendermint/tendermint@v0.34.8/mempool/clist_mempool.go:288 +0x48e
  github.com/tendermint/tendermint/mempool.(*Reactor).Receive()
      /home/alessio/go/pkg/mod/github.com/tendermint/tendermint@v0.34.8/mempool/reactor.go:183 +0x432
  github.com/tendermint/tendermint/p2p.createMConnection.func1()
      /home/alessio/go/pkg/mod/github.com/tendermint/tendermint@v0.34.8/p2p/peer.go:390 +0x383
  github.com/tendermint/tendermint/p2p/conn.(*MConnection).recvRoutine()
      /home/alessio/go/pkg/mod/github.com/tendermint/tendermint@v0.34.8/p2p/conn/connection.go:646 +0x82c

Previous read at 0x00c00011ea80 by goroutine 109:
  [failed to restore the stack]

Goroutine 179 (running) created at:
  github.com/tendermint/tendermint/p2p/conn.(*MConnection).OnStart()
      /home/alessio/go/pkg/mod/github.com/tendermint/tendermint@v0.34.8/p2p/conn/connection.go:231 +0x36b
  github.com/tendermint/tendermint/libs/service.(*BaseService).Start()
      /home/alessio/go/pkg/mod/github.com/tendermint/tendermint@v0.34.8/libs/service/service.go:140 +0x55e
  github.com/tendermint/tendermint/p2p.(*peer).OnStart()
      /home/alessio/go/pkg/mod/github.com/tendermint/tendermint@v0.34.8/p2p/peer.go:182 +0x58
  github.com/tendermint/tendermint/libs/service.(*BaseService).Start()
      /home/alessio/go/pkg/mod/github.com/tendermint/tendermint@v0.34.8/libs/service/service.go:140 +0x55e
  github.com/tendermint/tendermint/p2p.(*peer).Start()
      <autogenerated>:1 +0x44
  github.com/tendermint/tendermint/p2p.(*Switch).addPeer()
      /home/alessio/go/pkg/mod/github.com/tendermint/tendermint@v0.34.8/p2p/switch.go:815 +0x32a
  github.com/tendermint/tendermint/p2p.(*Switch).addOutboundPeerWithConfig()
      /home/alessio/go/pkg/mod/github.com/tendermint/tendermint@v0.34.8/p2p/switch.go:751 +0x72a
  github.com/tendermint/tendermint/p2p.(*Switch).DialPeerWithAddress()
      /home/alessio/go/pkg/mod/github.com/tendermint/tendermint@v0.34.8/p2p/switch.go:544 +0x1ba
  github.com/tendermint/tendermint/p2p.(*Switch).dialPeersAsync.func1()
      /home/alessio/go/pkg/mod/github.com/tendermint/tendermint@v0.34.8/p2p/switch.go:519 +0x2c6

Goroutine 109 (running) created at:
  testing.(*T).Run()
      /usr/local/go/src/testing/testing.go:1239 +0x5d7
  github.com/stretchr/testify/suite.(*Suite).Run()
      /home/alessio/go/pkg/mod/github.com/stretchr/testify@v1.7.0/suite/suite.go:75 +0x17c
  github.com/cosmos/cosmos-sdk/x/auth/client/rest_test.(*IntegrationTestSuite).TestMultipleSyncBroadcastTxRequests()
      /home/alessio/work/cosmos-sdk/x/auth/client/rest/rest_test.go:291 +0x31a
  runtime.call16()
      /usr/local/go/src/runtime/asm_amd64.s:550 +0x3d
  reflect.Value.Call()
      /usr/local/go/src/reflect/value.go:337 +0xd8
  github.com/stretchr/testify/suite.Run.func1()
      /home/alessio/go/pkg/mod/github.com/stretchr/testify@v1.7.0/suite/suite.go:158 +0x391
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1194 +0x202
==================
--- FAIL: TestIntegrationTestSuite (38.73s)
    rest_test.go:45: setting up integration test suite
    network.go:171: acquiring test network lock
    network.go:176: created temporary directory: /tmp/TestIntegrationTestSuite3233055087/001/chain-u8JTXu503158573
    network.go:185: preparing test network...
    network.go:372: starting test network...
    network.go:377: started test network
    --- FAIL: TestIntegrationTestSuite/TestMultipleSyncBroadcastTxRequests (0.56s)
        --- FAIL: TestIntegrationTestSuite/TestMultipleSyncBroadcastTxRequests/Case_Second_tx_(correct_sequence) (0.19s)
            testing.go:1093: race detected during execution of test
        testing.go:1093: race detected during execution of test
    rest_test.go:83: tearing down integration test suite
    network.go:464: cleaning up test network...
    network.go:487: finished cleaning up test network
    network.go:461: released test network lock
    testing.go:1093: race detected during execution of test
FAIL
FAIL	github.com/cosmos/cosmos-sdk/x/auth/client/rest	39.203s
?   	github.com/cosmos/cosmos-sdk/x/auth/client/testutil	[no test files]
FAIL
alessio@phoenix:~/work/cosmos-sdk$ go test -mod=readonly -timeout 30m -race -tags='cgo ledger test_ledger_mock' ./simapp/simd/cmd/...
Error: failed to parse log level (main:info,state:info,statesync:info,*:error): Unknown Level String: 'main:info,state:info,statesync:info,*:error', defaulting to NoLevel
Usage:
  simd init [moniker] [flags]

Flags:
      --chain-id string   genesis file chain-id, if left blank will be randomly created
  -h, --help              help for init
  -o, --overwrite         overwrite the genesis.json file
      --recover           provide seed phrase to recover existing key instead of creating

Global Flags:
      --home string         directory for config and data (default "/home/alessio/.simapp")
      --log_format string   The logging format (json|plain) (default "plain")
      --log_level string    The logging level (trace|debug|info|warn|error|fatal|panic) (default "info")
      --trace               print out full stack trace on errors

--- FAIL: TestInitCmd (0.02s)
    cmd_test.go:23: 
        	Error Trace:	cmd_test.go:23
        	Error:      	Received unexpected error:
        	            	failed to parse log level (main:info,state:info,statesync:info,*:error): Unknown Level String: 'main:info,state:info,statesync:info,*:error', defaulting to NoLevel
        	Test:       	TestInitCmd
{"app_message":{"genutil":{"gen_txs":[]}},"chain_id":"test-chain-gbuhs1","gentxs_dir":"","moniker":"appnode-test","node_id":"0a0714b7c48cb0dd7867299ed4b179d3de6bb898"}
Error: failed to get address from Keybase: The specified item could not be found in the keyring
Usage:
  add-genesis-account [address_or_key_name] [coin][,[coin]] [flags]

Flags:
      --height int               Use a specific height to query state at (this can error if the node is pruning state)
  -h, --help                     help for add-genesis-account
      --home string              The application home directory (default "/tmp/TestAddGenesisAccountCmd_invalid_address1926786926/001")
      --keyring-backend string   Select keyring's backend (os|file|kwallet|pass|test) (default "os")
      --node string              <host>:<port> to Tendermint RPC interface for this chain (default "tcp://localhost:26657")
  -o, --output string            Output format (text|json) (default "text")
      --vesting-amount string    amount of coins for vesting accounts
      --vesting-end-time int     schedule end time (unix epoch) for vesting accounts
      --vesting-start-time int   schedule start time (unix epoch) for vesting accounts

{"app_message":{"genutil":{"gen_txs":[]}},"chain_id":"test-chain-dQceaZ","gentxs_dir":"","moniker":"appnode-test","node_id":"6f590ed0f678195110190d41d190d9acd6a19ff3"}
{"app_message":{"genutil":{"gen_txs":[]}},"chain_id":"test-chain-kvWa6f","gentxs_dir":"","moniker":"appnode-test","node_id":"4f25302944daa95b763047061ba7bc54400a530d"}
FAIL
FAIL	github.com/cosmos/cosmos-sdk/simapp/simd/cmd	0.480s
FAIL

For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@alessio alessio added the T:Bug label Mar 18, 2021
@alessio
Copy link
Contributor Author

alessio commented Mar 18, 2021

@marbar3778 the second error is something that I stumbled upon in real life:

Error: failed to parse log level (main:info,state:info,statesync:info,*:error): Unknown Level String: 'main:info,state:info,statesync:info,*:error', defaulting to NoLevel
Usage:
  simd init [moniker] [flags]

@alessio
Copy link
Contributor Author

alessio commented Mar 18, 2021

cc @odeke-em

@odeke-em
Copy link
Collaborator

Thanks for the tag @alessio. I'll tag @robert-zaremba per PR #8717 in which he looked at this related issue #8717 (comment)

@robert-zaremba robert-zaremba self-assigned this Mar 18, 2021
@alexanderbez
Copy link
Contributor

We already removed that in Tendermint, the default is info. I think we need to backport a PR @marbar3778 ?

@tac0turtle
Copy link
Member

we backported the right pr already, but somewhere its generating the old config

@alessio
Copy link
Contributor Author

alessio commented Mar 18, 2021

@alexanderbez @marbar3778 I believe that the wrong config template has nothing to do with the data race. I'll fork a new issue to tackle that separately.

@tac0turtle
Copy link
Member

After testing multiple log_level configurations with tendermint even

# Output level for logging, including package level options
log_level = "main:info,state:info,statesync:info,*:error"

This issue

Error: failed to parse log level (main:info,state:info,statesync:info,*:error): Unknown Level String: 'main:info,state:info,statesync:info,*:error', defaulting to NoLevel
Usage:
  simd init [moniker] [flags]

Does not seem to be a Tendermint issue but an SDK issue.

@mergify mergify bot closed this as completed in #8934 Mar 19, 2021
mergify bot pushed a commit that referenced this issue Mar 19, 2021
mergify bot pushed a commit that referenced this issue Mar 19, 2021
Closes: #8923
(cherry picked from commit 7b09f95)

# Conflicts:
#	x/authz/client/cli/tx_test.go
#	x/authz/client/rest/grpc_query_test.go
alessio pushed a commit that referenced this issue Mar 19, 2021
Closes: #8923
(cherry picked from commit 7b09f95)
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
@robert-zaremba robert-zaremba added this to the v0.43 milestone Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants