From 3bfc48be11c89ee3cf8be9b6f45f76aa0ff78f23 Mon Sep 17 00:00:00 2001 From: Scott Blum Date: Thu, 6 Oct 2022 14:53:03 -0400 Subject: [PATCH] storage: storage.(*Writer).Write() with cancelled context causes write race --- storage/writer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/writer.go b/storage/writer.go index 91229f148a6..487e1ee635c 100644 --- a/storage/writer.go +++ b/storage/writer.go @@ -176,7 +176,6 @@ func (w *Writer) openWriter() (err error) { isIdempotent := w.o.conds != nil && (w.o.conds.GenerationMatch >= 0 || w.o.conds.DoesNotExist == true) opts := makeStorageOpts(isIdempotent, w.o.retry, w.o.userProject) - go w.monitorCancel() params := &openWriterParams{ ctx: w.ctx, chunkSize: w.ChunkSize, @@ -196,6 +195,7 @@ func (w *Writer) openWriter() (err error) { return err } w.opened = true + go w.monitorCancel() return nil }