pactus-project / pactus

Pactus blockchain
https://pactus.org
MIT License
124 stars 136 forks source link

gRPC: concurrent map iteration and map write #1276

Closed themantre closed 2 weeks ago

themantre commented 2 weeks ago

Description

The gRPC module has a potential bug that causes a crash:

fatal error: concurrent map iteration and map write

This is likely due to unsafe casting of the SentBytes and ReceivedBytes maps, leading to concurrent map iteration and map write: https://github.com/pactus-project/pactus/blob/34f0b99d877eb0c31c10e220deb3d7d947a441bd/www/grpc/network.go#L111-L112