Feature suggestion: Option to create a backup of the last played game at GBM startup. #220
Replies: 21 comments 29 replies
-
|
I'm pretty sure I can just delay the Windows shut down until a backup operation is completed, that will be the cleanest way to do it. This can be done by refusing to let GBM close if there is an operation in progress, which it currently doesn't do. |
Beta Was this translation helpful? Give feedback.
-
|
Thank you. Well, if this could solve the issue, that would be fine by me of course. |
Beta Was this translation helpful? Give feedback.
-
|
The reason I think it can be done is because during the development of an older version, I once had a bug in the shutdown code that seemed to cause GBM to delay Windows shutdown indefinitely. It would just sit on the waiting to shutdown screen until shutdown was forced. But as you say Valve might be using a non-standard method of shutdown that may invalidate what I was doing to cause that behavior. |
Beta Was this translation helpful? Give feedback.
-
|
Well, if you want, I would gladly try a test build to see if it's working. I would actually prefer your "cleaner" way to do this myself, but if it's not working, we can still return to my "backup after restart"-idea, maybe. |
Beta Was this translation helpful? Give feedback.
-
|
Yeah definitely, that's what I was thinking, I'll post a link to a build in this issue to try once I get around to working on it. |
Beta Was this translation helpful? Give feedback.
-
|
I've created a very simple test, this build will attempt to prevent Windows from shutting down in general while GBM is running. If this works in your scenarios as well I'll proceed with the rest of the logic. Backup your current GBM.exe and replace it with the one in the archive. This is based on the current master of v1.2.5, it won't cause any issues going back to the release version. GBM - Prevent Shutdown Build (x64) EDIT: Link Removed |
Beta Was this translation helpful? Give feedback.
-
|
Thank you. Nope, doesn't seem to do anything here... I tried a few options:
(4. with GBM in background, having a game running in Steams Big Picture and try to shut down the PC without even closing the game. PC shuts down.) Well, 4 hasn't anything to do with GBM, but I was not amused to see that Steam even actually offers to shut down windows without quitting the game. However, none of the shutdowns were prevented and they didn't even seem to take any longer. I will try one the second PC now, but that probably will take a few minutes. I will edit the results in here :) Edit: same results on the other PC. |
Beta Was this translation helpful? Give feedback.
-
|
Hmm I just tested it again to make sure I packaged the right executable. It prevented shut down or sign out then timed out back to Windows after a period of time. What version of Windows are you using? |
Beta Was this translation helpful? Give feedback.
-
|
Nope, nothing of that ever happened here. It didn't even show that "waiting for applications to close" screen which you sometimes get when programs are still running while you try to shut down or restart in the first 3 cases (it did show that screen a short moment on test 4, but hadn't even listed GBM there, only Steam itself and the not closed game). Is it that screen where it "stuck" for you before it went back after the time-out? Because if it was, I may have an idea why it didn't work for me... This would be the German version of Windows 10 20H2 (19042) on both machines. |
Beta Was this translation helpful? Give feedback.
-
|
I discovered why it's not working, it only prevents shutdown if the main window is shown and not hidden in the tray. It doesn't need focus, it just needs to not be hidden. I'm assuming this is some kind of prevention mechanism for people that are coding malware to take advantage of this, but I need to dig a bit more. |
Beta Was this translation helpful? Give feedback.
-
|
Yeah, figured out the same thing probably at the same time as you did :) Plus... you should absolutely not have Windows to AutoEndTasks via registry setting. So, with the main window open and reverting that Windows setting, I could reproduce what this new version should do. The "waiting" screen was there for about 20 seconds, then I got logged out. After I logged in again, GBM was still active, the window was still open, however, the backup process failed, but I guess that was to be expected (probably because there wasn't a user logged in and the backup couldn't be finished in these 20 seconds) |
Beta Was this translation helpful? Give feedback.
-
|
Hmm I wonder if it's because the backup process is actually a spawned 7za.exe and that IS being closed. I wasn't counting on that. 😞 I think we will need to go with your idea. I was thinking that if GBM detects a shutdown call while a backup is running, it can just auto-queue it for next start up. |
Beta Was this translation helpful? Give feedback.
-
|
Seems that way. However, if GBM has started that 7za child process (which is has and windows also registered it that way, according to process explorer), shouldn't it stay active as long as GBM.exe is active (unless GBM closed it or it finished it's job, of course)? But maybe that restart-thingy isn't even that bad. You could probably already set-up that "backup on the next start-up"-task right after the backup is triggered and right before the actual backup starts. If it finishes without issue, you just could remove that "task" at the end again. This would probably be quite transparent, it would not add any duplicate backups that aren't needed, and you wouldn't even need to add any options for it. On the other hand, I can clearly see why you aren't that happy with such a solution, but I ran out of ideas how to solve this otherwise myself, too, so I probably won't be much of a help. |
Beta Was this translation helpful? Give feedback.
-
|
Yes you'd think that's how it would work since 7za is a child process of GBM, but I can't see any other reason GBM would indicate that the backup failed once the 20 seconds was up. Do you recall the exact wording in the log? Did 7za show an error or did the output just end? If GBM states "operation failed due to an error" means that 7za shut down unexpectedly. Thanks for the ideas, I'll think on it a bit more. It is something i'd like to solve for you. |
Beta Was this translation helpful? Give feedback.
-
|
Well, I redid the whole thing and that's the (complete) log:
However, above the log window it says: |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for checking again, I tried my own test as well, it's kind of frustrating that I can't use the debugger while testing this scenario. 😀 I'm fairly certain now that in addition to killing child processes it's also killing all other threads except the main UI thread, which is why the backup output simply ends and the main thread reports a failure. I think these are security measures in .NET so you can't pull any malware type shenanigans during shutdown. I'm going to work on another solution, I can't give you a time estimate, but I'll update this issue when/if there's anything you can test. |
Beta Was this translation helpful? Give feedback.
-
|
I want to keep feature requests in the discussion section now, so I've converted this issue. |
Beta Was this translation helpful? Give feedback.
-
|
I think the following solution will solve this issue and also cover other situations such as power outages. The backup queue will now be stored (local db) and each configuration in queue is removed as the backup is completed. On startup, if there's anything left in the queue it will be resumed automatically. This failsafe queue is wiped when operations are manually canceled or anytime a new backup queue is generated. Test build is below, based on the v126 branch. GBM v1.2.6 Beta 2 (x64) Since the beta contains database updates, if you revert back to v1.2.5 you should also restore your gbm.s3db.v125.bak files in your backup folder and in %LOCALAPPDATA%\gbm. Let me know how it goes if you get a chance to test it. 😃 |
Beta Was this translation helpful? Give feedback.
-
|
So far so good. Worked fine here with a manual triggered backup and with a backup started through monitoring. I maybe would consider adding a small delay here (60 seconds or something like that) before the actual backup process starts, because when GBM starts with windows, there is usually a fairly high load, but it's working fine so far. Small question, because I hadn't the time to experiment with it, yet: does the adding to the queue happen a) when the game starts I guess it's b), right? |
Beta Was this translation helpful? Give feedback.
-
|
I actually found a small issue with the 3.26 Beta. Everytime a game isn't closed regulary but instead crashes, I get an unhandled exception/access denied error. This didn't happen with 3.25 plus, after I restart GBM it sometimes crashes again (maybe because of the queue?). However, the same games backup successful if they are closed regularly, and I've never had the issue with any earlier version. Maybe this helps: ************** Ausnahmetext **************
|
Beta Was this translation helpful? Give feedback.
-
Edit: actually, kind of ignore that for now. After restarting everything, I couldn't get GBM to do anything like that again and since I had the server of the game also running, maybe I messed something up here.Nah, there still seems to be something off, somehow... while not an exception-error-message and no crash, I now have literary about 50 entries like that generated in the last 5 minutes (these are only the last few lines) in the log. This time, there wasn't any crash of the game or something like that. The game was normally closed, there isn't any related process of it running in the background and the savegame-backup-file was actually created fine, however... after that, GBM still tries to do... something. Over and over again. [01.03.2021 20:55:13] Valheim backup was cancelled due to session length. Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt. Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
This was with Beta2, of course. :) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there, it's me again :)
I don't know how feasible and most important how much of general use such an option would be. However, after thinking quite a bit about other solutions for my small problem - maybe with third-party-tools or scripts - I couldn't come up with anything really useful, reliable and working.
The problem: my girlfriend usually uses her PC in a remote way... gaming on her laptop via remote play, gaming on tv (and sometimes even on her android tablet) via Steam Link. The issue here is... she also shuts down the host (-> her PC) with these remote devices. In some - not that many - cases it happens, that Windows is already shutting down while GBM hasn't completed the backup, especially if there are either larger savegames files (Minecraft, in our example) or many of them (Skyrim, in our example) so there is a lot of data to compress. I already tried to change the compression settings to "fast" and even store/none but that doesn't reliable help (and no, telling her "don't use that option, just walk the stairs up and turn of your PC like everyone else" didn't either).
So, an option to simply just do a backup of the single last played game as soon as GBM starts (which would be when the PC is turned on again) would solve my issue here. So I would like to ask if something like that is possible to implement at some point.
(another option could be some kind of scheduler to create backups in fixed time intervals, but it seems a bit of bloat for GBM and maybe is not worth the required work, so therefor I think, the above option would be more suitable)
Beta Was this translation helpful? Give feedback.
All reactions