readium / swift-toolkit

A toolkit for ebooks, audiobooks and comics written in Swift
https://readium.org/mobile/
BSD 3-Clause "New" or "Revised" License
225 stars 96 forks source link

Reader reloads and loses position when coming from background #309

Open triin-ko opened 1 year ago

triin-ko commented 1 year ago

Bug Report

What happened?

If the reader view of the test app has been in the background and other apps are using a lot of memory, then something crashes and the book is reloaded and opened at an incorrect page.

Expected behavior

Book should stay on the same page as it was before going to background.

How to reproduce?

  1. Open a book with a saved location
  2. Swipe to some other page
  3. Send the app to the background
  4. Open other apps (I played a few games. This reproduced the issue every time: Diablo Immortal -> Candy Crush Saga -> Candy Crush Soda)
  5. Open the test app
  6. Reader view goes blank for a moment and then jumps back to the initial page

Environment

Development environment

macOS: 13.3.1 platform: arm64 Xcode 14.3 Build version 14E222b

Testing device

Additional context

Logs:

2023-06-19 15:59:20.721041+0300 Elisa Raamat TST[61244:4083409] [Process] 0x12e0844e0 - GPUProcessProxy::didClose: 2023-06-19 15:59:20.721135+0300 Elisa Raamat TST[61244:4083409] [Process] 0x12e0844e0 - GPUProcessProxy::gpuProcessExited: reason=Crash 2023-06-19 15:59:20.721279+0300 Elisa Raamat TST[61244:4083409] [Process] 0x130000be0 - [PID=61381] WebProcessProxy::gpuProcessExited: reason=Crash 2023-06-19 15:59:20.726895+0300 Elisa Raamat TST[61244:4083409] [Process] 0x130002440 - [PID=61384] WebProcessProxy::gpuProcessExited: reason=Crash 2023-06-19 15:59:20.727251+0300 Elisa Raamat TST[61244:4083409] [Process] 0x130002f20 - [PID=61386] WebProcessProxy::gpuProcessExited: reason=Crash 2023-06-19 15:59:20.727555+0300 Elisa Raamat TST[61244:4083409] [Process] 0x130004cc0 - [PID=61388] WebProcessProxy::gpuProcessExited: reason=Crash 2023-06-19 15:59:20.728164+0300 Elisa Raamat TST[61244:4083409] [Process] 0x130005cd0 - [PID=61390] WebProcessProxy::gpuProcessExited: reason=Crash 2023-06-19 15:59:20.728525+0300 Elisa Raamat TST[61244:4083409] [Process] 0x130006ec0 - [PID=61400] WebProcessProxy::gpuProcessExited: reason=Crash 2023-06-19 15:59:20.728891+0300 Elisa Raamat TST[61244:4083409] [Process] 0x130003680 - [PID=61401] WebProcessProxy::gpuProcessExited: reason=Crash 2023-06-19 15:59:20.731156+0300 Elisa Raamat TST[61244:4083409] [Process] 0x130006ec0 - [PID=61400] WebProcessProxy::didClose: (web process 0 crash) 2023-06-19 15:59:20.731211+0300 Elisa Raamat TST[61244:4083409] [Process] 0x130006ec0 - [PID=61400] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=Crash 2023-06-19 15:59:20.731289+0300 Elisa Raamat TST[61244:4083409] [ProcessSuspension] 0x12e01c180 - ProcessAssertion: Failed to acquire RBS Background assertion 'XPCConnectionTerminationWatchdog' for process because PID 0 is invalid 2023-06-19 15:59:20.731832+0300 Elisa Raamat TST[61244:4083409] [Process] 0x1604db018 - [pageProxyID=508, webPageID=509, PID=61400] WebPageProxy::processDidTerminate: (pid 61400), reason=Crash 2023-06-19 15:59:20.731996+0300 Elisa Raamat TST[61244:4092313] [ProcessSuspension] 0x12e01c180 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'XPCConnectionTerminationWatchdog' for process with PID=0, error: (null) 2023-06-19 15:59:20.736881+0300 Elisa Raamat TST[61244:4083409] [Loading] 0x1604db018 - [pageProxyID=508, webPageID=509, PID=61400] WebPageProxy::dispatchProcessDidTerminate: reason=Crash 2023-06-19 15:59:20.736919+0300 Elisa Raamat TST[61244:4083409] [Loading] 0x1604db018 - [pageProxyID=508, webPageID=509, PID=61400] WebPageProxy::dispatchProcessDidTerminate: Not eagerly reloading the view because it is not currently visible 2023-06-19 15:59:20.736968+0300 Elisa Raamat TST[61244:4083409] [Process] 0x130004cc0 - [PID=61388] WebProcessProxy::didClose: (web process 0 crash) 2023-06-19 15:59:20.736985+0300 Elisa Raamat TST[61244:4083409] [Process] 0x130004cc0 - [PID=61388] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=Crash 2023-06-19 15:59:20.737012+0300 Elisa Raamat TST[61244:4083409] [ProcessSuspension] 0x12e01c240 - ProcessAssertion: Failed to acquire RBS Background assertion 'XPCConnectionTerminationWatchdog' for process because PID 0 is invalid 2023-06-19 15:59:20.737235+0300 Elisa Raamat TST[61244:4083409] [Process] 0x161849418 - [pageProxyID=412, webPageID=413, PID=61388] WebPageProxy::processDidTerminate: (pid 61388), reason=Crash 2023-06-19 15:59:20.737264+0300 Elisa Raamat TST[61244:4092320] [ProcessSuspension] 0x12e01c240 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'XPCConnectionTerminationWatchdog' for process with PID=0, error: (null) 2023-06-19 15:59:20.737943+0300 Elisa Raamat TST[61244:4083409] [Loading] 0x161849418 - [pageProxyID=412, webPageID=413, PID=61388] WebPageProxy::dispatchProcessDidTerminate: reason=Crash 2023-06-19 15:59:20.738033+0300 Elisa Raamat TST[61244:4083409] [Loading] 0x161849418 - [pageProxyID=412, webPageID=413, PID=61388] WebPageProxy::dispatchProcessDidTerminate: Not eagerly reloading the view because it is not currently visible 2023-06-19 15:59:20.738102+0300 Elisa Raamat TST[61244:4083409] [Process] 0x130000a20 - NetworkProcessProxy::didClose (Network Process 0 crash) 2023-06-19 15:59:20.738665+0300 Elisa Raamat TST[61244:4083409] [Process] 0x130005cd0 - [PID=61390] WebProcessProxy::didClose: (web process 0 crash) 2023-06-19 15:59:20.738714+0300 Elisa Raamat TST[61244:4083409] [Process] 0x130005cd0 - [PID=61390] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=Crash 2023-06-19 15:59:20.738834+0300 Elisa Raamat TST[61244:4083409] [ProcessSuspension] 0x12e01c420 - ProcessAssertion: Failed to acquire RBS Background assertion 'XPCConnectionTerminationWatchdog' for process because PID 0 is invalid 2023-06-19 15:59:20.739114+0300 Elisa Raamat TST[61244:4083409] [Process] 0x162056018 - [pageProxyID=428, webPageID=429, PID=61390] WebPageProxy::processDidTerminate: (pid 61390), reason=Crash 2023-06-19 15:59:20.739198+0300 Elisa Raamat TST[61244:4092314] [ProcessSuspension] 0x12e01c420 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'XPCConnectionTerminationWatchdog' for process with PID=0, error: (null) 2023-06-19 15:59:20.739627+0300 Elisa Raamat TST[61244:4083409] [Loading] 0x162056018 - [pageProxyID=428, webPageID=429, PID=61390] WebPageProxy::dispatchProcessDidTerminate: reason=Crash 2023-06-19 15:59:20.739686+0300 Elisa Raamat TST[61244:4083409] [Loading] 0x162056018 - [pageProxyID=428, webPageID=429, PID=61390] WebPageProxy::dispatchProcessDidTerminate: Not eagerly reloading the view because it is not currently visible 2023-06-19 15:59:20.739776+0300 Elisa Raamat TST[61244:4083409] [Process] 0x130003680 - [PID=61401] WebProcessProxy::didClose: (web process 0 crash) 2023-06-19 15:59:20.739841+0300 Elisa Raamat TST[61244:4083409] [Process] 0x130003680 - [PID=61401] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=Crash 2023-06-19 15:59:20.739965+0300 Elisa Raamat TST[61244:4083409] [ProcessSuspension] 0x12e01c5a0 - ProcessAssertion: Failed to acquire RBS Background assertion 'XPCConnectionTerminationWatchdog' for process because PID 0 is invalid 2023-06-19 15:59:20.740208+0300 Elisa Raamat TST[61244:4083409] [Process] 0x1604ee818 - [pageProxyID=516, webPageID=517, PID=61401] WebPageProxy::processDidTerminate: (pid 61401), reason=Crash 2023-06-19 15:59:20.740242+0300 Elisa Raamat TST[61244:4092314] [ProcessSuspension] 0x12e01c5a0 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'XPCConnectionTerminationWatchdog' for process with PID=0, error: (null) 2023-06-19 15:59:20.740714+0300 Elisa Raamat TST[61244:4083409] [Loading] 0x1604ee818 - [pageProxyID=516, webPageID=517, PID=61401] WebPageProxy::dispatchProcessDidTerminate: reason=Crash 2023-06-19 15:59:20.740733+0300 Elisa Raamat TST[61244:4083409] [Loading] 0x1604ee818 - [pageProxyID=516, webPageID=517, PID=61401] WebPageProxy::dispatchProcessDidTerminate: Not eagerly reloading the view because it is not currently visible 2023-06-19 15:59:20.740765+0300 Elisa Raamat TST[61244:4083409] [Process] 0x130002440 - [PID=61384] WebProcessProxy::didClose: (web process 0 crash) 2023-06-19 15:59:20.740790+0300 Elisa Raamat TST[61244:4083409] [Process] 0x130002440 - [PID=61384] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=Crash 2023-06-19 15:59:20.740836+0300 Elisa Raamat TST[61244:4083409] [ProcessSuspension] 0x12e01c120 - ProcessAssertion: Failed to acquire RBS Background assertion 'XPCConnectionTerminationWatchdog' for process because PID 0 is invalid 2023-06-19 15:59:20.741098+0300 Elisa Raamat TST[61244:4083409] [Process] 0x16300b018 - [pageProxyID=380, webPageID=381, PID=61384] WebPageProxy::processDidTerminate: (pid 61384), reason=Crash 2023-06-19 15:59:20.741187+0300 Elisa Raamat TST[61244:4092314] [ProcessSuspension] 0x12e01c120 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'XPCConnectionTerminationWatchdog' for process with PID=0, error: (null) 2023-06-19 15:59:20.741815+0300 Elisa Raamat TST[61244:4083409] [Loading] 0x16300b018 - [pageProxyID=380, webPageID=381, PID=61384] WebPageProxy::dispatchProcessDidTerminate: reason=Crash 2023-06-19 15:59:20.741874+0300 Elisa Raamat TST[61244:4083409] [Loading] 0x16300b018 - [pageProxyID=380, webPageID=381, PID=61384] WebPageProxy::dispatchProcessDidTerminate: Not eagerly reloading the view because it is not currently visible 2023-06-19 15:59:20.742983+0300 Elisa Raamat TST[61244:4083409] [Process] 0x130000be0 - [PID=61381] WebProcessProxy::didClose: (web process 0 crash) 2023-06-19 15:59:20.743026+0300 Elisa Raamat TST[61244:4083409] [Process] 0x130000be0 - [PID=61381] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=Crash 2023-06-19 15:59:20.743120+0300 Elisa Raamat TST[61244:4083409] [ProcessSuspension] 0x12e01c300 - ProcessAssertion: Failed to acquire RBS Background assertion 'XPCConnectionTerminationWatchdog' for process because PID 0 is invalid 2023-06-19 15:59:20.743326+0300 Elisa Raamat TST[61244:4083409] [Process] 0x160bbc018 - [pageProxyID=362, webPageID=363, PID=61381] WebPageProxy::processDidTerminate: (pid 61381), reason=Crash 2023-06-19 15:59:20.743348+0300 Elisa Raamat TST[61244:4088195] [ProcessSuspension] 0x12e01c300 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'XPCConnectionTerminationWatchdog' for process with PID=0, error: (null) 2023-06-19 15:59:20.744293+0300 Elisa Raamat TST[61244:4083409] [Loading] 0x160bbc018 - [pageProxyID=362, webPageID=363, PID=61381] WebPageProxy::dispatchProcessDidTerminate: reason=Crash 2023-06-19 15:59:20.744323+0300 Elisa Raamat TST[61244:4083409] [Loading] 0x160bbc018 - [pageProxyID=362, webPageID=363, PID=61381] WebPageProxy::dispatchProcessDidTerminate: Not eagerly reloading the view because it is not currently visible 2023-06-19 15:59:20.744358+0300 Elisa Raamat TST[61244:4083409] [Process] 0x130002f20 - [PID=61386] WebProcessProxy::didClose: (web process 0 crash) 2023-06-19 15:59:20.744377+0300 Elisa Raamat TST[61244:4083409] [Process] 0x130002f20 - [PID=61386] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=Crash 2023-06-19 15:59:20.744413+0300 Elisa Raamat TST[61244:4083409] [ProcessSuspension] 0x12e01c4e0 - ProcessAssertion: Failed to acquire RBS Background assertion 'XPCConnectionTerminationWatchdog' for process because PID 0 is invalid 2023-06-19 15:59:20.744588+0300 Elisa Raamat TST[61244:4083409] [Process] 0x16181be18 - [pageProxyID=396, webPageID=397, PID=61386] WebPageProxy::processDidTerminate: (pid 61386), reason=Crash 2023-06-19 15:59:20.744684+0300 Elisa Raamat TST[61244:4088195] [ProcessSuspension] 0x12e01c4e0 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'XPCConnectionTerminationWatchdog' for process with PID=0, error: (null) 2023-06-19 15:59:20.745038+0300 Elisa Raamat TST[61244:4083409] [Loading] 0x16181be18 - [pageProxyID=396, webPageID=397, PID=61386] WebPageProxy::dispatchProcessDidTerminate: reason=Crash 2023-06-19 15:59:20.745062+0300 Elisa Raamat TST[61244:4083409] [Loading] 0x16181be18 - [pageProxyID=396, webPageID=397, PID=61386] WebPageProxy::dispatchProcessDidTerminate: Not eagerly reloading the view because it is not currently visible