This is an automated email from the ASF dual-hosted git repository.

wilfred-s pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/yunikorn-core.git


The following commit(s) were added to refs/heads/master by this push:
     new e28f03ff [YUNIKORN-3436] Slow consumer blocks stream shutdown (#1141)
e28f03ff is described below

commit e28f03ff4ffc5cbeeb61a494bc8cdc4a994866b1
Author: PoiBlackTea <[email protected]>
AuthorDate: Wed Sep 2 14:02:01 2026 +0200

    [YUNIKORN-3436] Slow consumer blocks stream shutdown (#1141)
    
    If a consumer is slow it can block the write of an event into the
    channel. In that case a closure of the underlying connection will cause
    the go routine to be leaked.
    
    Closes: #1141
    
    Signed-off-by: Wilfred Spiegelenburg <[email protected]>
---
 pkg/events/event_streaming.go | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/pkg/events/event_streaming.go b/pkg/events/event_streaming.go
index 652bef20..59daac50 100644
--- a/pkg/events/event_streaming.go
+++ b/pkg/events/event_streaming.go
@@ -124,7 +124,15 @@ func (e *EventStreaming) CreateEventStream(name string, 
count uint64) *EventStre
                                // since events are processed in a single 
goroutine, doubling is no longer
                                // possible at this point
                                seen = make(map[*si.EventRecord]bool)
-                               consumer <- event
+                               select {
+                               case consumer <- event:
+                               case <-e.stopCh:
+                                       close(consumer)
+                                       return
+                               case <-stop:
+                                       close(consumer)
+                                       return
+                               }
                        }
                }
        }(consumer, local, stop)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to