Skip to content

Commit 90a8800

Browse files
committed
Avoid selecting an outdated merger from cache
We cache a merger for partial input as well, because it is automatically invalidated as soon as the new data comes in. However, there was a race condition where a cached merger for a partial input is used even after the input stream was complete. This commit fixes the problem. Fix #4034
1 parent 97f1dae commit 90a8800

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/matcher.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func (m *Matcher) Loop() {
102102
if !cacheCleared {
103103
if count == prevCount {
104104
// Look up mergerCache
105-
if cached, found := m.mergerCache[patternString]; found {
105+
if cached, found := m.mergerCache[patternString]; found && cached.final == request.final {
106106
merger = cached
107107
}
108108
} else {

0 commit comments

Comments
 (0)