diff --git a/lib/persistentqueue/persistentqueue.go b/lib/persistentqueue/persistentqueue.go index 87e4b1a555..916276c3f5 100644 --- a/lib/persistentqueue/persistentqueue.go +++ b/lib/persistentqueue/persistentqueue.go @@ -336,6 +336,10 @@ func tryOpeningQueue(path, name string, chunkFileSize, maxBlockSize, maxPendingB cleanOnError() return nil, fmt.Errorf("couldn't find chunk file for writing in %q", q.dir) } + if q.readerOffset > q.writerOffset { + cleanOnError() + return nil, fmt.Errorf("readerOffset=%d cannot exceed writerOffset=%d", q.readerOffset, q.writerOffset) + } mustCloseFlockF = false return &q, nil }