7 Replies Latest reply on Jun 20, 2017 4:17 PM by Intel Corporation

    SR300 + R3 SDK + Unity 3D 5.6.0 Crash !!!

    laugre

      Hi there,

       

      I'm facing a crash with my app built with Unity3D.

      I'm using face module of the R3 SDK to work on face landmarks.

      There is no sample about how to use face module in Unity, only the rawstream sample.

      But I finally get it "working" following the documentation.

      My programm works well except this crash.

      The crash can whenever happen after my app is launched.

      I have not a lot info about the crash except the output_log.txt that Unity generate :

       

      Crash!!!

      SymInit: Symbol-SearchPath: '.;C:\blueyeti\paleosite_morphing\un_air_de_famille;C:\blueyeti\paleosite_morphing\un_air_de_famille;C:\WINDOWS;C:\WINDOWS\system32;SRV*C:\websymbols*http://msdl.microsoft.com/download/symbols;', symOptions: 530, UserName: 'PC_morpho300_2'

      OS-Version: 10.0.14393 () 0x100-0x1

      C:\blueyeti\paleosite_morphing\un_air_de_famille\un_air_de_famille.exe:un_air_de_famille.exe (00007FF7B4720000), size: 23744512 (result: 0), SymType: 'PDB', PDB: '.\player_win_x64.pdb', fileVersion: 5.6.0.31247

      C:\WINDOWS\SYSTEM32\ntdll.dll:ntdll.dll (00007FFA7A6E0000), size: 1904640 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\SYSTEM32\ntdll.dll', fileVersion: 10.0.14393.479

      C:\WINDOWS\System32\KERNEL32.DLL:KERNEL32.DLL (00007FFA7A5A0000), size: 704512 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\KERNEL32.DLL', fileVersion: 10.0.14393.1198

      C:\WINDOWS\System32\KERNELBASE.dll:KERNELBASE.dll (00007FFA779E0000), size: 2215936 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\KERNELBASE.dll', fileVersion: 10.0.14393.1198

      C:\WINDOWS\System32\USER32.dll:USER32.dll (00007FFA799D0000), size: 1462272 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\USER32.dll', fileVersion: 10.0.14393.576

      C:\WINDOWS\System32\win32u.dll:win32u.dll (00007FFA76CD0000), size: 122880 (result: 0), SymType: '-exported-', PDB: 'C:\WINDOWS\System32\win32u.dll', fileVersion: 10.0.14393.51

      .....

       

      and then I can see

      ========== OUTPUTING STACK TRACE ==================

       

       

        ERROR: SymGetSymFromAddr64, GetLastError: 'Tentative d’accès à une adresse non valide.' (Address: 00007FFA4A5BE5AC)

      0x00007FFA4A5BE5AC (libpxcface_idc)

        ERROR: SymGetSymFromAddr64, GetLastError: 'Tentative d’accès à une adresse non valide.' (Address: 00007FFA4A5BDD7C)

      0x00007FFA4A5BDD7C (libpxcface_idc)

        ERROR: SymGetSymFromAddr64, GetLastError: 'Tentative d’accès à une adresse non valide.' (Address: 00007FFA4A5BD08B)

      0x00007FFA4A5BD08B (libpxcface_idc)

        ERROR: SymGetSymFromAddr64, GetLastError: 'Tentative d’accès à une adresse non valide.' (Address: 00007FFA4A56D2CF)

      0x00007FFA4A56D2CF (libpxcface_idc)

      0x00007FFA4A704CF5 (libpxcface_idc) getFaceDetector

        ERROR: SymGetSymFromAddr64, GetLastError: 'Tentative d’accès à une adresse non valide.' (Address: 00007FFA4A55F4B8)

      0x00007FFA4A55F4B8 (libpxcface_idc)

        ERROR: SymGetSymFromAddr64, GetLastError: 'Tentative d’accès à une adresse non valide.' (Address: 00007FFA4A55BEE2)

      0x00007FFA4A55BEE2 (libpxcface_idc)

        ERROR: SymGetSymFromAddr64, GetLastError: 'Tentative d’accès à une adresse non valide.' (Address: 00007FFA4A55BB40)

      0x00007FFA4A55BB40 (libpxcface_idc)

      0x00007FFA4A6F0EB5 (libpxcface_idc) getFaceDetector

        ERROR: SymGetSymFromAddr64, GetLastError: 'Tentative d’accès à une adresse non valide.' (Address: 00007FFA4FF46B5D)

      0x00007FFA4FF46B5D (libpxccore)

        ERROR: SymGetSymFromAddr64, GetLastError: 'Tentative d’accès à une adresse non valide.' (Address: 00007FFA4FF47F8C)

      0x00007FFA4FF47F8C (libpxccore)

        ERROR: SymGetSymFromAddr64, GetLastError: 'Tentative d’accès à une adresse non valide.' (Address: 00007FFA4FF17418)

      0x00007FFA4FF17418 (libpxccore)

        ERROR: SymGetSymFromAddr64, GetLastError: 'Tentative d’accès à une adresse non valide.' (Address: 00007FFA5004ABF1)

      0x00007FFA5004ABF1 (libpxccore)

      0x00007FFA7A5A8364 (KERNEL32) BaseThreadInitThunk

      0x00007FFA7A7470D1 (ntdll) RtlUserThreadStart

       

       

      ========== END OF STACKTRACE ===========

       

      The memory corruption seems to happen in libpxcface_idc.dll.

      Anyone have encountered this problem ?

       

      Here is my Unity C# code, something wrong in my code  ? :

       

      public class RealsenseController : MonoBehaviour

      {

        [Header("Color Settings")]

        public int colorWidth = 1920;

        public int colorHeight = 1080;

        public float colorFPS = 30f;

        public Material RGBMaterial;

       

       

        private SenseManager senseManager = null;

        private SampleReader sampleReader =  null;

        private NativeTexturePlugin texPlugin = null;

       

       

          private FaceModule faceModule;

          private FaceData faceDatas;

          private FaceConfiguration faceConfig;

       

       

          private System.IntPtr colorTex2DPtr = System.IntPtr.Zero;

          public bool cameraPaused = true;

       

       

          private Vector3 headPos = Vector3.zero;

          private Quaternion headRot = Quaternion.identity;

       

       

          private LandmarkPoint[] points;

          private LandmarksData ldata;

          //private bool init = false;

       

       

          // Use this for initialization

          void Start()

          {

              /* Create SenseManager Instance */

              senseManager = SenseManager.CreateInstance();

              senseManager.StatusChanged += OnStatusChanged;

       

       

              /* Create a SampleReader Instance */

              sampleReader = SampleReader.Activate(senseManager);

       

       

              /* Enable Color & Depth Stream */

              sampleReader.EnableStream(StreamType.STREAM_TYPE_COLOR, colorWidth, colorHeight, colorFPS);

       

       

              /* Subscribe to sample arrived event */

              sampleReader.SampleArrived += SampleArrived;

       

       

              faceModule = FaceModule.Activate(senseManager);

              faceDatas = faceModule.CreateOutput();

              faceModule.FrameProcessed += FaceModule_FrameProcessed;

              faceConfig = faceModule.CreateActiveConfiguration();

              //faceConfig.EnableAllAlerts();

              faceConfig.Detection.isEnabled = true;

              faceConfig.Landmarks.isEnabled = true;

              faceConfig.Pose.isEnabled = true;

              faceConfig.TrackingMode = TrackingModeType.FACE_MODE_COLOR_PLUS_DEPTH;

              faceConfig.Strategy = Intel.RealSense.Face.TrackingStrategyType.STRATEGY_CLOSEST_TO_FARTHEST;

              faceConfig.Detection.maxTrackedFaces = 1;

              faceConfig.Landmarks.maxTrackedFaces = 1;

              faceConfig.Pose.maxTrackedFaces = 1;

              faceConfig.ApplyChanges();

       

       

              // Initialize pipeline

              senseManager.Init();

       

       

              // Create NativeTexturePlugin to render Texture2D natively

              texPlugin = NativeTexturePlugin.Activate();

       

       

              // Update material's Texture2D with enabled image size.

              RGBMaterial.mainTexture = new Texture2D(colorWidth, colorHeight, TextureFormat.BGRA32, false);

       

       

              // Flip the image

              //RGBMaterial.mainTextureScale = new Vector2(-1, -1);

       

       

              // Retrieve native Texture2D Pointer

              colorTex2DPtr = RGBMaterial.mainTexture.GetNativeTexturePtr();

       

       

              // Start Streaming

              senseManager.StreamFrames(false);

       

       

          }

       

       

          void SampleArrived(object sender, SampleArrivedEventArgs args)

          {

              if (cameraPaused) return;

              if (args.sample.Color != null)

                  texPlugin.UpdateTextureNative(args.sample.Color, colorTex2DPtr);

          }

       

       

          void OnStatusChanged(object sender, StatusChangedEventArgs args)

          {

              Debug.Log("StatusChanged event " + args.status + " " + args.ToString());

          }

       

       

          private void FaceModule_FrameProcessed(object sender, FrameProcessedEventArgs args)

          {

              if (cameraPaused) return;

              faceDatas.Update();

       

       

              if (faceDatas.NumberOfDetectedFaces <= 0)

                  return;

       

       

              Face face = faceDatas.QueryFaceByIndex(0);

              if (face != null)

              {

                  ldata = face.Landmarks;

                  if (ldata != null)

                  {

                      points = ldata.Points;

                  }

       

       

                  PoseData posDatas = face.Pose;

                  if (posDatas != null)

                  {

                      headPos.Set(-posDatas.HeadPosition.headCenter.x / 1000, posDatas.HeadPosition.headCenter.y / 1000, posDatas.HeadPosition.headCenter.z / 1000);

                      headRot = Quaternion.Euler(-posDatas.Angles.pitch, -posDatas.Angles.yaw, posDatas.Angles.roll);

                  }

              }

          }

       

       

          public Vector2 GetFacePointScreenCoords(LandmarkType pointName)

          {

             if (ldata != null && points != null && points[ldata.QueryPointIndex(pointName)] != null)

                  return points[ldata.QueryPointIndex(pointName)].image;

              else

                  return Vector2.zero;

          }

       

       

          public Vector3 GetFacePointWorldCoords(LandmarkType pointName)

          {

              if (ldata != null && points != null && points[ldata.QueryPointIndex(pointName)] != null)

                  return points[ldata.QueryPointIndex(pointName)].world;

              else

                  return Vector3.zero;

          }

       

       

          public Vector3 GetHeadPosition()

          {

              return headPos;

          }  

       

       

          public Quaternion GetHeadRotation()

          {

              return headRot;

          }

       

       

          public void PauseCamera()

          {

              cameraPaused = true;

          }

       

       

          public void ResumeCamera()

          {

              cameraPaused = false;

          }

       

       

          // Use this for clean up

          void OnDisable()

          {

              /* Clean Up */

              if (sampleReader != null)

              {

                  sampleReader.SampleArrived -= SampleArrived;

                  sampleReader.Dispose();

              }

       

       

              if (senseManager != null) senseManager.Dispose();

          }

       

       

      }

        • 1. Re: SR300 + R3 SDK + Unity 3D 5.6.0 Crash !!!
          MartyG

          There is an issue with R3 that has come up a couple of times where, when a full 'Build And Run' run of a project is done, it works fine if only the core 'Essentials' module is used.  But if the Essentials and Face modules are used together, then it may work fine in an editor test-run but not work in Build and Run mode.  As far as I know there isn't a solution for that yet.

          • 2. Re: SR300 + R3 SDK + Unity 3D 5.6.0 Crash !!!
            laugre

            MartyG a écrit:

             

            There is an issue with R3 that has come up a couple of times where, when a full 'Build And Run' run of a project is done, it works fine if only the core 'Essentials' module is used. But if the Essentials and Face modules are used together, then it may work fine in an editor test-run but not work in Build and Run mode. As far as I know there isn't a solution for that yet.

            Not exactly, the built application works if you manually copy face module dlls in Plugin directory (check realsense SR300 R3 SDK+ Unity3d5.5.2f1 Bug! )

            But the app can whenever crash.

            Here is the error.log :

             

            Unity Player [version: Unity 5.6.0f3_497a0f351392]

             

             

            libpxcface_idc.dll caused an Access Violation (0xc0000005)

              in module libpxcface_idc.dll at 0033:ef09e5ac.

             

             

            Error occurred at 2017-06-05_171650.

            C:\blueyeti\paleosite_morphing\un_air_de_famille\un_air_de_famille.exe, run by Morpho-pc300-7.

            18% memory in use.

            16287 MB physical memory [13235 MB free].

            18719 MB paging file [15015 MB free].

            134217728 MB user address space [134183355 MB free].

            Read from location 00000014 caused an access violation.

             

             

            Context:

            RDI:    0x0ec1eb00  RSI: 0x000000a0  RAX:   0x21ebbde0

            RBX:    0x00000002  RCX: 0xaf4f0000  RDX:   0x000000f0

            RIP:    0xef09e5ac  RBP: 0x000000d9  SegCs: 0x00000033

            EFlags: 0x00010246  RSP: 0x21ebbd90  SegSs: 0x0000002b

            R8:    0x21ebbe20  R9: 0x00000000  R10:   0x00000120

            R11:    0x00000000  R12: 0x00000005  R13:   0x2e1db1f0

            R14:    0x00000140  R15: 0x0000004c

             

             

            Bytes at CS:EIP:

            41 80 7b 14 00 0f 85 73 02 00 00 49 89 e2 48 8d

            ...

            ...

            • 3. Re: SR300 + R3 SDK + Unity 3D 5.6.0 Crash !!!
              MartyG

              My research of your issue indicates that Access Violation 0xc0000005 is a Unity conflict related to graphics / shader rendering that has been experienced by numerous people in non-RealSense projects.

               

              When a Build And Run is done, it writes a lot of shader files into a Shader folder in your Unity project in <project name> > Library > ShaderCache.  In my own project, it writes 3,000 files when I do a Build and Run.

               

              You can manually delete all the contents of the ShaderCache folder once you exit Unity (but not the ShaderCache folder itself) and this may resolve your conflict temporarily.  The shaders will be written again into the folder next time you do a Build and Run though, and one person who cleaned their ShaderCache said their Access Violation 0xc0000005 problem appeared just an hour later.  "I guess I'm going to be cleaning my cache a lot!" they said.

               

              Unity's official shader documentation says about this: "Individual shader variant compilation results are cached in the project, under Library/ShaderCache folder.  This means that 100% identical shaders or their snippets will reuse previously compiled results.  It also means that the shader cache folder can become quite large,  if you have a lot of shaders that are changed often. It is always safe to delete it; it will just cause shader variants to be recompiled."

              • 4. Re: SR300 + R3 SDK + Unity 3D 5.6.0 Crash !!!
                laugre

                Thx I tried to clean Shader cache but no result and I saw the thread dealing with Access Violation 0xc0000005 inside Unity crash

                but as refered in Re: Crash when two people are doing kissing-like gesture and coming close to each other

                we tried outside of unity and got the same crash when at least 2 people face to the camera.

                • 5. Re: SR300 + R3 SDK + Unity 3D 5.6.0 Crash !!!
                  MartyG

                  Given there have been a few similar reports of issues with the face in the R3 SDK, it may be worth Intel referring it to the RealSense developer team to see if the problems can be recreated by them in tests.

                  • 6. Re: SR300 + R3 SDK + Unity 3D 5.6.0 Crash !!!
                    Minimata

                    Hi there,

                     

                    I'm reporting another occurrence of this problem here : SR300 - crash while facetracking multiple people

                     

                    Our problems look similar, but are not quite the same. Maybe, with the ressource in this thread, you'll be able to solve your problem, or it might help you do more tests and give Intel more data to track down the issue.

                    • 7. Re: SR300 + R3 SDK + Unity 3D 5.6.0 Crash !!!
                      Intel Corporation
                      This message was posted on behalf of Intel Corporation

                      Hello, 

                      We have more information on this scenario and have replicated the issue on our end, this has been announced on the following community post: https://communities.intel.com/community/tech/realsense/blog/2017/06/20/known-issue-crash-in-libpxcfaceidcdll-in-realsense-sdk-r3. At the moment we don't have an exact solution to the issue but we found a workaround that is mentioned in the post.

                      We apologize for the inconvenience this has caused all of you.

                      Regards, 
                      Leonardo L