libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.22k stars 1.82k forks source link

(Cheevos) Cache and Retry Achievement Verification #10138

Closed cometjo closed 4 years ago

cometjo commented 4 years ago

Description

My internet connection is flaky sometimes. I will be awarded an achievement but the internet will be temporarily down and my account on RetroAchievements will never get updated. For achievements that take hours of gameplay this can be pretty devastating.

Version/Commit

RetroArch 1.8.4 (Git ab94af68c1)

Environment information

Jamiras commented 4 years ago

RetroArch already does this. The unlock API call will be repeated until it succeeds, or you close the application. Shortly after your internet returns, it should unlock.

https://github.com/libretro/RetroArch/blob/master/cheevos-new/cheevos.c#L650-L681

In particular, note that the function passes itself as the callback to task_push_http_transfer, and will continue to do so over and over again until error comes back as NULL.

cometjo commented 4 years ago

I'm pretty sure I tested this. But perhaps I didn't wait long enough after the internet returned. I'll test this again later today.

cometjo commented 4 years ago

So I just ran a test on the first level of Super Mario Bros. 3. I started the first level and once I verified that the Cheevos had loaded in the Quick Menu I physically unhooked my internet and did the Backstage achievement. My Nestopia core actually froze the moment it would have triggered until I hooked it back up where it said I had achieved it. I then went over and achieved the Prepare For Take-Off achievement. I then let the stage run out of time and then loaded the achievement page in my browser where it said I had only achieved the Prepare For Take-Off achievement.

So I'm not really sure what is going on here. There has been a least a few times recently that I have achieved something that Retroarch says that I have but then the website says that I haven't. And never before has my core froze up like that.

LootusMaximus commented 4 years ago

Nestopia isnt even supported by retroachievements.. Or its just incompatible rather. Afaik

Jamiras commented 4 years ago

I tried a similar test using Super Mario Bros (1), and triggered the achievements for collecting the mushroom, fire flower, and 1-UP. The result is a very spammy message loop trying to unlock the related achievements. Shortly after plugging back into the network, the unlocks succeeded.

[ERROR] [RCHEEVOS]: Error awarding achievement 3159: Internal error.
[ERROR] [RCHEEVOS]: Error awarding achievement 27180: Internal error.
[ERROR] [RCHEEVOS]: Error awarding achievement 3158: Internal error.
[ERROR] [RCHEEVOS]: Error awarding achievement 39680: Internal error.
[ERROR] [RCHEEVOS]: Error awarding achievement 3159: Internal error.
[ERROR] [RCHEEVOS]: Error awarding achievement 27180: Internal error.
[ERROR] [RCHEEVOS]: Error awarding achievement 3158: Internal error.
[ERROR] [RCHEEVOS]: Error awarding achievement 39680: Internal error.
[ERROR] [RCHEEVOS]: Error awarding achievement 3159: Internal error.
[ERROR] [RCHEEVOS]: Error awarding achievement 27180: Internal error.
[ERROR] [RCHEEVOS]: Error awarding achievement 3158: Internal error.
[ERROR] [RCHEEVOS]: Error awarding achievement 39680: Internal error.
[ERROR] [RCHEEVOS]: Error awarding achievement 3159: Internal error.
[ERROR] [RCHEEVOS]: Error awarding achievement 27180: Internal error.
[ERROR] [RCHEEVOS]: Error awarding achievement 3158: Internal error.
[ERROR] [RCHEEVOS]: Error awarding achievement 39680: Internal error.
[ERROR] [RCHEEVOS]: Error awarding achievement 3159: Internal error.
[ERROR] [RCHEEVOS]: Error awarding achievement 27180: Internal error.
[ERROR] [RCHEEVOS]: Error awarding achievement 3158: Internal error.
[ERROR] [RCHEEVOS]: Error awarding achievement 39680: Internal error.
[ERROR] [RCHEEVOS]: Error awarding achievement 3159: Internal error.
[INFO] [RCHEEVOS]: Awarded achievement 27180
[INFO] [RCHEEVOS]: Awarded achievement 3158
[INFO] [RCHEEVOS]: Awarded achievement 39680
[INFO] [RCHEEVOS]: Awarded achievement 3159

I did not see any freezing. Freezing is unexpected. Maybe the freezing is related to writing the very spammy log messages?

cometjo commented 4 years ago

I wasn't aware of Nestopia not being supported and I think you might be right by looking at the console output of various achievements not being supported. A year ago when I was playing NES games I thought it was. I've actually been playing SNES games with Snesx9x (Current) games lately and only loaded SMB3 up because I knew I could do some quick tests.

So I just did a few a couple of tests with Zelda: A Link to the Past on Snes9x.

  1. First test (unplugging the LAN ethernet cable from my laptop):

[INFO] [RCHEEVOS]: awarding cheevo 943: Illuminating (Acquire the Lamp) [INFO] [RCHEEVOS]: Awarded achievement 943

Everything froze between those two outputs until I hooked the cable back in.

  1. Second test (leaving the LAN up but bringing the WAN down): [INFO] [RCHEEVOS]: awarding cheevo 943: Illuminating (Acquire the Lamp) [ERROR] [RCHEEVOS]: Error awarding achievement 943: Internal error. [ERROR] [RCHEEVOS]: Error awarding achievement 943: Internal error. [ERROR] [RCHEEVOS]: Error awarding achievement 943: Internal error. [INFO] [RCHEEVOS]: Awarded achievement 943

But despite both tests showing that the achievement was awarded if you go to the games page on my account it actually hasn't been attributed.

i30817 commented 4 years ago

Could it be that you're on a single core computer or with the 'threaded tasks' setting turned off.

Retroach is pretty bad at the cooperative multitasking configuration that happens if the 'tasks' can't run on another cpu. You can easily simulate the disaster than happens if you go into the UI options, turn 'show advanced options' to on, turn 'threaded tasks' (or a similar setting) to off and try to savestate on a game.

You'll find that the savestate task will try to divide the savestate memory into chunks of 5 kb (or similar, a fixed value) to display the 'progress bar' and save the chunk to file and update the progress bar on the emulation main loop, completely fucking ruining the core progress to the point it 'looks' frozen (bonus, larger savestates take longer, for instance, ps1 statestates take 3 minutes, and ppsspp can easily 'look' completely frozen).

Now imagine the task is a infinite loop until the network comes up...

cometjo commented 4 years ago

No. Running a quad core with threaded tasks enabled.

1985a commented 4 years ago

In 2016 I was facing this kind of problem, not one could help me. Fortunately, I see that it has already implemented a function in order to deal with this issue.

Jamiras commented 4 years ago

You can easily simulate the disaster than happens if you go into the UI options, turn 'show advanced options' to on, turn 'threaded tasks' (or a similar setting) to off and try to savestate on a game.

I tried the same scenario with threading off, and the spammy-ness of the unlock messages seemed even spammier. It did not appear to impact the performance of the emulator, let along bring it to a standstill.

So I just ran a test on the first level of Super Mario Bros. 3. I started the first level and once I verified that the Cheevos had loaded in the Quick Menu I physically unhooked my internet and did the Backstage achievement. My Nestopia core actually froze the moment it would have triggered until I hooked it back up where it said I had achieved it. I then went over and achieved the Prepare For Take-Off achievement. I then let the stage run out of time and then loaded the achievement page in my browser where it said I had only achieved the Prepare For Take-Off achievement.

I was able to confirm with our server dev that there was no unlock for Backstage (4203) anywhere near the unlock that was captured for Prepare for Take-Off (4126) for the cometjo user. This supports your description of the problem.

But despite both tests showing that the achievement was awarded if you go to the games page on my account it actually hasn't been attributed.

The server dev did find several unlocks for Illuminating (943), one of which was approximately half an hour before your post. Since there were not two unlocks, I can only presume that you were doing more testing than what was reported.

It is concerning that the code thinks the unlock succeeded, even though the server doesn't acknowledge ever being informed. It's more concerning that the "Internal Error" is being reported when the WAN is down, as that mimics the behavior I see when I try to reproduce, but the final call does go through for me. And it's very concerning that the application appears to lock up when the LAN is down. I can't explain any of these.

I have made some changes to address the spamminess of the unlock attempts, which were merged earlier today. The git tag that you've reported in the original description is fairly recent, so I presume you are comfortable building the application and/or using nightlies. I'd be interested to know if this has any impact on the behavior you're seeing.

cometjo commented 4 years ago

I built from Git 8525b9e9cb earlier and just did a test with the same results. One thing I've noted: When I take the WAN down and bring it back up it usually takes up to 30 seconds before I can load a web page (same results with pinging google.com). (The shared internet I use is a nightmare of wifi extenders and repeaters. And for the last day I've taken to tethering my phone when using retroachievements.) But that the achievement will be awarded the instant i plug the cable back in.

cometjo commented 4 years ago

And the same thing if I disconnect the LAN. As soon as the device comes back up the achievement is awarded regardless of whether the internet is accessible or not.

meleu commented 4 years ago

But that the achievement will be awarded the instant i plug the cable back in.

So, the problem seems to be the network, not RetroArch.

Closing this, feel free to reopen if I'm wrong.