-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RealmWeaver: Excessive amount of reg.exe subprocesses and occasional weaving error #3364
Comments
Hey, this is quite surprising - I haven't seen it happen locally, but I'll try to install |
Thanks so much! That was super quick. It may be that a repro requires a sufficiently complex project. With our Game and Server assemblies, I think we have about 40-ish IEmbeddedObject or IRealmObject implementors used across several assemblies (usually 3-4 per build target). These numbers seem in the same ballpark as the number of popups. Unchecking
That helps, and works well as local workaround. It's not ultimately sufficient for two reasons:
Ideally even both of these are gone / don't open a terminal window, because the extra focus switch can throw off automated UI testing tools, screen readers and other accessibility devices, or most commonly someone typing into another window on another screen while Unity imports assets/compiles/etc.) Probably a different way to invoke the read the registry value than going through a command line process might be enough. Regarding using And there's a potential privacy issue in some jurisdictions. I'd recommend using an equally privacy- and uniqueness-aware value perhaps such as AdvertisingManager.AdvertisingId (from UWP) or if privacy is really not a concern, SystemInfo.deviceUniqueIdentifier from Unity. |
Hey, thanks for that writeup! So the popups that appear seem to be outside of our control - I'm far from an expert on Unity, but I think I've seen them in Realm-less projects where recompiling the scripts causes a domain reload - with a sufficiently complex project, I always see the domain reloading popup. Regarding analytics settings, you're right - those go into editor prefs - I'll need to think whether making them shared is the right call there, but for what it's worth, most CI systems will have the Finally, we're aware of pitfalls with MachineGUID, but that was the only somewhat cross-language solution the team could come up with (we do hash it, so at no point is it available to us in cleartext). The fact it's behaving like that on Unity is definitely not ideal and I'll try to understand if it can be fixed without spawning processes or replace it with one of the suggestions you pointed out (thanks for those!). |
One of my devs here reported that "building remotely sometimes corrupts the schema", I think the underlying issue is that the Weaving Error mentined here doesn't really get picked up as a compilation error. You can then run the application with whatever the Weaver did pick up, and that can in Realm Dev Mode cause some headaches. (and our CI does that by deploying the CI binary and running it) It's the wrong error / exception / process return value, so Unity doesn't know that building/weaving has failed. (not sure how to do this one correctly, never written a post-compile step) |
Sorry, I didn't mean Unity's infamous "hold on" progress bar popup (that one doesn't steal desktop focus - it's just modal to Unity). I mean the ones in the youtube video I linked in the original issue. https://www.youtube.com/watch?v=z8oSXQ5qoBg You can see how it takes away the focus from anything (Unity in that case, but is true for every other application as well) These are CLI / Windows Terminal Sessions, usually opened for that "reg" command. There are still 2 or so of that left. The one after unity has started is particularly problematic, because if you use Jetbrains Rider to develop in Unity, in its default configuration, it requests frequent domain reloads (auto save once every couple of seconds - to give you the most up to date view of the project or something). Same with certain VS Code workflows. That DX is severely disrupted by the terminal pop ups. :) |
Potential immediate low cost fix for the popups (not the excess registry reads, though): If you add the following to I would also recommend against using regex magic to parse something, luckily since Windows 7 SP1 in 2009, all Windows machines can do:
stdout then contains the GUID (or is empty if the value doesn't exist). Additional arguments to include for user safety could be: |
I agree, that looks obnoxious - I am surprised that we still invoke the reg command even with analytics disabled. I'm looking into this now and will report back when I have something. Thanks a lot for your patience with this and really sorry for overlooking that regression. |
Hey, so I think I have a fix for both issues you reported, though I can't easily verify it works since I haven't been able to setup a repro project yet. If it won't be too much hassle, can you give this package a try and let me know if it resolves things for you? |
What happened?
Upon domain reload, there is a chain (often about a minute long) of terminal windows popping up and closing.
This makes the machine unusable (the windows steal focus for a split-second)
The command line for these processes is:
"reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
We pinpointed it to being something from Realm.
There is also an occasional weaving error in particular long chains of these window popups (which can seemingly number >100)
Short example video: https://youtu.be/z8oSXQ5qoBg
In the video, you can see the weaving error come up (only?) after a few of the terminal popups.
Repro steps
Do: Open Unity, or trigger a Domain Reload, or use Tools->Realm->Weave Assemblies.
Observe: system become difficult to use for 1-2 minutes (on some systems, 5-10 seconds) while repeat terminal windows pop up.
There is sometimes a weaving error shown in the console.
The issue was reproducible on Unity LTS, versions 2022.3.1f1 and .3f1. Did not try other versions.
We suspect this started with Realm 11.1.x (11.1.0 and 11.1.2 both display the issue)
Workaround/Resolution/Control Group: 11.0.0 has some of the popups, but they aren't excessive (but they still aren't nice - don't fork processes during Unity domain reload, or run them without a visible terminal window). There is also no weaving error with 11.0.0.
Version
11.1.2
What Atlas Services are you using?
Both Atlas Device Sync and Atlas App Services
What type of application is this?
Unity
Client OS and version
Windows 11 pro x64
Code snippets
No code, this happens on Domain Reload of a somewhat sizeable project.
The command line that Weaver seems to invoke is:
"reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
(on most Windows machines, this will match reg.exe in the path, as it does on mine)
Supplementary investigation:
Issue occurs on some of our laptops and also on my main workstation, with varying impact. Some of the machines have different TPM setups, and some are enrolled in our company's Microsoft Intune, which may add some overhead to registry operations.
From the looks of it, enrolled machines are more seriously affected.
Stacktrace of the exception/crash you're getting
During Domain Reload / Recompile (to be precise, during Unity's "Running Backend" phase), the following error sometimes comes to the console; sometimes repeatedly (we have multiple assemblies in our project, and at least 2 of them have IRealmObjects)
Relevant log output
The text was updated successfully, but these errors were encountered: