Skip to content

Fixed race condition in legacy i18n.LoggerToCustomStreams #704

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
May 13, 2020

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented May 13, 2020

This PR serializes access to underlying streams.

Should solve:

WARNING: DATA RACE
Write at 0x00c04c8c5a88 by goroutine 61:
   bytes.(*Buffer).grow()
       /usr/local/go/src/bytes/buffer.go:147 +0x27f
   bytes.(*Buffer).Write()
       /usr/local/go/src/bytes/buffer.go:172 +0x154
   fmt.Fprintln()
       /usr/local/go/src/fmt/print.go:265 +0xb2
   github.com/arduino/arduino-cli/legacy/builder/i18n.LoggerToCustomStreams.Fprintln()
       /go/pkg/mod/github.com/arduino/arduino-cli@v0.0.0-20200324101224-985b2c99c8a4/legacy/builder/i18n/i18n.go:50 +0x125

Previous read at 0x00c04c8c5a88 by goroutine 9:
   bytes.(*Buffer).grow()
       /usr/local/go/src/bytes/buffer.go:143 +0x19d
   bytes.(*Buffer).Write()
       /usr/local/go/src/bytes/buffer.go:172 +0x154
   fmt.Fprintln()
       /usr/local/go/src/fmt/print.go:265 +0xb2
   github.com/arduino/arduino-cli/legacy/builder/i18n.LoggerToCustomStreams.Fprintln()
       /go/pkg/mod/github.com/arduino/arduino-cli@v0.0.0-20200324101224-985b2c99c8a4/legacy/builder/i18n/i18n.go:50 +0x125
   github.com/arduino/arduino-cli/legacy/builder/i18n.(*LoggerToCustomStreams).Fprintln()

/cc @matteosuppo

@cmaglie cmaglie requested a review from matteosuppo May 13, 2020 10:15
@cmaglie cmaglie merged commit c387167 into arduino:master May 13, 2020
@cmaglie cmaglie deleted the fix-race-condition-legacy-formatter branch May 13, 2020 10:56
cmaglie added a commit to arduino/arduino-builder that referenced this pull request Jun 12, 2020
- Removed automatic '--relax' hack for compiles on Atmega2560 MCU
  arduino/arduino-cli#749

- Fixed skethbook+bootloader hex merger.
  arduino/arduino-cli#744

- Fixed race condition in legacy i18n.LoggerToCustomStreams
  arduino/arduino-cli#704

- Fixed path-relativization error when traversing different partitions
  arduino/arduino-cli#658

- Add macro during lib discovery phase
  arduino/arduino-cli#633

- legacy: Improved progress report from Compile
  arduino/arduino-cli#625
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants