Skip to content

fatal error: concurrent map read and map write - in internal/output.(*prefixWriter).writeLine #1922

@tinmrn

Description

@tinmrn
  • Task version: v3.40.0 (h1:1gKx+2UDz06Jtm0MBiN+EqVN87wWEyspuEze4LRGusk=)
  • Operating system: Linux 5.10.0-33-amd64 SMP Debian 5.10.226-1 (2024-10-03) x86_64 GNU/Linux
  • Experiments enabled: don't think so
fatal error: concurrent map read and map write

goroutine 67 [running]:
github.com/go-task/task/v3/internal/output.(*prefixWriter).writeLine(0xc0004ca1e0, {0xc0006054c8, 0x2})
	github.com/go-task/task/[email protected]/internal/output/prefixed.go:88 +0xc5
github.com/go-task/task/v3/internal/output.(*prefixWriter).writeOutputLines(0xc0004ca1e0, 0x0)
	github.com/go-task/task/[email protected]/internal/output/prefixed.go:58 +0x6b
github.com/go-task/task/v3/internal/output.(*prefixWriter).Write(0xc0004ca1e0, {0xc0006d8000?, 0x418b9f?, 0xc0002ee010?})
	github.com/go-task/task/[email protected]/internal/output/prefixed.go:47 +0x45
io.copyBuffer({0xef22a0, 0xc0004ca1e0}, {0xef1840, 0xc0002ee010}, {0x0, 0x0, 0x0})
	io/io.go:431 +0x1de

this taskfile reproduces it pretty consistently:

version: '3'

output: prefixed

tasks:

  do-all:
    deps:
      - task-1
      - task-2
      - task-3
      - task-4
      - task-5
      - task-6
      - task-7
      - task-8
      - task-9
      - task-10
      - task-11
      - task-12
      - task-13
      - task-14
      - task-15
      - task-16
      - task-17
      - task-18
      - task-19
      - task-20

  task-1:
    cmds:
      - yes

  task-2:
    cmds:
      - yes

  task-3:
    cmds:
      - yes

  task-4:
    cmds:
      - yes

  task-5:
    cmds:
      - yes

  task-6:
    cmds:
      - yes

  task-7:
    cmds:
      - yes

  task-8:
    cmds:
      - yes

  task-9:
    cmds:
      - yes

  task-10:
    cmds:
      - yes

  task-11:
    cmds:
      - yes

  task-12:
    cmds:
      - yes

  task-13:
    cmds:
      - yes

  task-14:
    cmds:
      - yes

  task-15:
    cmds:
      - yes

  task-16:
    cmds:
      - yes

  task-17:
    cmds:
      - yes

  task-18:
    cmds:
      - yes

  task-19:
    cmds:
      - yes

  task-20:
    cmds:
      - yes

when run like so:

task do-all > /dev/null

^ The dev/null redirect gives a higher chance of triggering the concurrency conflict, i think because it allows for higher throughput than outputting to a terminal. But this bug occurs in our CI every now and then, too.

i also attach a bunch of error outputs just in case:

err-1.txt
err-2.txt
err-3.txt
err-4.txt
err-5.txt
err-6.txt
err-7.txt
err-8.txt
err-9.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions