Skip to content

[Bug]: Data race when querying gRPC directly #22368

Open
@corverroos

Description

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

We at omni enabled direct gRPC based queries of application state (previously we queried via CometBFT). We have a go unit test that runs a single validator, while quering state using gRPC directly. When run with -race the tests fails with "WARNING: DATA RACE". See stack trace below.

It seems like the cause is one or more fields in BaseApp that are not protected by a mutex, yet are written-to by the ABCI goroutine and read-from gRPC query goroutines. The stack trace shows that checkState is written-to in Commit, and read-from in CreateQueryContext. There may be more fields though.

As a workaround, we only these tests without -race.

Cosmos SDK Version

v0.50.10

How to reproduce?

Run this test but remove the -race build flag and run with go test -race.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

Type

No type

Projects

  • Status

    🤸‍♂️ In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions