JK3Y / NPS-Browser-macOS

macOS version of NPS Browser
The Unlicense
189 stars 22 forks source link

Sometimes downloads are corrupted #47

Open einsteinx2 opened 6 years ago

einsteinx2 commented 6 years ago

Got another one for ya ;) Sorry I don't have time to do preliminary investigations into these bugs, I'm swamped at work, but I figured better to report what I know than wait.

Describe the bug Sometimes when I download a pkg (note I've only tested PS3, as I don't have any of the other supported consoles), the resulting package will fail to install. Usually if I download it again, it will work. I checked broken and working files with sha1sum and they are different, though the file sizes are the same, so it's clearly corrupting the data somehow.

One game in particular, Gran Turismo 6, I downloaded 2 or 3 times, every time they failed to install, every time with a different sha1 hash but the same file size. Finally I tried out the Windows version of NPS on another machine in my house and it downloaded and installed correctly the first try with yet another sha1 hash.

At first I thought it was an issue with resuming, as it's a large download and previously I had paused and resumed if the speed dropped. However, the last time I tried, I made sure not to resume it. Though I don't know for sure if the app automatically resumes if the file slows to 0 or something, so maybe that's still a common factor.

Note, I've had this problem on smaller downloads as well, and I've had similarly large downloads work perfectly, so I can't seem to find the pattern, but there's clearly something wrong in the download code.

To Reproduce Steps to reproduce the behavior:

  1. Download Gran Turismo 6 for PS3
  2. Try to install the package

Expected behavior The package should install correctly and not be corrupted

Desktop (please complete the following information):

Additional context I don't think this is a Mojave bug specifically, as I have zero issues with downloads in any other app. Also I don't think it's a router issue, as again I can successfully download and upload huge chunks of data as well as move huge amounts of data around my home wifi network without any issues, and the Windows machine used the same router, though to be fair it was hooked up via ethernet (maybe leading more credence to the resume issue assuming that Wifi is less stable than Ethernet.

JK3Y commented 6 years ago

Do you mean install on PS3? I actually don't have a PS3 to test installs so I figured as long as the file downloaded it was good to go. Downloads are not auto-resumed when the app is started up again so that's not the problem... are you closing the app while it's still downloading? Sometimes the app crashes in "applicationWillTerminate", but i've only ever had that randomly happen in the XCode debugger. I have no idea why this happens. Maybe a check can be done on the resume data to check the integrity? I wonder if since the pc version doesn't allow pause/resume downloads there's no risk of losing partial data because the app just starts the download over again...

einsteinx2 commented 6 years ago

Yep, I mean that the download completes but it fails to install because it fails the signature check at some point during the installation due to the file not being correct (confirmed using sha1 hashes). I also used sha1 hashes to confirm that it isn't happening during my copying it around my home network and only the usb drive for installation.

So if it doesn't auto-resume then it must not be an issue with resuming after all. The third time I tried downloading it, I specifically made sure to allow it to complete in one go. I didn't close or otherwise touch the app until the download completed. The interesting thing is that the files are always the same size, so assuming you're not preallocating the space, it seems that it downloads the entire file, but messes up some of the data somehow. Each time I downloaded it, it was the same size with a different sha1 hash. I downloaded it a fourth time using the Windows version and it had the same size and yet another sha1 hash. That last one downloaded on Windows was the only one that installed correctly, so the others must have had some data corruption somewhere causing the signing check to fail.

Also I re-downloaded 2 other games using the the Mac app that had failed to install, one was about 2GB and other about 6GB, and both installed correctly on the second download. Checking the sizes and hashes again showed that while they had the same sizes as the ones that didn't work, their sha1 hashes were different so they had different data. It's not consistent though because I've successfully downloaded and installed various other games. It's only been about 4 or so games, of various sizes, that had the issue, with Gran Turismo 6 being the most stubborn one (all others worked fine on second download).

Not really sure what's up. Anyway, since I use an NTFS drive to move the files to my PS3 and keep them on my Windows machine's hdd anyway, I've just started using the Windows version so I don't have to download to my Mac then move to the other machine before copying again to USB. So, I won't be able to provide much more info, but wanted to give you a heads up.