mage icon indicating copy to clipboard operation
mage copied to clipboard

Couldn't unmount zip files when downloading images

Open jmba98 opened this issue 1 year ago • 4 comments

Error type: Couldn't unmount zip files net.java.truevfs.kernel.spec.FsSyncException: zip:file:/C:/Users/jmba9/OneDrive/Desktop/XMage2024/xmage/mage-client/plugins/images/VIS.zip!/ - FsSyncException Client version: 1.4.54-V1 (build: 2024-09-08 18:14)

zip:file:/C:/Users/jmba9/OneDrive/Desktop/XMage2024/xmage/mage-client/plugins/images/VIS.zip!/

Stack trace: net.java.truevfs.kernel.impl.TargetArchiveController.close(TargetArchiveController.java:434) net.java.truevfs.kernel.impl.TargetArchiveController.sync(TargetArchiveController.java:327) net.java.truevfs.kernel.impl.ResourceController.sync(ResourceController.java:95) net.java.truevfs.kernel.impl.CacheController.sync(CacheController.java:128) net.java.truevfs.kernel.impl.SyncController.doSync(SyncController.java:263) net.java.truevfs.kernel.impl.SyncController.sync(SyncController.java:243) net.java.truevfs.kernel.impl.LockController$10.call(LockController.java:212) net.java.truevfs.kernel.impl.LockController$10.call(LockController.java:208) net.java.truevfs.kernel.impl.LockingStrategy$4.call(LockingStrategy.java:142) net.java.truevfs.kernel.impl.LockController.sync(LockController.java:208) and other 13 lines Root caused by: sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79) sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97) sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102) sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:230) java.nio.file.Files.newByteChannel(Files.java:361) java.nio.file.Files.newByteChannel(Files.java:407) java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384) java.nio.file.Files.newInputStream(Files.java:152) net.java.truevfs.driver.file.FileInputSocket.stream(FileInputSocket.java:45) net.java.truecommons.cio.IoSockets$InputAdapter.stream(IoSockets.java:61) and other 37 lines

jmba98 avatar Sep 09 '24 03:09 jmba98

Try running as admin, some users have reported that fixes the problem (or could be coincidence for intermittent error)

xenohedron avatar Sep 15 '24 20:09 xenohedron

It’s random error related to system performance (race condition in multithreaded code). There are must be some un-synced code in xmage or in truevfs library (maybe it has some limitation or special settings, need research).

p.s. it’s about unsaved data for one of the set. Not critical for a user - just run download in next app run or restart.

JayDi85 avatar Sep 16 '24 01:09 JayDi85

@JayDi85 if it's an intermittent error with no true fix, it possible to get some error handling on this at least?

xenohedron avatar Oct 11 '24 23:10 xenohedron

It’s under progress

JayDi85 avatar Oct 11 '24 23:10 JayDi85

@JayDi85 please add error handling so we don't get a duplicate issue for this every week

xenohedron avatar Dec 02 '24 23:12 xenohedron

Should we try to disable the zip files by default?

Some reasoning:

  • Downloading images seems to be a bit faster. Perhaps using the truevfs is a performance bottleneck?
  • You can increase the download threads and it works. Increasing download threads to with zip files usually crashes the download.
  • Less FsSyncException reports from users
  • Space savings? I downloaded scryfall small images and it looks like the compressed zip is actually larger than the individual files. Need to check how the large images compresses.
  • Easy change, just use raw images as default.
  • If people are constrained in disk space, just guide them to use the zip files.

t-my avatar May 01 '25 16:05 t-my

Zendikar Rising (ZNR), Scryfall good quality:

  • Zip file 1 File(s) 73 120 423 bytes
  • Folde of pictures 443 File(s) 73 058 459 bytes

This means there is no actual space savings from zipping the file, binary files can't be compressed at all.

t-my avatar May 01 '25 17:05 t-my

Zip must be replaced by zero compression version (keep zip files format, not tar/gz — so old user’s files will be compatible). Maybe it can help with multithread problems. I still don’t know the real reason — maybe truefs has some bugs and do not support it (I’m used flush and other commands from docs but it doesn’t help and can’t guaranty save an all data before stop/continue with other tasks).

Compression used in old days for png images. Now it’s jpg and no needs in compression. BUT it still needs less files on the disk. 100k card files are heavy to performance, copy and check.

JayDi85 avatar May 01 '25 17:05 JayDi85

Perhaps you could swap the default value to folders/files until that gets implemented? I don't know anything about the performance with many files, I could guess that most of the time you have just a small number of images in memory when you play?

Made a PR for your convenience if you think it is viable: https://github.com/magefree/mage/pull/13588

t-my avatar May 01 '25 17:05 t-my

It’s about operation system, not xmage (copy files, antivirus scan, etc). Game/GUI performance will be same.

JayDi85 avatar May 01 '25 17:05 JayDi85

Personally I install with zip files disabled.

xenohedron avatar May 01 '25 17:05 xenohedron

@xenohedron can you confirm xmage settings lost/reset on system's java update?

JayDi85 avatar May 01 '25 17:05 JayDi85

can you confirm xmage settings lost/reset on system's java update?

Not sure what you're referring to in this context. I've definitely heard reports of this from others but haven't experienced it myself. (I'm on linux, and running XMage with system java 23, not java 8)

xenohedron avatar May 01 '25 17:05 xenohedron

I've tried to play with couple of friends and downloading the images tends to be the biggest hurdle every time. If we could make that easier, that would be a good thing..

t-my avatar May 01 '25 20:05 t-my