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

That's the races out of our test suite! #5384

Open
wants to merge 40 commits into
base: develop
Choose a base branch
from

Conversation

andydotxyz
Copy link
Member

Working perfectly locally, let's see what CI says!

Progresses #4654

Checklist:

  • Tests included.
  • Lint and formatter run with no errors.
  • Tests all pass.

@andydotxyz
Copy link
Member Author

Oh man, so many races not detected on my local setup :(

@dweymouth
Copy link
Contributor

InMemoryPreferences will need to avoid using a goroutine here

@andydotxyz
Copy link
Member Author

InMemoryPreferences will need to avoid using a goroutine here

Good catch thanks. Fixed

@andydotxyz
Copy link
Member Author

OK, some platforms are now not detecting any races, so I have enabled it on the rest and working through what I hope is the last few!!!

@dweymouth
Copy link
Contributor

Use new RunFromGoroutine API here - https://github.com/fyne-io/fyne/blob/develop/app/settings_desktop.go#L48

@coveralls
Copy link

Coverage Status

coverage: 59.759% (+0.4%) from 59.329%
when pulling 7d5fb07 on andydotxyz:fix/racedetection
into 1bfc24c on fyne-io:develop.

@coveralls
Copy link

Coverage Status

coverage: 59.754% (+0.4%) from 59.329%
when pulling 367a6a6 on andydotxyz:fix/racedetection
into 1bfc24c on fyne-io:develop.

@coveralls
Copy link

Coverage Status

coverage: 59.764% (+0.4%) from 59.329%
when pulling 895953c on andydotxyz:fix/racedetection
into 1bfc24c on fyne-io:develop.

@coveralls
Copy link

coveralls commented Jan 9, 2025

Coverage Status

coverage: 59.246% (-0.1%) from 59.374%
when pulling bcb6742 on andydotxyz:fix/racedetection
into f2ba049 on fyne-io:develop.

@dweymouth
Copy link
Contributor

@Jacalz It seems we may need to remove or update the new pool_test. I think sync.Pool doesn't make a guarantee that an object released into the pool is immediately available for re-use, which is why it's failing occasionally here

@andydotxyz
Copy link
Member Author

@Jacalz It seems we may need to remove or update the new pool_test. I think sync.Pool doesn't make a guarantee that an object released into the pool is immediately available for re-use, which is why it's failing occasionally here

Good point, the contract includes this on Get:

// Get may choose to ignore the pool and treat it as empty.
// Callers should not assume any relation between values passed to Put and
// the values returned by Get.

So I have removed the Set/Get test - but the Get on empty and the replacement New tests should both be OK.

@Jacalz
Copy link
Member

Jacalz commented Jan 9, 2025

This looking really good. Some greps of suspicious goroutines that I found:

@Jacalz
Copy link
Member

Jacalz commented Jan 9, 2025

This sleep looks suspicous:

time.Sleep(time.Millisecond * 100) // writes are not always atomic. 10ms worked, 100 is safer.

@Jacalz
Copy link
Member

Jacalz commented Jan 9, 2025

Sorry if those are just false positives. Figured it was better to report things that I thought looked strange. I also see some potential races in the flatpak dialog code that I added but I can tackle that later on.

@Jacalz
Copy link
Member

Jacalz commented Jan 9, 2025

Should we get #5382 merged so this can be tested more easily?

@dweymouth
Copy link
Contributor

This looking really good. Some greps of suspicious goroutines that I found:

Good finds, those will all need some work because they all result in user callbacks, or widget functions, being called directly from goroutines which is against the new model

@Jacalz
Copy link
Member

Jacalz commented Jan 9, 2025

That's it merged. Rebasing this should make it possible to click around in fyne_demo and test out any potential races. I think I got one when changing application scale in the settings menu earlier but it might have been fixed by this PR already, I don't know :)

@andydotxyz
Copy link
Member Author

This sleep looks suspicous:

time.Sleep(time.Millisecond * 100) // writes are not always atomic. 10ms worked, 100 is safer.

Thanks - fixed. I left the delay as there was a bug reported about file write delay but then it joins back to main now

@andydotxyz andydotxyz self-assigned this Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants