Skip to content

Data race in isFromExternalLibrary/markFromExternalLibrary #1271

Closed
@jakebailey

Description

@jakebailey

My code in #1234 caused a race.

==================
WARNING: DATA RACE
Read at 0x00c00427d71a by goroutine 554:
  github.com/microsoft/typescript-go/internal/compiler.(*parseTask).isFromExternalLibrary()
      /mnt/vss/_work/typescript-go/typescript-go/internal/compiler/parsetask.go:145 +0x2e
  github.com/microsoft/typescript-go/internal/compiler.(*fileLoaderWorker[go.shape.*github.com/microsoft/typescript-go/internal/compiler.parseTask]).start()
      /mnt/vss/_work/typescript-go/typescript-go/internal/compiler/fileloadertask.go:44 +0xfc
  github.com/microsoft/typescript-go/internal/compiler.(*fileLoaderWorker[go.shape.*github.com/microsoft/typescript-go/internal/compiler.parseTask]).start.func1()
      /mnt/vss/_work/typescript-go/typescript-go/internal/compiler/fileloadertask.go:86 +0x38a
  github.com/microsoft/typescript-go/internal/core.(*parallelWorkGroup).Queue.func1()
      /mnt/vss/_work/typescript-go/typescript-go/internal/core/workgroup.go:39 +0x8d

Previous write at 0x00c00427d71a by goroutine 546:
  github.com/microsoft/typescript-go/internal/compiler.(*parseTask).markFromExternalLibrary()
      /mnt/vss/_work/typescript-go/typescript-go/internal/compiler/parsetask.go:149 +0x2e
  github.com/microsoft/typescript-go/internal/compiler.(*fileLoaderWorker[go.shape.*github.com/microsoft/typescript-go/internal/compiler.parseTask]).start.func1()
      /mnt/vss/_work/typescript-go/typescript-go/internal/compiler/fileloadertask.go:73 +0x219
  github.com/microsoft/typescript-go/internal/core.(*parallelWorkGroup).Queue.func1()
      /mnt/vss/_work/typescript-go/typescript-go/internal/core/workgroup.go:39 +0x8d

Goroutine 554 (running) created at:
  github.com/microsoft/typescript-go/internal/core.(*parallelWorkGroup).Queue()
      /mnt/vss/_work/typescript-go/typescript-go/internal/core/workgroup.go:[37](https://github.com/microsoft/typescript-go/actions/runs/15833848500/job/44633838646?pr=1268#step:10:38) +0xf0
  github.com/microsoft/typescript-go/internal/compiler.(*fileLoaderWorker[go.shape.*github.com/microsoft/typescript-go/internal/compiler.parseTask]).start()
      /mnt/vss/_work/typescript-go/typescript-go/internal/compiler/fileloadertask.go:52 +0x8d
  github.com/microsoft/typescript-go/internal/compiler.(*fileLoaderWorker[go.shape.*github.com/microsoft/typescript-go/internal/compiler.parseTask]).start.func1()
      /mnt/vss/_work/typescript-go/typescript-go/internal/compiler/fileloadertask.go:86 +0x[38](https://github.com/microsoft/typescript-go/actions/runs/15833848500/job/44633838646?pr=1268#step:10:39)a
  github.com/microsoft/typescript-go/internal/core.(*parallelWorkGroup).Queue.func1()
      /mnt/vss/_work/typescript-go/typescript-go/internal/core/workgroup.go:[39](https://github.com/microsoft/typescript-go/actions/runs/15833848500/job/44633838646?pr=1268#step:10:40) +0x8d

Goroutine 546 (finished) created at:
  github.com/microsoft/typescript-go/internal/core.(*parallelWorkGroup).Queue()
      /mnt/vss/_work/typescript-go/typescript-go/internal/core/workgroup.go:37 +0xf0
  github.com/microsoft/typescript-go/internal/compiler.(*fileLoaderWorker[go.shape.*github.com/microsoft/typescript-go/internal/compiler.parseTask]).start()
      /mnt/vss/_work/typescript-go/typescript-go/internal/compiler/fileloadertask.go:52 +0x8d
  github.com/microsoft/typescript-go/internal/compiler.(*fileLoaderWorker[go.shape.*github.com/microsoft/typescript-go/internal/compiler.parseTask]).start.func1()
      /mnt/vss/_work/typescript-go/typescript-go/internal/compiler/fileloadertask.go:86 +0x38a
  github.com/microsoft/typescript-go/internal/core.(*parallelWorkGroup).Queue.func1()
      /mnt/vss/_work/typescript-go/typescript-go/internal/core/workgroup.go:39 +0x8d
==================

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions