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

chore(Taskfile): add race detector and watcher for local development #1003

Merged
merged 1 commit into from
Jan 10, 2025

Conversation

dido18
Copy link
Contributor

@dido18 dido18 commented Jan 10, 2025

Please check if the PR fulfills these requirements

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • Tests for the changes have been added (for bug fixes / features)
  • What kind of change does this PR introduce?
    Add task install command to install local dependencies, and task run command to run the service locally with the auto-reload and race detector enabled.
  • What is the current behavior?
  • What is the new behavior?
  • Does this PR introduce a breaking change?
  • Other information:

@dido18
Copy link
Contributor Author

dido18 commented Jan 10, 2025

A data race is detected on shutdown

2025/01/10 14:35:07 stderr: WARNING: DATA RACE
2025/01/10 14:35:07 stderr: Write at 0x0000018b31e8 by goroutine 16:
2025/01/10 14:35:07 stderr:   github.com/arduino/arduino-create-agent/systray.(*Systray).SetCurrentConfigFile()
2025/01/10 14:35:07 stderr:       /home/dido/code/arduino/arduino-create-agent/systray/systray.go:102 +0x79d
2025/01/10 14:35:07 stderr:   main.loop()
2025/01/10 14:35:07 stderr:       /home/dido/code/arduino/arduino-create-agent/main.go:261 +0x791
2025/01/10 14:35:07 stderr: 
2025/01/10 14:35:07 stderr: Previous write at 0x0000018b31e8 by main goroutine:
2025/01/10 14:35:07 stderr:   main.main()
2025/01/10 14:35:07 stderr:       /home/dido/code/arduino/arduino-create-agent/main.go:149 +0x239
2025/01/10 14:35:07 stderr: 
2025/01/10 14:35:07 stderr: Goroutine 16 (running) created at:
2025/01/10 14:35:07 stderr:   main.main()
2025/01/10 14:35:07 stderr:       /home/dido/code/arduino/arduino-create-agent/main.go:145 +0xfa
2025/01/10 14:35:07 stderr: ==================

@codecov-commenter
Copy link

codecov-commenter commented Jan 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 20.14%. Comparing base (d36d0e1) to head (3e36a77).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1003   +/-   ##
=======================================
  Coverage   20.14%   20.14%           
=======================================
  Files          42       42           
  Lines        3221     3221           
=======================================
  Hits          649      649           
  Misses       2487     2487           
  Partials       85       85           
Flag Coverage Δ
unit 20.14% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@per1234 per1234 added type: enhancement Proposed improvement topic: infrastructure Related to project infrastructure labels Jan 10, 2025
@dido18 dido18 force-pushed the dido18/taskfile-watcher-race-detector branch from 0a0c128 to 3e36a77 Compare January 10, 2025 13:51
@dido18
Copy link
Contributor Author

dido18 commented Jan 10, 2025

Another DATA-RACE when the port is closed

2025/01/10 14:53:20 stderr: ==================
2025/01/10 14:53:20 stderr: WARNING: DATA RACE
2025/01/10 14:53:20 stderr: Read at 0x00c000447988 by goroutine 80:
2025/01/10 14:53:20 stderr:   main.(*serport).reader()
2025/01/10 14:53:20 stderr:       /home/dido/code/arduino/arduino-create-agent/serialport.go:88 +0x167
2025/01/10 14:53:20 stderr:   main.spHandlerOpen()
2025/01/10 14:53:20 stderr:       /home/dido/code/arduino/arduino-create-agent/serialport.go:345 +0x1467
2025/01/10 14:53:20 stderr:   main.checkCmd.gowrap4()
2025/01/10 14:53:20 stderr:       /home/dido/code/arduino/arduino-create-agent/hub.go:157 +0x6b
2025/01/10 14:53:20 stderr: 
2025/01/10 14:53:20 stderr: Previous write at 0x00c000447988 by goroutine 86:
2025/01/10 14:53:20 stderr:   main.(*serport).Close()
2025/01/10 14:53:20 stderr:       /home/dido/code/arduino/arduino-create-agent/serialport.go:351 +0x37
2025/01/10 14:53:20 stderr:   main.spClose()
2025/01/10 14:53:20 stderr:       /home/dido/code/arduino/arduino-create-agent/serial.go:267 +0xee
2025/01/10 14:53:20 stderr:   main.checkCmd.gowrap5()
2025/01/10 14:53:20 stderr:       /home/dido/code/arduino/arduino-create-agent/hub.go:163 +0x44
2025/01/10 14:53:20 stderr: 
2025/01/10 14:53:20 stderr: Goroutine 80 (running) created at:
2025/01/10 14:53:20 stderr:   main.checkCmd()
2025/01/10 14:53:20 stderr:       /home/dido/code/arduino/arduino-create-agent/hub.go:157 +0x366
2025/01/10 14:53:20 stderr:   main.(*hub).run()
2025/01/10 14:53:20 stderr:       /home/dido/code/arduino/arduino-create-agent/hub.go:111 +0x244
2025/01/10 14:53:20 stderr:   main.loop.gowrap2()
2025/01/10 14:53:20 stderr:       /home/dido/code/arduino/arduino-create-agent/main.go:412 +0x33
2025/01/10 14:53:20 stderr: 
2025/01/10 14:53:20 stderr: Goroutine 86 (running) created at:
2025/01/10 14:53:20 stderr:   main.checkCmd()
2025/01/10 14:53:20 stderr:       /home/dido/code/arduino/arduino-create-agent/hub.go:163 +0x584
2025/01/10 14:53:20 stderr:   main.(*hub).run()
2025/01/10 14:53:20 stderr:       /home/dido/code/arduino/arduino-create-agent/hub.go:111 +0x244
2025/01/10 14:53:20 stderr:   main.loop.gowrap2()
2025/01/10 14:53:20 stderr:       /home/dido/code/arduino/arduino-create-agent/main.go:412 +0x33
2025/01/10 14:53:20 stderr: ==================

@dido18 dido18 marked this pull request as ready for review January 10, 2025 13:54
@dido18 dido18 requested a review from a team January 10, 2025 14:02
Copy link
Contributor

@alessio-perugini alessio-perugini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch.
How do we want to handle those race problems?

  1. Do we want to open a dedicated issue for each of them
  2. Do we want to open a generic issue and reference both problems in the description
  3. Do we want to address them in this same PR?

@dido18
Copy link
Contributor Author

dido18 commented Jan 10, 2025

Nice catch. How do we want to handle those race problems?

  1. Do we want to open a dedicated issue for each of them
  2. Do we want to open a generic issue and reference both problems in the description
  3. Do we want to address them in this same PR?

I think there are other data races in the code base :(

We could merge this PR, and open an issue for each data race detected.

@dido18 dido18 merged commit 67db428 into main Jan 10, 2025
46 of 48 checks passed
@dido18 dido18 deleted the dido18/taskfile-watcher-race-detector branch January 10, 2025 14:38
@dido18
Copy link
Contributor Author

dido18 commented Jan 10, 2025

Opened issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: infrastructure Related to project infrastructure type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants