-
Notifications
You must be signed in to change notification settings - Fork 483
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
Only allow once instance of fleet desktop at once #25821
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #25821 +/- ##
==========================================
- Coverage 63.86% 63.86% -0.01%
==========================================
Files 1658 1658
Lines 159079 159101 +22
Branches 4144 4144
==========================================
+ Hits 101592 101605 +13
- Misses 49550 49556 +6
- Partials 7937 7940 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have some functionality to make sure there's only one fleet-desktop process running:
fleet/orbit/cmd/orbit/orbit.go
Lines 1603 to 1609 in da42457
log.Info().Msg("killing any pre-existing fleet-desktop instances") | |
if err := platform.SignalProcessBeforeTerminate(constant.DesktopAppExecName); err != nil && | |
!errors.Is(err, platform.ErrProcessNotFound) && | |
!errors.Is(err, platform.ErrComChannelNotFound) { | |
log.Error().Err(err).Msg("desktop early terminate") | |
} |
- Were you able to reproduce the issue?
- Do we know why the current functionality is sometimes not working?
@lucasmrod I wasn't able to recreate the exact situation the customer was having, but if you launch Fleet Desktop independently using the command line, it will happily open many instances. I'm not entirely sure what the issue was, but it was likely some sort of race condition. |
Getting fleet-desktop to check a lock should prevent any situation where its launched more than once, regardless of how it happened |
We met with @dantecatalfamo and discussed the following changes (apart from the lock file change):
|
Co-authored-by: Lucas Manuel Rodriguez <[email protected]>
@@ -56,7 +56,7 @@ func SignalProcessBeforeTerminate(processName string) error { | |||
|
|||
// GetProcessByName gets a single running process object by its name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's update the docs (and rename to GetProcessesByName
?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending fixing some build issues, otherwise LGTM!
Co-authored-by: Lucas Manuel Rodriguez <[email protected]>
@@ -142,7 +142,7 @@ func SignalProcessBeforeTerminate(processName string) error { | |||
return nil | |||
} | |||
|
|||
// GetProcessByName gets a single running process object by its name. | |||
// GetProcessesByName gets a single running process object by its name. | |||
// Returns ErrProcessNotFound if the process was not found running. | |||
func GetProcessByName(name string) (*gopsutil_process.Process, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll also need to amend the Windows implementation to return all processes, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or document that on Windows we return only one for now (with a TODO in case there are issues in the future)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like it might cause issues, I'll see about making the Windows implementation return a list as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
#25396
If some of the following don't apply, delete the relevant line.
changes/
,orbit/changes/
oree/fleetd-chrome/changes
.See Changes files for more information.
journalctl -u orbit
), somewhere in there you should see a line showing the arguments used to launch fleet desktop~/.local/state/Fleet/fleet-desktop.log
), you should see mention of a lock file and that another instance of fleet desktop is activeruntime.GOOS
).