stretchly icon indicating copy to clipboard operation
stretchly copied to clipboard

[Bug]: Stretchly won't quit properly, have to force quit instead

Open felipe-lee opened this issue 2 years ago • 10 comments

Version

  • [X] I'm using version 1.14.0

Known issues

  • [X] I've checked Known issues

Existing issues

  • [X] I've checked Existing issues

Advanced Preferences

  • [X] I've checked Advanced Preferences

What operating system are you using?

macOS

Operating System Version

macOS Ventura 13.1

Reproduction steps

I have been able to trigger this two ways, though it feels like they are likely the same issue.

How I came across the issue

  1. Have stretchly open automatically when I log in.
  2. Have a short break occur.
    1. To be honest, I haven't tested quitting the app after I log in and before a break occurs. I mainly put this step because of the other reproduction steps I have listed below.
  3. Attempt to shut down my computer.
    1. It fails to shut down because stretchly won't quit. I need to force quit in order to be able to then shut down.

Alternative to reproduce the issue without logging out/in

  1. Open stretchly.
  2. Skip to next mini break.
    1. If I only open stretchly, don't have a break, and try to close it, it closes just fine.
  3. Postpone mini break.
  4. Attempt to quit stretchly using "Quit Stretchly" button. image
  5. Nothing seems to happen, nor are there any logs related to quitting, but interestingly, if another break happens and I let it run through to the end, it just hangs and won't go back: image
    1. This does produce a log error (TypeError: Object has been destroyed, details included in the log output section below), and I suspect it's because something did happen when I tried to quit (based on the Object has been destroyed error), but the quitting process didn't finish fully and so the app is still running but missing some of the things it needs. This is speculation on my part though 🤷🏼

... Reproduces how often: 100% so far.

Expected Behavior

I would expect the app to quit cleanly without the need to force quit it.

Actual Behavior

I have to force quit the app if I want to quit it. This is really mainly an issue for me when I'm trying to shut down my computer, because otherwise I usually leave stretchly running all day.

Relevant log output

[2023-05-02 16:32:05.720] [info]  Stretchly: initializing...
[2023-05-02 16:32:05.729] [info]  Stretchly: loading preferences
[2023-05-02 16:32:05.740] [info]  Stretchly: starting Idle time monitoring
[2023-05-02 16:32:05.756] [info]  Stretchly: starting Do Not Disturb monitoring
[2023-05-02 16:32:05.849] [info]  Stretchly: loading default break ideas
[2023-05-02 16:32:05.902] [info]  Stretchly: loading default break ideas
[2023-05-02 16:32:09.647] [info]  Stretchly: skipping to Mini Break
[2023-05-02 16:32:10.053] [info]  Stretchly: showing window 1 of 2
[2023-05-02 16:32:10.074] [info]  Stretchly: starting Mini Break
[2023-05-02 16:32:10.165] [info]  Stretchly: showing window 2 of 2
[2023-05-02 16:32:11.387] [info]  Stretchly: postponing Mini Break
[2023-05-02 16:32:27.562] [info]  Stretchly: skipping to Mini Break
[2023-05-02 16:32:28.006] [info]  Stretchly: showing window 1 of 2
[2023-05-02 16:32:28.010] [info]  Stretchly: starting Mini Break
[2023-05-02 16:32:28.108] [info]  Stretchly: showing window 2 of 2
[2023-05-02 16:32:48.012] [error] TypeError: Object has been destroyed
    at breakComplete (/Applications/Stretchly.app/Contents/Resources/app.asar/main.js:945:16)
    at finishMicrobreak (/Applications/Stretchly.app/Contents/Resources/app.asar/main.js:955:20)
    at BreaksPlanner.<anonymous> (/Applications/Stretchly.app/Contents/Resources/app.asar/main.js:209:80)
    at BreaksPlanner.emit (node:events:513:28)
    at Timeout._onTimeout (/Applications/Stretchly.app/Contents/Resources/app.asar/breaksPlanner.js:22:49)
    at listOnTimeout (node:internal/timers:569:17)
    at process.processTimers (node:internal/timers:512:7)

Preferences

No response

Additional information

To be honest, I don't remember if it started when I upgraded to the latest version of the app, because I usually install updates to things at the start of my day and didn't notice this issue until I tried shutting down for the day, by which point I'd forgotten what updates I installed that morning.

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

felipe-lee avatar May 02 '23 23:05 felipe-lee

Hi, sorry for late reply but super busy currently. I have some older mac so will try to reproduce there. Never had this issue on Linux so probably macOS related.

hovancik avatar May 19 '23 08:05 hovancik

I am on macOS 11.7.6, as I have older machine but can't reproduce.

Error message suggests this line, but I don't see any reason why this window would not exist.

    processWin.webContents.send('playSound', settings.get(audio), settings.get('volume'))

The only rationale I see is when you first try quiting, some Stretchly processes are quit but not all of them. Can you check number of Stretchly processes before and after you try quit?

image

hovancik avatar May 22 '23 16:05 hovancik

No worries about the delay, I appreciate you making this app available at all.

It looks like there is a difference in the processes before and after quitting.

Before: image

After: image

So, one of the instances of the "Strecthly Helper (Renderer)" processes gets closed, but every other process stays open.

felipe-lee avatar May 31 '23 02:05 felipe-lee

My screenshots from last time were after freshly opening Stretchly, but I was looking just now after having it running most of the day and there are a lot of processes running before I try to close it:

image

After attempting to close it:

image

Only a few processes were ended. I wonder if this is why it won't close properly? Maybe there are more processes than expected and it's not finding them all.

felipe-lee avatar Jun 02 '23 00:06 felipe-lee

That's definetly bad behavior, the number of processes should stay the same (as when you start the app), with the difference in processes when break is on, or when preferences are opened. After they are closed, the number should go down again. Can you check when it seems to keep the processes for you?

this is for me when I open the app

Screenshot 2023-06-03 at 11 13 10

And after break

Screenshot 2023-06-03 at 11 14 54

What's weird the next break seems to work fine for me and I never go up more then 5 preferences.

Closing Preferences seems to work fine.

hovancik avatar Jun 03 '23 09:06 hovancik

This is what I have right after opening it:

image

If I open preferences:

image

And closing preferences (seems to end the process that had been added, so that seems to be working):

image

This is after a break (extra helper and "Renderer" processes):

image

Another "Renderer" process is kept after each break it seems. Here are the processes after a second break:

image

I started a break and skipped it and it also leaves behind a "Renderer" process:

image

note: Ignore the PID values. I fully quit and re-opened the app at one point because I had a few breaks go through and I wasn't sure if that affected things (kind of seems like it does), so I started over and worked to the same spot, just didn't take screenshots of the first steps again 😅

felipe-lee avatar Jun 05 '23 21:06 felipe-lee

I updated to 1.14.1 and now I don't have to force quit stretchly at the end of my day 🎉

I do still have a bunch of extra processes (screenshot after having it open for 2-3 hours):

image

But at least now they all close when I shutdown my computer. I'm not sure if you want to keep this open for the extra processes, or if that should be a separate issue.

felipe-lee avatar Jun 29 '23 00:06 felipe-lee

I still have this issue on 1.14.1

asabaini avatar Sep 03 '23 05:09 asabaini

I still have this issue on latest

huangxinjian avatar Jun 21 '24 01:06 huangxinjian