Skip to content
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

Closed
moritz-mg opened this issue Jun 27, 2023 · 8 comments · Fixed by #3365
Closed
Assignees

Comments

@moritz-mg
Copy link

moritz-mg commented Jun 27, 2023

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)

Cannot access a closed Stream.
UnityEngine.Debug:LogError (object)
RealmWeaver.UnityWeaver/UnityLogger:Error (string,Mono.Cecil.Cil.SequencePoint)
RealmWeaver.Analytics:AnalyzeUserAssembly (Mono.Cecil.ModuleDefinition)
RealmWeaver.Analytics/<>c__DisplayClass9_0:<.ctor>b__2 ()
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback ()

Relevant log output

Procmon shows me about a hundred of these while it happens:

(timing: occurs on domain reload, after "UnityShaderCompiler.exe" has been run)

10:50:44,3890301	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 34140, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:50:45,5475257	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 53424, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:50:46,9081140	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 43148, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:50:47,9289785	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 35036, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:50:47,9370991	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 49856, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:50:49,7383932	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 49704, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:50:50,8915047	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 51696, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:50:52,3571933	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 34668, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:50:53,5867852	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 36504, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:50:54,5992992	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 14180, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:50:55,8374771	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 53684, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:50:55,8417065	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 37944, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:50:57,5686422	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 51820, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:50:57,5748712	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 8156, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:50:59,2912912	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 37620, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:00,4557312	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 30280, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:00,4631666	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 50112, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:02,3812887	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 42708, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:03,3477666	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 40444, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:04,3811654	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 51260, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:05,4155012	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 30020, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:06,3228254	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 49796, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:06,3278517	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 37716, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:08,0265047	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 9432, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:09,0132341	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 24964, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:09,9369646	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 47364, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:10,9006602	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 47392, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:11,9248231	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 43344, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:11,9298902	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 47588, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:13,7209245	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 3644, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:14,6447033	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 50044, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:15,5795654	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 45956, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:16,5507595	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 35824, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:17,4840020	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 35000, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:18,4600102	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 29900, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:19,8262118	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 30708, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:20,8188985	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 54436, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:21,9198501	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 40852, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:22,8449601	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 52712, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:22,8500271	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 35580, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:24,5733994	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 49220, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:25,5193511	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 4532, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:26,4447912	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 39848, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:27,3940030	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 52248, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:28,3488587	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 41216, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:29,3018601	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 49640, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:30,2471427	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 43720, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:31,1780646	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 54676, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:32,1049015	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 48404, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:33,0255314	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 38800, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:33,9479591	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 50292, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:34,9102009	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 14216, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:35,9921286	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 51044, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:37,0787442	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 50372, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:38,1060605	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 54132, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:39,1729996	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 49984, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:40,2080607	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 50240, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:41,1923977	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 48548, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:42,1436497	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 50800, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:43,1203501	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 1520, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:44,1126060	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 29152, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:45,1327748	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 53240, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:46,0845740	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 43844, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:47,0232558	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 24616, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:48,0538519	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 40444, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:48,9680966	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 25932, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:49,9097467	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 44932, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:50,8581871	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 20232, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:51,8267679	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 40836, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:52,7583827	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 27600, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:53,6920683	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 48024, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:51:54,6615661	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\reg.exe	SUCCESS	PID: 50336, Command line: "reg" QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography -v MachineGuid
10:54:06,5229182	Unity.exe	51840	Process Create	C:\WINDOWS\SYSTEM32\cmd.exe	SUCCESS	PID: 4316, Command line: cmd.exe /c "C:/Unity/Editor/2022.3.1f1/Editor/Data\Tools\RoslynScripts\kill_csc_server.bat"
@nirinchev
Copy link
Member

Hey, this is quite surprising - I haven't seen it happen locally, but I'll try to install 2022.3.1f1 and see if I can reproduce it. This appears to be caused by a recent change in the logic for computing the anonymized computer id for metrics submission. While we investigate, you can disable analytics submission by removing the checkbox in Tools/Realm/Enable build-time analytics.

@moritz-mg
Copy link
Author

moritz-mg commented Jun 27, 2023

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 Tools->Realm->Enable Build time analytics gives me the behaviour from 11.0.0, which is:

  • 1 popup just after Unity Editor's Splash Screen closes
  • 1 popup on domain reload

That helps, and works well as local workaround. It's not ultimately sufficient for two reasons:

  • value seems to be persisted in EditorPrefs, not ProjectSettings, and thus is not replicated to other machines
    -- specifically other developers and our automated build machines
  • there are still 2 popups that grab user focus for a split second

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 (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography).MachineGUIDas a machine identifier, there are potential pitfalls with this, such as from "machines" installed from disk images or run in docker containers. Legend is that scores of laptops in some companies have the same MachineGuid.

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.

@nirinchev
Copy link
Member

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 CI environment variable declared, which we also check for, so those should not be attempting to submit analytics.

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!).

@nirinchev nirinchev self-assigned this Jun 27, 2023
@moritz-mg
Copy link
Author

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)

@moritz-mg
Copy link
Author

moritz-mg commented Jun 27, 2023

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.

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. :)

@moritz-mg
Copy link
Author

moritz-mg commented Jun 27, 2023

Potential immediate low cost fix for the popups (not the excess registry reads, though):

https://github.com/realm/realm-dotnet/blob/cdbbd8dbd3087a314ae7f275ee51715ebc96d3ca/Realm/Realm.Weaver/Analytics/AnalyticsUtils.cs#L260C33-L260C49

If you add the following to ProcessStartInfo's initializer, you get a much gentler UX:
CreateNoWindow = true,

I would also recommend against using regex magic to parse something, luckily since Windows 7 SP1 in 2009, all Windows machines can do:

FileName = "pwsh",
Arguments = "-Command (Get-ItemProperty Registry::HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Cryptography).MachineGUID",

stdout then contains the GUID (or is empty if the value doesn't exist).

Additional arguments to include for user safety could be:
-NoProfile -NonInteractive

@nirinchev
Copy link
Member

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.

@nirinchev
Copy link
Member

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?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants