Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Data race on SetBehaviour #1016

Open
dido18 opened this issue Jan 29, 2025 · 0 comments
Open

Data race on SetBehaviour #1016

dido18 opened this issue Jan 29, 2025 · 0 comments
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@dido18
Copy link
Contributor

dido18 commented Jan 29, 2025

Motivation

There is a data race on the SetBehaviour call

 time="2025-01-29T14:25:31+01:00" level=info msg=" id=fUcMrGkG req=HEAD /v2/pkgs/tools/installed from=127.0.0.1"
2025/01/29 14:25:31 stderr: time="2025-01-29T14:25:31+01:00" level=info msg=" id=fUcMrGkG status=200 bytes=0 time=117.031µs"
2025/01/29 14:25:31 stdout: [GIN-debug] [WARNING] Headers were already written. Wanted to override status code 200 with 400
2025/01/29 14:25:31 stderr: ==================
2025/01/29 14:25:31 stderr: WARNING: DATA RACE
2025/01/29 14:25:31 stderr: Write at 0x00c000274298 by goroutine 61:
2025/01/29 14:25:31 stderr:   github.com/arduino/arduino-create-agent/v2/pkgs.(*Tools).SetBehaviour()
2025/01/29 14:25:31 stderr:       /home/dido/code/arduino/arduino-create-agent/v2/pkgs/tools.go:336 +0xae
2025/01/29 14:25:31 stderr:   github.com/arduino/arduino-create-agent/tools.(*Tools).Download()
2025/01/29 14:25:31 stderr:       /home/dido/code/arduino/arduino-create-agent/tools/download.go:47 +0x72
2025/01/29 14:25:31 stderr:   main.checkCmd.func2()
2025/01/29 14:25:31 stderr:       /home/dido/code/arduino/arduino-create-agent/hub.go:211 +0x384
2025/01/29 14:25:31 stderr: 
2025/01/29 14:25:31 stderr: Previous write at 0x00c000274298 by goroutine 60:
2025/01/29 14:25:31 stderr:   github.com/arduino/arduino-create-agent/v2/pkgs.(*Tools).SetBehaviour()
2025/01/29 14:25:31 stderr:       /home/dido/code/arduino/arduino-create-agent/v2/pkgs/tools.go:336 +0xae
2025/01/29 14:25:31 stderr:   github.com/arduino/arduino-create-agent/tools.(*Tools).Download()
2025/01/29 14:25:31 stderr:       /home/dido/code/arduino/arduino-create-agent/tools/download.go:47 +0x72
2025/01/29 14:25:31 stderr:   main.checkCmd.func2()
2025/01/29 14:25:31 stderr:       /home/dido/code/arduino/arduino-create-agent/hub.go:211 +0x384
2025/01/29 14:25:31 stderr: 
2025/01/29 14:25:31 stderr: Goroutine 61 (running) created at:
2025/01/29 14:25:31 stderr:   main.checkCmd()
2025/01/29 14:25:31 stderr:       /home/dido/code/arduino/arduino-create-agent/hub.go:182 +0x7cc
2025/01/29 14:25:31 stderr:   main.(*hub).run()
2025/01/29 14:25:31 stderr:       /home/dido/code/arduino/arduino-create-agent/hub.go:111 +0x244
2025/01/29 14:25:31 stderr:   main.loop.gowrap2()
2025/01/29 14:25:31 stderr:       /home/dido/code/arduino/arduino-create-agent/main.go:385 +0x33
2025/01/29 14:25:31 stderr: 
2025/01/29 14:25:31 stderr: Goroutine 60 (running) created at:
2025/01/29 14:25:31 stderr:   main.checkCmd()
2025/01/29 14:25:31 stderr:       /home/dido/code/arduino/arduino-create-agent/hub.go:182 +0x7cc
2025/01/29 14:25:31 stderr:   main.(*hub).run()
2025/01/29 14:25:31 stderr:       /home/dido/code/arduino/arduino-create-agent/hub.go:111 +0x244
2025/01/29 14:25:31 stderr:   main.loop.gowrap2()
2025/01/29 14:25:31 stderr:       /home/dido/code/arduino/arduino-create-agent/main.go:385 +0x33
2025/01/29 14:25:31 stderr: ==================
2025/01/29 14:25:55 stderr: time="2025-01-29T14:25:55+01:00" level=info msg=" id=Cnx0UJtM req=HEAD /v2/pkgs/tools/installed from=127.0.0.1"
@per1234 per1234 added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants