Skip to content

Fix possible panic on closed channel #15667

@aanm

Description

@aanm

If the connection restarts in

restart:
watcher := iw.backend.ListAndWatch(ctx, "endpointIPWatcher", IPIdentitiesPath, 512)
for {
select {
// Get events from channel as they come in.
case event, ok := <-watcher.Events:
if !ok {
log.Debugf("%s closed, restarting watch", watcher.String())
time.Sleep(500 * time.Millisecond)
goto restart
}

the channel in

close(iw.synced)

might be closed more than one time causing a panic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good-first-issueGood starting point for new developers, which requires minimal understanding of Cilium.help-wantedPlease volunteer for this by adding yourself as an assignee!kind/bugThis is a bug in the Cilium logic.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions