hashicorp / memberlist

Golang package for gossip based membership and failure detection
Mozilla Public License 2.0
3.66k stars 443 forks source link

Node pointer passed to NodeJoin channel event delegate has no meta #255

Open CDespeaux opened 2 years ago

CDespeaux commented 2 years ago

I'm trying to receive events via the Channel Event Delegate. At times, there is no meta data associated with the node when I use the Node pointer provided by NodeEvent but yet if I find the node based on the name in the memberlist it contains the meta data. This always seems to happen when the node that joins is the node receiving the channel event. The Node pointer provided by NodeEvent also points to a different memory location than the memory address associated with the node found by iterating the memberlist. It doesn't make sense to me that I would have to search the memberlist in order to access the meta data. What gives? It looks NodeEvent is providing an incomplete copy. I set the meta data in the node immediately before calling cluster join.

dnephin commented 2 years ago

Thank you for raising this issue! I think this may be related to the data race I found in #238, or the data race identified here: https://github.com/hashicorp/memberlist/pull/232#pullrequestreview-619978981.

I haven't looked into this in much detail, but it seems like one or both of those could cause the problem you describe.