-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assets sometimes fail to load from the asset cache. #2663
Comments
I did some digging in the code, and I have a theory as to why this is happening. It looks like there is a race condition in These are a few culprits here:
It seems to me that all three of these points could be made more robust, and fixing any one of them should fix the underlying issue. E.g.,
|
I suspect what you have found here explains many of the cases where players end up with dreaded red X for tokens/maps. It seems like your #1 suggestion will fix most cases and is a common way of avoiding these problems. Adding the MD5 check in #3 will allow us to identify corrupt images in the cache which would allow us to flush it out of the cache and, for player clients, request it again from the server. |
Testing. This appears to have created a problem with saving new images to the assetcache. Do any of the following:
These all produce exceptions like this:
Only the |
I have a feeling this may be a windows-specific thing, though I don't see why. I'll see if I can reproduce it. |
Could be given where the error occurs. The exception occurs 3 or 4 times depending on image size it seems. |
Ah, this may be as simple as an incorrect closing order for streams. Will test later and post a PR if that's the case. |
Re-tested. New assets are now being written to the asset cache and with no exceptions. |
Describe the bug
When adding many new tokens using assets from the resource library, it sometimes happens that the asset is not fully read and results in MapTools freezing.
To Reproduce
Unfortunately I was not able to reproduce this without 5e Framework since I'm not sure exactly what it's doing to load the assets.
Steps to reproduce the behavior:
Expected behavior
MapTool should load the asset without freezing.
MapTool Info
Desktop (please complete the following information):
Additional context
I'm not sure if MapTool itself is freezing, or if the framework is somehow holding it up. I also don't know how to get the logs from a frozen MapTool process, so I reproduced the issue with the latest on
develop
and got these logs right when the freeze occurred:I did some digging and added some additional logging to AssetManager, and what I found is that this call to
FileUtils.readFileToByteArray()
does not return all the data for the asset. This makes the MD5 to be incorrect and causes the inflation to fail.The text was updated successfully, but these errors were encountered: