Home / Huge delay when opening epub files on a mounted rclone remote?
When I open *.epub files from a remote mounted as a drive via rclone, it takes a long while to open the file and when it does open, I can only read 1-2 pages and then the pages won’t turn further.
For a bit of context, rclone is a CLI application that, among other things, lets people mount cloud service providers as a local drive. For example, if I put a text file on my Google Drive and mount that, I can open it as if it’s available locally. I use it to view videos or listen to mp3 files without issue.
I haven’t encountered issues with it aside from SumatraPDF being unable to load *.epub files properly.
Is it only EPUBs that are affected, or is Sumatra slow to open any supported file type from the remote drive, including PDFs?
Have you tried opening the remote EPUBs with another app? For best results, have two copies of the same file with different names on the remote drive, and ensure neither have been accessed earlier. Open one with Sumatra and note the time taken, then open the other with a different app and compare.
If you try opening the same file twice, it may have been copied to the local cache when Sumatra tried to access it the first time, and so subsequently the other app might not experience the same slowdown while accessing the same file again.
PDF doesn’t seem to have any issues. CBZ has the same issue as EPUB (takes very long to open) but it’s a bit better because unlike EPUB, it actually lets me scroll through all the contents. For EPUB, it stops allowing to change pages after 1-2 page turns.
Microsoft Edge opened the same EPUB without any problems as well as others
The cache mode is set to stream so the file is essentially streamed directly from the remote storage and not cached
Well, it does seem highly unlikely that Sumatra opens and closes EPUBs “a gazillion times”. Perhaps other types of apps might need to do so, but why would any reader app repeatedly open and close a file it is simply displaying?
Maybe you can help the dev out by using something like Process Explorer to confirm how many handles Sumatra opens/closes while accessing an EPUB on a remote drive.
My suspicion on reading the description of –vfs-cache-mode writes and your comment that “For EPUB, it stops allowing to change pages after 1-2 page turns” is that Sumatra is opening the file and displaying the first HTML page or two streamed to it, but either when it tries to read ahead and cache subsequent pages in the background or when it tries to display the next page, there is a delay (however small) leading to a silent hang/failure.
I think the wording there was poorly chosen and what they meant was that the software (Sumatra) was programmed to open the file and expects an immediate response from the filesystem which is what normally happens on an SSD or an HDD. But in the case of a mounted remote, it takes longer than what the software expects causing various oddities to happen.
Yeah this is one of the reasons I had in mind too. Now the question is why does it not affect PDF files. Does Sumatra open EPUB files in a different way? Like maybe it loads the whole PDF file first before displaying it but then for some reason it reads EPUB files in chunks and displays the contents as it comes?
Could very well be the case considering that unlike PDFs, EPUBs are basically ZIP archives with separate HTMLs, images etc. inside (if you have an EPUB without any DRM you can easily check by changing its extension and opening with any archiver).
So then yeah, that would make it an issue of SumatraPDF then, right?
Well, clearly if Edge isn’t facing the same issue then there’s something Sumatra can do better in such situations. However I wouldn’t hold my breath if I were you. For one this is a really niche issue that next to no-one else will face or even care about, unless that is they happen to use rclone or another product that behaves the same way with the same caching strategy. On top of that, considering the fact that the main (and pretty much sole) dev for this project hasn’t been very active for quite some time now and the issues have been piling up on GitHub, I’d advise you to either switch to --vfs-cache-mode full or use another app like Edge for your remote EPUBs.