Created attachment 397555 [details]
Test case (Airhorn + UpUp)
Steps to reproduce:
1. Open iOS Safari.
2. Navigate to https://airhorner.com/
3. Click Share, then Save to Home Screen.
4. Click App Icon from Home Screen.
5. Click the horn, it works.
6. Background the App (ie, go back to Home Screen).
7. Wait 5 seconds.
8. Click App Icon from Home Screen.
9. Click the horn, it doesn't work. App seems frozen.
I found this to be reproducible with every PWA I tested.
To rule out a problem with Workbox, I created an Airhorn test case with Workbox swapped out for an alternative PWA library called UpUp. I've attached this test case, but it's also available here:
- iPhone XS Max
- iOS 13.4.1
I could not repro on a recent WebKit build.
I would guess the WebProcess running the service worker stays suspended.
From my testing, the service worker runs in the WebProcess of the page which gets resumed.
If you attach your iOS device to a Mac, you can try debugging with Safari web inspector.
You should see entries like:
Develop -> Phone:
airhorner.com (for the page or service worker)
airhorner.com (for the service worker or the page)
I _can_ reproduce this, separately. iOS 13.4.1, iPhone 11 Pro. See the following repo for an extremely minimal reproduction: https://github.com/quicktype/ios-pwa-freeze-bug
In particular, this never happens in Mobile Safari. This only happens on PWAs added directly to the home screen.
If you disable Service Workers, there are no problems. This might also surface with Web Workers, but I haven't tested them.
This is _not_ an infinite loop in either the page JS context or the Service Worker JS context. I suspect it's a race condition involving suspending multiple JS execution contexts when the visibility state changes.
As of 2020-05-12, I can reproduce this on iOS 13.4.1 without even involving any Service Worker. This is a more severe bug than it looks, and our end users are currently frequently hitting it.
I can't share the specific web app that triggers the behavior without Service Workers involved publicly, but can share privately with Apple Employees upon request.
A sysdiagnose (that can be shared privately) might be useful.
Chris pointed out this might be related/fixed with https://trac.webkit.org/changeset/261034
Did https://trac.webkit.org/changeset/261034 make it into iOS 13.5? I have not been able to reproduce the freezing problem as of iOS 13.5 with https://github.com/quicktype/ios-pwa-freeze-bug, so it is possible that this has been fixed.
We are experiencing this bug with our pwa service worker. The pwa is installed/added to home screen and it doesn't happen every time. However it does happen intermittently and we have enough users of the app that we have started getting many reports of this happening on ios 13. We are considering detecting ios and disabling service workers all together - as our app is mostly only useful when connected online.
This is happening consistently with all web apps I've added to the home screen on iOS 13.6.
1. Add https://airhorner.com/ to the home screen.
2. Open it.
3. Go to the home screen.
4. Wait 20 seconds.
5. Open it.
6. It's frozen.
Users are really annoyed.
Yeh, it was fixed in 13.5 for us, but it appeard in 13.6 again ... Please Apple fix it asap!!!!!!
I can confirm that this is not fixed. Backgrounding a PWA will very often cause a freeze upon re-launch.
It happens in iOS 14 beta 2 for my app (fly.avnav.com) and every other known PWA that I have tested (twitter lite etc.).
One thing I noticed is that if App freezes on a page with scrolling then it still shows some sign of life with a bouncing effect - meaning its responding to at least one input. But rest of the UI is frozen/inactive - no response to any input. Web App seems to just hang.
I thought this was due to an infinite loop in my WebAssembly code but that's not the case.
I tried removing Service Worker to see if problem would go away but can not say conclusively that it did - I think i have seen it freeze even without Service Worker. But I can go back and test.
This is very serious problem since you have to kill processes frequently to use a PWA - making almost all major PWAs un-usable.
Please fix - for iOS 14 at least ! Thank you !!
Youenn Fablet - do we need to create another ticket for this ?
This does not seem to get attention otherwise and its a very serious bug.
All PWAs that I have tried including my own App are all unusable right now iOS/iPadOS Safari (they all hang on re-launch from homescreen icon).
I'm experiencing the same issue with my transit web app, I'd be a little bit upset if this bug persists in iOS 14 as well.
Hopefully this bug gets prioritized, thank you.
Also experiencing this issue. Removing the service worker does not fix it, as it appears to be cached. I can't believe this is marked as P2 and not assigned to anyone. At my company this would be a RED ALERT and everyone would work non-stop until it was fixed.
Has anybody tried iOS 14 beta? I have just tried the provided repro steps on iOS 14 beta and could not reproduce the issue.
Yes, I am running iOS14 beta and seeing my App freeze all the time.
(In reply to Sanjay Kumar from comment #17)
> Yes, I am running iOS14 beta and seeing my App freeze all the time.
Please indicate which beta.
For anyone who can reproduce this, especially on iOS 14 beta, can you please reproduce the problem and attach a sysdiagnose? The easiest way to get one is via Feedback Assistant.
Alternate sysdiagnose instructions: https://download.developer.apple.com/iOS/iOS_Logs/sysdiagnose_Logging_Instructions.pdf
Something has changed in the last four days.
I just downloaded iPadOS 14 Beta 5 on my Air and now it seems fixed - I could not get to hang in last hour plus of trying.
But my iPhone which is on automatic update and probably has not received the latest beta, it does still hang.
(In reply to Sanjay Kumar from comment #21)
> Something has changed in the last four days.
> I just downloaded iPadOS 14 Beta 5 on my Air and now it seems fixed - I
> could not get to hang in last hour plus of trying.
> But my iPhone which is on automatic update and probably has not received
> the latest beta, it does still hang.
Could others please confirm this is indeed fixed in Beta 5? This would explain why I was unable to reproduce myself.
I can also confirm this was fixed in iOS 13.5 and regressed in iOS 13.6. If anything, the problem became even more severe in iOS 13.6.
Just like iOS 13.3, we're now seeing reports of PWAs freezing without Service Workers involved at all. It's becoming a massive support pain for us.
Still seeing this bug in 13.6.1 latest update.
Confirmed. Still existing @13.6.1.
(In reply to Ingolf Wunder from comment #25)
> Confirmed. Still existing @13.6.1.
I am asking to confirm this was indeed fixed in iOS 14 beta 5 (not iOS 13)
More on the freeze bugs I've been seeing, in addition to the Service Worker freeze bug:
I can't reproduce this problem on iOS 14 beta 6, but it would be ideal if we could get this resolved in iOS 13.x before iOS 14 is out, and without asking our users to necessarily upgrade to iOS 14 when it does come out. Especially considering that it was resolved in iOS 13.5 and regressed in iOS 13.6.
Happens for me too in 13.6.1. Just have to switch to background and reopen, and it freezes. Very frustrating.
13.7 Update: Minimizing/Maximizing seems fixed (at least on iPadPro / iPhone SE), but when switching from one App to PWA it still freezes :/ ... C'mon Apple!!!!!!!!
I have several popular PWAs. This very frustrating bug is happening with all of them.
fixed in iOS 14
Has anyone else experienced this still happening in iOS 15.1?
I have tested the steps to reproduce on iOS 15.1 (iPhone 8). The issue seems to be fixed now. I returned from Airhorner to home screen, used other apps and even turned off the screen for over a minute, but when I open Airhorner again, it still works (produces sound).