https://bugs.winehq.org/show_bug.cgi?id=55026
Bug ID: 55026 Summary: Expose save_period as a configurable option via winecfg Product: Wine Version: 8.10 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: enhancement Priority: P2 Component: wineserver Assignee: wine-bugs@winehq.org Reporter: aros@gmx.com Distribution: ---
Wine dumps registry files to the disk every 30 seconds which might not be good for users of SSD/NVMe disks considering it involves completely rewriting them since they are text files, not binary databases as the real Windows registry is where updates are local and small.
E.g after installing Microsoft Office the system.reg file can easily blow up to tens of megabytes and it's not that funny having this file being rewritten so often.
Would be nice to have this option exposed via winecfg.
https://bugs.winehq.org/show_bug.cgi?id=55026
--- Comment #1 from Artem S. Tashkinov aros@gmx.com --- Oh, I've changed the variable to 600 and it instantly overflown:
server/registry.c:125:42: warning: integer overflow in expression of type ‘int’ results in ‘-1705032704’ [-Woverflow] 125 | static const timeout_t save_period = 600 * -TICKS_PER_SEC; /* delay between periodic saves */ |
https://bugs.winehq.org/show_bug.cgi?id=55026
Artem S. Tashkinov aros@gmx.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|Expose save_period as a |Expose registry save to |configurable option via |disk save_period as a |winecfg |configurable option via | |winecfg
https://bugs.winehq.org/show_bug.cgi?id=55026
--- Comment #2 from Artem S. Tashkinov aros@gmx.com --- Oh, and I'd love to see 0 or -1 as an option: dump the registry files only when the last running Windows application exits.
https://bugs.winehq.org/show_bug.cgi?id=55026
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dark.shadow4@web.de
--- Comment #3 from Fabian Maurer dark.shadow4@web.de --- Are they actually changing (even minor changes) or are they 100% the same? Maybe the could only be written if there is actual changes.
Would you be okay with having a registry key? After all, there's a lot of settings not in winecfg, and I would find it hard to justify this feature getting in there while others don't. I could try and implement it, but I fear a winecfg change might be rejected.
https://bugs.winehq.org/show_bug.cgi?id=55026
--- Comment #4 from Artem S. Tashkinov aros@gmx.com --- (In reply to Fabian Maurer from comment #3)
Are they actually changing (even minor changes) or are they 100% the same? Maybe the could only be written if there is actual changes.
From what I've noticed the registry is dumped every 30 seconds regardless.
Would you be okay with having a registry key? After all, there's a lot of settings not in winecfg, and I would find it hard to justify this feature getting in there while others don't. I could try and implement it, but I fear a winecfg change might be rejected.
I'm totally fine with a registry only setting somewhere in HKEY_LOCAL_MACHINE\Software\Wine
https://bugs.winehq.org/show_bug.cgi?id=55026
--- Comment #5 from Artem S. Tashkinov aros@gmx.com --- In a perfect world it would be great if Wine supported/used some DB backend for registry files. SQLite maybe? No idea if it works for registry though.
I remember Wine used to support native registry files at least for reading. That would have been even better.
https://bugs.winehq.org/show_bug.cgi?id=55026
--- Comment #6 from Nikolay Sivov bunglehead@gmail.com --- Do you actually see it being written every 30 seconds? It's meant to only save branches that have changes in them.
https://bugs.winehq.org/show_bug.cgi?id=55026
--- Comment #7 from Rafał Mużyło galtgendo@o2.pl --- (In reply to Nikolay Sivov from comment #6)
Do you actually see it being written every 30 seconds? It's meant to only save branches that have changes in them.
Well, technically, it's possible...
Let's say there's a game (or a different type of app), that autosaves, but keeps its save in the registry...
Though if it happened on its own, that would be really bad...
https://bugs.winehq.org/show_bug.cgi?id=55026
--- Comment #8 from Fabian Maurer dark.shadow4@web.de --- Created attachment 74631 --> https://bugs.winehq.org/attachment.cgi?id=74631 Make automatic registry save interval configurable
For me it seems to only save if there's changes. I tested by opening regedit and then the system.reg file in notepadqq. I only got notified that the file changed when I changed values in regedit. Of course, it could be that some program you're running makes constant minor registry changes and wineserver needs to flush all these.
Anyways, I added the functionality you want in a patch. Would you mind testing if that works for you?
It's a DWORD called "RegistrySaveInterval" under "HKEY_LOCAL_MACHINE\Software\Wine\Server", representing the number of seconds between automatic saves. 0 means never - flushing at wineserver shutdown is unaffected. This setting does require a wineserver restart though.
https://bugs.winehq.org/show_bug.cgi?id=55026
--- Comment #9 from Artem S. Tashkinov aros@gmx.com --- Created attachment 74634 --> https://bugs.winehq.org/attachment.cgi?id=74634 Registry
(In reply to Fabian Maurer from comment #8)
Created attachment 74631 [details] Make automatic registry save interval configurable
For me it seems to only save if there's changes. I tested by opening regedit and then the system.reg file in notepadqq. I only got notified that the file changed when I changed values in regedit. Of course, it could be that some program you're running makes constant minor registry changes and wineserver needs to flush all these.
Anyways, I added the functionality you want in a patch. Would you mind testing if that works for you?
It's a DWORD called "RegistrySaveInterval" under "HKEY_LOCAL_MACHINE\Software\Wine\Server", representing the number of seconds between automatic saves. 0 means never - flushing at wineserver shutdown is unaffected. This setting does require a wineserver restart though.
Thanks for the patch, I've I've applied it but the server still writes out registry files every 30 seconds despite 0 set as an update interval.
Maybe I created the wrong key?
https://bugs.winehq.org/show_bug.cgi?id=55026
--- Comment #10 from Artem S. Tashkinov aros@gmx.com --- Nah, looks like I did everything correctly, here's the export of the appropriate branch:
REGEDIT4
[HKEY_LOCAL_MACHINE\Software\Wine\Server] "RegistrySaveInterval"=dword:00000000 "Test"="1111"
https://bugs.winehq.org/show_bug.cgi?id=55026
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #74631|0 |1 is obsolete| |
--- Comment #11 from Fabian Maurer dark.shadow4@web.de --- Created attachment 74636 --> https://bugs.winehq.org/attachment.cgi?id=74636 Make automatic registry save interval configurable (v2)
Sorry, I accidentally broke the 0 interval handling in my latest patch. Attaching a fixed version, this should work.
https://bugs.winehq.org/show_bug.cgi?id=55026
--- Comment #12 from Artem S. Tashkinov aros@gmx.com --- This patch works. Thanks!
For the future:
* There's some multiplication going on, so this variable has a maximum of around 280 seconds or something (would be nice if someone told me what's its maximum is exactly) - which is a bit of bummer.
* wineserver only reads it on startup, so you cannot adjust it at runtime i.e. dynamically.
https://bugs.winehq.org/show_bug.cgi?id=55026
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1
--- Comment #13 from Fabian Maurer dark.shadow4@web.de ---
- There's some multiplication going on, so this variable has a maximum of
around 280 seconds or something (would be nice if someone told me what's its maximum is exactly) - which is a bit of bummer.
It's a 64bit multiplication, so there isn't really a limit. Only limit is, it can't be bigger than the 32bit signed integer maximum. Unless I overlooked something, of course. Did you run into troubles using bigger numbers?
The problem with the original code you modified
timeout_t save_period = 600 * -TICKS_PER_SEC
was this being 32bit multiplication.
- wineserver only reads it on startup, so you cannot adjust it at runtime
i.e. dynamically.
As it currently is, every time the registry is saved, it re-evaluates the save-time interval. That should make it easy switching from a 30 second interval to never, but the other way round is impossible. Is that good enough, or do you have a suggestion on how to improve it? Not sure how that would reasonably work. I could monitor all changes to the registry, but that seems like a bad performance impact.
https://bugs.winehq.org/show_bug.cgi?id=55026
--- Comment #14 from Artem S. Tashkinov aros@gmx.com --- (In reply to Fabian Maurer from comment #13)
- There's some multiplication going on, so this variable has a maximum of
around 280 seconds or something (would be nice if someone told me what's its maximum is exactly) - which is a bit of bummer.
It's a 64bit multiplication, so there isn't really a limit. Only limit is, it can't be bigger than the 32bit signed integer maximum. Unless I overlooked something, of course. Did you run into troubles using bigger numbers?
The problem with the original code you modified
timeout_t save_period = 600 * -TICKS_PER_SEC
was this being 32bit multiplication.
I don't follow, sorry. My manual method resulted in an overflow due to multiplication in 32bit mode, now you say it's a 64bit variable. I'm confused.
- wineserver only reads it on startup, so you cannot adjust it at runtime
i.e. dynamically.
As it currently is, every time the registry is saved, it re-evaluates the save-time interval. That should make it easy switching from a 30 second interval to never, but the other way round is impossible. Is that good enough, or do you have a suggestion on how to improve it? Not sure how that would reasonably work. I could monitor all changes to the registry, but that seems like a bad performance impact.
That's actually fine! I've already wasted too much of your time to ask for more.
https://bugs.winehq.org/show_bug.cgi?id=55026
--- Comment #15 from Fabian Maurer dark.shadow4@web.de ---
I don't follow, sorry. My manual method resulted in an overflow due to multiplication in 32bit mode, now you say it's a 64bit variable. I'm confused.
I rewrote the code to use 64bit integers, so no more overflows during multiplication.
https://bugs.winehq.org/show_bug.cgi?id=55026
Artem S. Tashkinov aros@gmx.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED
--- Comment #16 from Artem S. Tashkinov aros@gmx.com --- (In reply to Fabian Maurer from comment #15)
I don't follow, sorry. My manual method resulted in an overflow due to multiplication in 32bit mode, now you say it's a 64bit variable. I'm confused.
I rewrote the code to use 64bit integers, so no more overflows during multiplication.
All good then, thanks a ton!
https://bugs.winehq.org/show_bug.cgi?id=55026
Fabian Maurer dark.shadow4@web.de changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED |---
--- Comment #17 from Fabian Maurer dark.shadow4@web.de --- Good to hear! It's not fixed though, I'll try to get this into upstream soon.
https://bugs.winehq.org/show_bug.cgi?id=55026
--- Comment #18 from Fabian Maurer dark.shadow4@web.de --- Currently watching https://gitlab.winehq.org/wine/wine/-/merge_requests/3124, this will make this feature a lot simpler to implement.