bitbof / klecks

Community funded painting tool powering Kleki.com
https://klecks.org
MIT License
232 stars 74 forks source link

Freezing during long session in Safari (iPad, Mac) #6

Open bitbof opened 2 years ago

bitbof commented 2 years ago

Multiple users have reported that Kleki (and thereby Klecks) can freeze during a longer session (30 minutes) in Safari on iPad or Mac. When freezing occurs it's impossible to save and the page needs to be reloaded.

I think it started around December 2021. I've yet to reproduce this myself.

If you've experienced this issue and have a reliable way of reproducing it please provide information. Thank you.

bitbof commented 2 years ago

In Safari canvases and CanvasRenderingContext2D can be null which points to a memory leak (https://stackoverflow.com/a/43482153/13941359). Via logs, wasn't able to reproduce yet. (edit 2022-04-19: was able to cause reproducible memory leak)

Not sure if that's part of the slowdown / freeze.

satopian commented 2 years ago

There was information that it freezes after repeating fill 20 times on the iPad. embedded mode Klecks. The canvas size is max width 800px max height 800px.

bitbof commented 2 years ago

@satopian Thanks for the info.

I attempted to reproduce

The app continued to work without freezing.

It would be interesting to know their iPadOS version, from which year their model is, and if this happens consistently when filling 20 times.

satopian commented 2 years ago

The browser is Chrome and the iPad OS is the latest. The iPad was released in November 2018. The number of fills that freeze occurs is 3 to 40 times.

It seems that the issues always reappears in that user's environment. Other operations may be causing the freeze, but it seems to avoid using it because it freezes frequently due to filling. It hasn't been a few days since the memory leak was fixed, so I asked the user to clear the browser cache. If I still know if the problem will recur, I will report it again.

satopian commented 2 years ago

I asked a user who freezes when using a fill. The user didn't know how to clear the browser cache. However, The user was able to restart the iPad and test it. Users have been testing with the latest version of Klecks. The freeze no longer occurs. The drawing time of the user is about 3 hours.

bitbof commented 2 years ago

@satopian That is good news. Let me know if it comes back.

I will have a look at Chrome on iPad. It should use the same rendering and JavaScript engine as Safari though.

SnailPerson commented 2 years ago

I use Kleki on both Mac and Macbook Pro with Safari. On the Mac, the freeze occurs after around 20-30 minutes session time after zooming or undoing/redoing via buttons. On the Macbook however, this doesn't seem to be the case as I've never encountered a freeze while using Kleki.

The Mac is a late 2017 27-inch model, with Safari ver.15.3 using MacOS 12.2.1 (Monterey) The MacBook Pro is a late 2017 model with Safari ver.15.3 using MacOS 10.15.7 (Catalina)

So what seems to be the case is that a newer MacOS version is responsible for causing the freezes.

Other browsers like Chrome are not affected by this bug.

SnailPerson commented 1 year ago

Hello again, Ive noticed something regarding the freeze bug whilst working with Kleki today.

I used to press the undo button quite often in the past, but since I've gotten more used to using cmd+z instead, the freezes were getting less frequent. So maybe it has something to do with the way UI buttons work? I don't remember any button other that undo/redo (and zooming?) triggering the crash, but it might be something worth looking at.

Remember that this doesn't happen with browsers like Chrome, only on safari, so how safari handles web buttons etc might be a lead.

SnailPerson commented 1 year ago

Update on the situation, although seemingly less common, hitting Cmd+Z to undo a step can still trigger a freeze. I want to remind again that this bug does not occur on any browser on MacOS versions prior to MacOS Monterey.

SnailPerson commented 1 year ago

What can also apparently happen, Safari instantly reloading Kleki / the site upon doing a freeze provoking action, such as undoing. It gives the error message "this site was reloaded due to a problem", refuses to elaborate and leaves you with a white canvas. Just lost a decent piece to this

bitbof commented 12 months ago

Thanks for your continued observations. It sucks you lost work. This will be invaluable when I have time to properly investigate.