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

MacOS continuous startup #641

Closed
pedrobernardina opened this issue May 19, 2020 · 6 comments · Fixed by #670
Closed

MacOS continuous startup #641

pedrobernardina opened this issue May 19, 2020 · 6 comments · Fixed by #670
Assignees
Labels
Milestone

Comments

@pedrobernardina
Copy link

Good afternoon.

I installed free QZ Tray some months ago, and it was great! I've disabled "Launch on start", because I don't like lots of processes running when I start the system.

These last few days I'm running some expensive computing jobs, and I like to use HTOP to monitor my processes. What bugged me was a strange JDK process appearing for 1 to 2 seconds, going to 100 ~ 120% processor use, and then disappearing for another 5ish seconds. Since I don't use java outside specific tasks, and it had such a small lifespan, I used HTOP to filter only JDK processes. It was the only process, and it appeared and disappeared from the list.

I took a screenshot and found that it was QZTray, but QZTray wasn't running at the moment. I uninstalled QZTray it seems to have solved the issue.

Screen Shot 2020-05-19 at 15 16 36

@tresf
Copy link
Contributor

tresf commented May 19, 2020

@pedrobernardina there's a nuance with Apple that tries to restart a failing startup process, and this may be what you're observing. Apple deprecated our old startup routine so we've switched to a LaunchAgents technique. I believe there's an option to restart or stay dead and I think you're hitting first scenario. Staying dead is preferred by most people I'm sure, but since Java crashes on it's own accord during normal usage, we often prefer the latter.

Where this becomes a pretty big problem is when the crash is reoccurring. I believe this is a bug that we need to sort with LaunchAgents. We can't be the only app that wants to try again before giving up, we just need a way to set that give-up value.

We'll need a way to reproduce the issue and confirm that it's fixed. If you are unable to provide one, we'll figure it out it'll just take a bit longer.

@tresf tresf self-assigned this May 19, 2020
@tresf tresf added the bug label May 19, 2020
@tresf tresf changed the title Strange JDK process MacOS continuous startup and crash May 19, 2020
@tresf
Copy link
Contributor

tresf commented May 19, 2020

Also I'd like to mention that it's not a strange JDK process, it's just a very long command. It's the Apple-equivalent of java -jar qz-tray.jar, nothing suspicious or strange is happening except the fact that it's not dying out when it fails to startup.

@tresf
Copy link
Contributor

tresf commented May 19, 2020

So I believe what's happening is, when we tell QZ Tray to honor autostart (done via the --honorautostart flag) we send back a return code of 3, which Apple's not happy with, trapping it in LaunchAgents purgatory.

NO_AUTOSTART(3);

System.exit(parser.getExitCode());

This code was chosen so that in an automated environment, we could tell the difference between exit codes, but I believe it tells LaunchAgents it failed (due to a non-zero return code) asking it to restart, which it does, just to shut itself down again.

@tresf tresf changed the title MacOS continuous startup and crash MacOS continuous startup May 19, 2020
@tresf tresf closed this as completed in 7563857 May 19, 2020
@tresf
Copy link
Contributor

tresf commented May 19, 2020

@pedrobernardina thanks kindly for the report. This will be fixed in 2.1.1 and higher. A manual workaround until that is available is to delete /Library/LaunchAgents/io.qz.qz-tray.plist after a fresh install.

@tresf tresf added this to the 2.1.1 milestone May 19, 2020
@pedrobernardina
Copy link
Author

Sorry for my late response :/

Thanks a lot for checking this up. What I meant by "strange JDK process" is because it wasn't supposed to be there, because I didn't start it 😄

Great lib and great support! Cheers.

@tresf
Copy link
Contributor

tresf commented Jun 9, 2020

Turns out this is still a problem. During installation, the service will try to restart automatically when it's stopped. The websocket will close due to a second instance running but it returns System.exit(2), which triggers the same loop. Reopening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants