hyperledger-labs / fabric-smart-client

The Fabric Smart Client is a new Fabric Client that lets you focus on the business processes and simplifies the development of Fabric-based distributed application.
Apache License 2.0
52 stars 52 forks source link

add closing state to prevent send on closed channel panic #632

Closed arner closed 4 months ago

arner commented 4 months ago

With multiple subscribers and events, we encountered a race condition where the OnReceive would still try to send when CloseChaincodeEvents had already closed the channel (which causes a panic). This PR adds a unit- and integration test to reproduce it, and a closing boolean behind a mutex to prevent it.