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

adds server for desktop process to monitor parent #1109

Merged

Conversation

James-Pickett
Copy link
Contributor

@James-Pickett James-Pickett commented Mar 22, 2023

Updates desktop runner to create a local server that desktop processes can use to determine if parent still around. A new endpoint is added to the mux for each desktop process, then passed when spawning the process. If the desktop process does not get a response back from that endpoint, it exits.

response.Body.Close()
}

if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Would we potentially want to wait for maybe ~3 consecutive errors, maybe with a small amount of backoff? Just so that launcher being slow to respond once doesn't immediately kill the desktop process.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added some retries, I started to add a backoff ... but it's fussy to test so I gave up. You think retries is enough?

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 I was worried about something like this too - we could end up with the opposite problem, where desktop/menubar can vanish.

@James-Pickett James-Pickett marked this pull request as ready for review March 23, 2023 18:05
directionless
directionless previously approved these changes Mar 23, 2023
Copy link
Contributor

@directionless directionless left a comment

Choose a reason for hiding this comment

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

I didn't test this, but it seems fine


if errCount < maxErrCount {

backOff := interval + (interval * time.Duration(errCount))
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems fine, but is also a bit overkill for maxErrCount = 3

"github.com/kolide/kit/ulid"
)

type monitorServer struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't love the name monitorServer but okay

seejdev
seejdev previously approved these changes Mar 24, 2023
@seejdev
Copy link
Contributor

seejdev commented Mar 24, 2023

LGTM! The connection re-use is nifty.

1 similar comment
@seejdev
Copy link
Contributor

seejdev commented Mar 24, 2023

LGTM! The connection re-use is nifty.

@James-Pickett James-Pickett merged commit ff9ed48 into kolide:main Mar 24, 2023
@James-Pickett James-Pickett deleted the james/desktop-http-parent-monitor branch March 24, 2023 19:30
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