ID:1556506
 
Applies to:BYOND Pager
Status: Open

Issue hasn't been assigned a status value.
Belongs in the pager, I guess...?

Redownloading files is a pain. I know this issue is common as well, and its not just Space Station 13 players but but players of other Byond games as well. You know when it happens, you leave the game and come back later, or you crash mid-game and suddenly you are redownloading all of the files the server had to your Byond.rsc. And while I hate using these examples, for SS13; Baystation is 64.6mb, /TG/ code is currently 39.5mb. Large file sizes for games such as Space Station 13 can not be helped, even with optimizations but this is not the problem

The problem is or your average player, downloading those isn't a problem; however you must remember Byond caters to not just people with high/moderate speed internet. Some people have very slow internet, while others have a very small cap on how much bandwidth they can use per month. And even for the people with decent internet, sometimes file download is slow.

I recently realized that a copy of the Byond.rsc can be placed over the original Byond.rsc when having to redownload an entire servers worth of files for no reason. And as a proof of concept, I made a .bat file which does that; it duplicates the rsc, and when run again it replaces the original with the duplicate. Gave it to several people to test, it works and saved them a download.

So while a simple .bat file is easy, it would be a lot more efficient to have a backup function built into the Byond Pager for the Byond.rsc
Descriptive Problem Summary:

Every so often I'll be forced to re-download the .rsc of Eternia, when joining the server, and other players have also reported this. I very rarely clear my temporary internet files, perhaps once every couple of months, and I'll usually have to redownload Eternia's at least once a week.

Sadly, I have no idea what causes this and if it happens to other games at all.

Numbered Steps to Reproduce Problem:

-- join Eternia (or another game? Unsure)
-- a slim chance that a re-download of the .rsc occurs

Expected Results:

-- .rsc shouldn't be re-downloaded

Actual Results:

-- .rsc is re-downloaded

Does the problem occur:
Every time? Or how often? Rarely. Maybe once a week despite many joins each day.
In other games? Unsure.
In other user accounts? Yes.
On other computers? Unsure.

When does the problem NOT occur? 90 of the time

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? It has been happening to me for at least since the pager update. Past then, I can't remember.

Workarounds: N/A

In response to Writing A New One
Temporary Internet Files don't store your game info; that's stored in BYOND's cache.

BYOND will periodically do garbage collection on the cache to delete stuff that hasn't been touched in a while, but if you're only playing the one game and doing so frequently, then it really shouldn't churn at all. If you're playing others, it might simply be clearing out space properly. How and when the cache is cleared is dictated by the cache_lifespan variable, among other considerations.

I need more information to be able to investigate this. Some sort of snapshot listing (like going to a command line and outputting the results of a dir command on the cache directory to a file) taken repeatedly over the course of a week might be helpful.
I'll admit that I have no idea why this happens. I suspect, however, that BYOND treats the RSC as a cache, and expires it after a certain time period in order to "refresh" it.

If this is the case, it'd be nice to have a hash check before redownloading it.
The byond.rsc is a cache, you're correct in that regard. Each resource inside has a CRC32 checksum, which is used (possibly among other things, hence the issue?) to compare availability in the local cache versus what the server has in it's resources.

Traditionally, this means icons shared between games also benefit from this caching. However I'm not sure how much of that still applies in the SS13 'many codebases' scenario.
In response to Stephen001
Stephen001 wrote:
The byond.rsc is a cache, you're correct in that regard. Each resource inside has a CRC32 checksum, which is used (possibly among other things, hence the issue?) to compare availability in the local cache versus what the server has in it's resources.
Traditionally, this means icons shared between games also benefit from this caching. However I'm not sure how much of that still applies in the SS13 'many codebases' scenario.

Understandable. However, even people who have never played on other servers have experienced this annoying forced redownload of the RSC, when the RSC has not changed on the server.
There is an expiry, certainly, on cached entries. But by the sounds of OP's request (and the behaviour you're describing), they're getting more of a corruption issue, where-by the pager has decided an entire raft of resources is no longer valid and must be expunged. There's a probable bug there?
I have moved this to Bug Reports because a redownload of known resources really shouldn't be happening (and we've had reports in the past). If anyone can construct a reproducible example of this in action, that would aid in fixing it.
This is quite an interesting problem. I took a look into our cache code, which was changed quite some time ago to allow for much larger cache files, so that shouldn't be the issue. Old items are purged based on access time, which gets updated any time the resource is used, and the max lifespan in days of any item depends on 1) the size of the cache file (the limits are very generous), and 2) the load time. I have to assume though that neither of these two factors are in play if a mere copy of the byond.rsc file is capable of preventing a purge. Presumably the access time of the files in the copy is, if anything, older or no different, and the file modification time (which doesn't even appear to be a factor) would be older as well.

I would like to know if there are any differences encountered between the .dmb and the file that gets copied over it (you can check this on the command line with "fc /b" followed by both files), and also if there are any messages in Options & Messages about the cache, like possibly a complaint about corruption. These would be helpful for sussing out errors.