fix: prevent an infinite loop in measurementFieldSetChangeMgr (#25155)

The measurementFieldSetChangeMgr has a possibly infinite loop
if the writeRequests channel is closed while in the inner
loop to consolidate write requests. We need to check for ok
on channel receive and exit the loop when ok is false.

closes https://github.com/influxdata/influxdb/issues/25151
pull/25165/head
davidby-influx 2024-07-12 16:52:28 -07:00 committed by GitHub
parent 6f46706b52
commit 176fca2138
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 4 deletions

View File

@ -2020,10 +2020,12 @@ func (fscm *measurementFieldSetChangeMgr) appendToChangesFile(first writeRequest
// requests
for {
select {
case wr := <-fscm.writeRequests:
changes = append(changes, wr.changes)
errorChannels = append(errorChannels, wr.errorReturn)
continue
case wr, ok := <-fscm.writeRequests:
if ok {
changes = append(changes, wr.changes)
errorChannels = append(errorChannels, wr.errorReturn)
continue
}
default:
}
break