View Issue Details

IDProjectCategoryView StatusLast Update
0001688NoesisGUIC# SDKpublic2020-07-02 19:28
ReporterstonstadAssigned Tojsantos 
PrioritynormalSeveritycrashReproducibilityalways
Status feedbackResolutionopen 
Product Version3.0.0 
Target VersionFixed in Version 
Summary0001688: View.Noesis_View_Update() Hangs Built Player
DescriptionIn player builds, View.Update -> Noesis_View_Update(CPtr, timeInSeconds) enters an endless loop. It is consistent but random. The process runs but Unity stops updating because method Noesis_View_Update never returns. This is in a headless player process.
TagsNo tags attached.
PlatformAny

Activities

stonstad

stonstad

2020-05-19 03:54

reporter   ~0006372

Last edited: 2020-05-19 17:49

View 3 revisions

Circling back for more detail. I launch a headless unity process to generate and save render target textures. The problem with the above method is that it works sometimes, but not all the time. Either it should fail completely or work completely -- and never get stuck in a blocking loop. This was very hard to identify because it only happens in compiled builds.

jsantos

jsantos

2020-05-19 10:43

manager   ~0006373

This is definitely related to having Unity in headless mode. How are you configuring that? Let's see if we can detect this easily.
jsantos

jsantos

2020-05-19 11:30

manager   ~0006374

I assume that checking against SystemInfo.graphicsDeviceID == 0 should be enough right?
jsantos

jsantos

2020-05-19 11:48

manager   ~0006375

Last edited: 2020-05-19 11:49

View 2 revisions

Please, try the following patch

Index: NoesisView.cs
===================================================================
--- NoesisView.cs	(revision 9298)
+++ NoesisView.cs	(working copy)
@@ -840,9 +840,14 @@
     private int _pendingUpdates = 0;
 #endif
 
+    bool IsHeadless()
+    {
+        return SystemInfo.graphicsDeviceType == GraphicsDeviceType.Null;
+    }
+
     void LateUpdate()
     {
-        if (_uiView != null && _visible)
+        if (_uiView != null && _visible && !IsHeadless())
         {
 
 #if UNITY_EDITOR


stonstad

stonstad

2020-05-19 17:42

reporter   ~0006376

I'm working to produce a reproduction project for you. Headless in this scenario does not mean no graphics card. Maybe my terminology is incorrect. Unity calls it 'batch' mode. Render targets are acquired and used but not displayed. I suspect a layout loop issue due to indeterminate size of containers within a XAML hierarchy. Everything works 98% of the time without a change in code -- but the remaining 2% is when something triggers Noesis_View_Update to hang.
stonstad

stonstad

2020-05-19 17:44

reporter   ~0006377

If I give you a player built in development mode -- which reproduces the behavior when clicked, is this sufficient? It would be about 150MB unzipped, which is easier than a source project.
jsantos

jsantos

2020-05-19 18:57

manager   ~0006380

The problem is, Unity is not rendering and Noesis enqueues updates that need to be processed, if they are not processed Update waits and lock for ever if there no render happening. For now I don't need a project repro beacuse I am sure this is what's happening. I need to understand more about your 'headless' to setup. Do you need noesis components enabled in that mode?
stonstad

stonstad

2020-05-19 19:57

reporter   ~0006381

The graphics card is initialized and MonoBehaviour.Update() fires. Noesis components are instantiated and all component Awake, Start, and Update as expected. In this scenario, View.Noesis_View_Update() sometimes hangs, but not consistently. In other words, the application *can* render Noesis Views but sometimes a freeze occurs.

<<Download Link in Private Note >>

Reproduction steps:

1) Unzip to folder and click batchmode.bat
2) A pop-up shows to optionally connect a debugger. Connect a managed debugger or just click OK.
3) A number of PNG files will be generated in the folder. The quantity may vary depending on when the error occurs.
4) The process eventually hangs on View.Noesis_View_Update().

A note on restarting -- make sure that all MBI.CustomerSelect.Unity.PC.exe and Debug (title in task manager) processes are killed before each run.

The log file generated in C:\Users\USER\AppData\LocalLow\Morton Buildings, Inc\ shows entry and exit statements for the aforementioned method.

Log File shows 1) Device Creation:

fxDevice: creating device client; threaded=0
Direct3D:
    Version: Direct3D 11.0 [level 11.1]
    Renderer: NVIDIA GeForce GTX 1650 (ID=0x1f91)

and 2) Entry/Exit statements for Noesis_View_Update

ENTER Noesis_View_Update 0.819999992847443
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
Noesis.View:Update(Double)
NoesisView:LateUpdate()
 
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)

EXIT Noesis_View_Update 0.819999992847443 False
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
Noesis.View:Update(Double)
NoesisView:LateUpdate()

The last statement in the log file is always an ENTER statement.
jsantos

jsantos

2020-06-08 13:57

manager   ~0006427

So in this 'headless' or 'batch' mode can't you disable Noesis component? As far as I understand you are not rendering anything...
stonstad

stonstad

2020-06-16 23:54

reporter   ~0006441

It is possible. I render a UI overlay to display a compass. The problem that I see here is that the behavior is inconsistent. It works as expected until it doesn't -- but why?
stonstad

stonstad

2020-06-23 23:07

reporter   ~0006448

I came across this logic that was recently added, re: pendingUpdates. I'm wondering if this behavior might be fixed now?
jsantos

jsantos

2020-06-29 18:33

manager   ~0006470

In '-batchmode', Unity, sometimes does not execute render commands. I do not understand why. I think a workaround would be enabling 'manual' rendering of noesis, for scenarios like this, where you need to manually invoke 'render' in the component.

What do you think?
stonstad

stonstad

2020-06-29 20:20

reporter   ~0006474

Sure -- I'd be happy to do this. Which method should I manually call to avoid the freeze scenario?
jsantos

jsantos

2020-07-02 19:28

manager   ~0006497

Last edited: 2020-07-02 19:28

View 3 revisions

There is no method for that right now, I am working on a way to expose that in the API.

Meanwhile, could you please try the following patch (it is similar to the one already posted above but I want to make sure it doesn't work)

Index: NoesisView.cs
===================================================================
--- NoesisView.cs	(revision 9298)
+++ NoesisView.cs	(working copy)
@@ -840,9 +840,14 @@
     private int _pendingUpdates = 0;
 #endif
 
+    bool IsHeadless()
+    {
+        return Application.isBatchMode;
+    }
+
     void LateUpdate()
     {
-        if (_uiView != null && _visible)
+        if (_uiView != null && _visible && !IsHeadless())
         {
 
 #if UNITY_EDITOR


Issue History

Date Modified Username Field Change
2020-05-19 03:25 stonstad New Issue
2020-05-19 03:54 stonstad Note Added: 0006372
2020-05-19 10:43 jsantos Note Added: 0006373
2020-05-19 10:44 jsantos Assigned To => jsantos
2020-05-19 10:44 jsantos Status new => feedback
2020-05-19 11:30 jsantos Note Added: 0006374
2020-05-19 11:48 jsantos Note Added: 0006375
2020-05-19 11:49 jsantos Note Edited: 0006375 View Revisions
2020-05-19 17:42 stonstad Note Added: 0006376
2020-05-19 17:42 stonstad Status feedback => assigned
2020-05-19 17:44 stonstad Note Added: 0006377
2020-05-19 17:49 stonstad Note Edited: 0006372 View Revisions
2020-05-19 17:49 stonstad Note Edited: 0006372 View Revisions
2020-05-19 18:57 jsantos Note Added: 0006380
2020-05-19 18:58 jsantos Status assigned => feedback
2020-05-19 19:57 stonstad Note Added: 0006381
2020-05-19 19:57 stonstad Status feedback => assigned
2020-06-08 13:57 jsantos Note Added: 0006427
2020-06-08 13:57 jsantos Status assigned => feedback
2020-06-16 23:54 stonstad Note Added: 0006441
2020-06-16 23:54 stonstad Status feedback => assigned
2020-06-23 23:07 stonstad Note Added: 0006448
2020-06-29 18:33 jsantos Note Added: 0006470
2020-06-29 18:33 jsantos Status assigned => feedback
2020-06-29 20:20 stonstad Note Added: 0006474
2020-06-29 20:20 stonstad Status feedback => assigned
2020-07-02 19:28 jsantos Note Added: 0006497
2020-07-02 19:28 jsantos Status assigned => feedback
2020-07-02 19:28 jsantos Note Edited: 0006497 View Revisions
2020-07-02 19:28 jsantos Note Edited: 0006497 View Revisions