igor-dv commented on code in PR #40415:
URL: https://github.com/apache/beam/pull/40415#discussion_r4208342032


##########
sdks/go/pkg/beam/core/runtime/harness/datamgr.go:
##########
@@ -136,9 +136,15 @@ func (m *DataChannelManager) Open(ctx context.Context, 
port exec.Port) (*DataCha
                default:
                        log.Warnf(ctx, "forcing DataChannel[%v] reconnection on 
port %v due to %v", id, port, err)
                }
-               m.mu.Lock()
-               delete(m.ports, port.URL)
-               m.mu.Unlock()
+               // Remove this channel from the port map after releasing ch.mu.
+               // Keep the mapping if Open has already stored a replacement.
+               go func() {
+                       m.mu.Lock()
+                       if m.ports[port.URL] == ch {
+                               delete(m.ports, port.URL)
+                       }
+                       m.mu.Unlock()
+               }()

Review Comment:
   reverted this and fixed another way



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to