Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

Parallel working encoders bug

OTorg
New Contributor III
490 Views

I want to raise the topic of well-known bug inside Intel Media SDK.

The problem arises if:
- several encoders operate simultaneously within a single computer / application
and
- some of that encoders are reinited occasionally (to change coding settings, e.g.), while others perform coding

MFXVideoCORE_SyncOperation / MFXVideoENCODE_EncodeFrameAsync returns MFX_ERR_UNKNOWN / MFX_ERR_NULL_PTR / MFX_ERR_DEVICE_FAILED / MFX_ERR_ABORTED from time to time (MFX_ERR_UNKNOWN in most cases).
Encoder is impossible to work after that.

I have modified a slight your sample_encode (from MediaSamples_MSS_2017_6.0.0.193.msi) to demonstrate the issue:
- (one) parent mfx session is created at application startup and is alive till application end;
- coding is performed under N child sessions (joined to parent);
- encoders and child sessions are reinited (flushed, closed and inited again) after every 500 frames.

I recommend to run it with a similar cmdline:
sample_encodeN.exe h264 -i input.nv12 -o NUL: -nv12 -tff -idr_interval 2 -f 25 -n 500 -b 2000 -u speed -r 5 -g 30 -x 3 -hw -async 4 -d3d11 -w 720 -h 576

First error can arise from several minutes to several hours / days after test application start.
Application stands firm longest under win10.

Recent tests (that reveal a bug) we made on:
core i7-6700, imsdk 1.19 (20.19.15.4483 graphics driver), win7 x64, two x86-processes with four d3d9-encoders nested in each;
atom e3845, imsdk 1.8 (10.18.10.3540 graphics driver), win8 x86, one x86-process with four d3d11-encoders nested in it;
core i7-3770, imsdk 1.11 (10.18.10.4276 graphics driver), win10 x64, two x86-processes with four d3d11-encoders nested in each.

Reproducer application (source, bin and input mediafile) is here:
https://drive.google.com/drive/folders/0B8SCkOT4os4HZGJtWjZ2eUM3eUk?usp=sharing

0 Kudos
8 Replies
OTorg
New Contributor III
490 Views

I have run that reproducer under windbg.

core i7-6700, imsdk 1.19 (20.19.15.4483 graphics), win7 x64.

Got the following after a while:
[plain]
(3288.1440): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for ntdll.dll - 
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Program Files\Intel\Media SDK\libmfxhw32.dll - 
eax=fffffffa ebx=0343d7d0 ecx=baadf00d edx=00000000 esi=0ba063e4 edi=004e3340
eip=0f1aa89a esp=06b0dd64 ebp=06b0dd7c iopl=0         nv up ei pl nz na po nc
cs=0023  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00010202
libmfxhw32!MFXVideoCORE_QueryPlatform+0x5b4a:
0f1aa89a 8b01            mov     eax,dword ptr [ecx]  ds:002b:baadf00d=????????
[/plain]

Code around it (offset 0x0001A89A from libmfxhw32.dll begin):
[plain]
0f1aa883 59              pop     ecx
0f1aa884 5f              pop     edi
0f1aa885 5e              pop     esi
0f1aa886 5b              pop     ebx
0f1aa887 8be5            mov     esp,ebp
0f1aa889 5d              pop     ebp
0f1aa88a c3              ret
0f1aa88b 6a00            push    0
0f1aa88d 6a00            push    0
0f1aa88f e8a7c73000      call    libmfxhw32!MFXVideoVPP_GetVPPStat+0x2facfb (0f4b703b)
0f1aa894 cc              int     3
0f1aa895 8b01            mov     eax,dword ptr [ecx]
0f1aa897 ff604c          jmp     dword ptr [eax+4Ch]
0f1aa89a 8b01            mov     eax,dword ptr [ecx]  ds:002b:baadf00d=???????? *********** it is here *********
0f1aa89c ff605c          jmp     dword ptr [eax+5Ch]
0f1aa89f 8b01            mov     eax,dword ptr [ecx]
0f1aa8a1 ff6040          jmp     dword ptr [eax+40h]
0f1aa8a4 8b01            mov     eax,dword ptr [ecx]
0f1aa8a6 ff6060          jmp     dword ptr [eax+60h]
0f1aa8a9 8b01            mov     eax,dword ptr [ecx]
0f1aa8ab ff6044          jmp     dword ptr [eax+44h]
0f1aa8ae 8b01            mov     eax,dword ptr [ecx]
0f1aa8b0 ff6054          jmp     dword ptr [eax+54h]
0f1aa8b3 8b01            mov     eax,dword ptr [ecx]
0f1aa8b5 ff6048          jmp     dword ptr [eax+48h]
0f1aa8b8 8b01            mov     eax,dword ptr [ecx]
0f1aa8ba ff6058          jmp     dword ptr [eax+58h]
0f1aa8bd 8b01            mov     eax,dword ptr [ecx]
0f1aa8bf ff602c          jmp     dword ptr [eax+2Ch]
[/plain]

Call stack:
[plain]
ChildEBP RetAddr  Args to Child              
06b0dd7c 0f1a78ea 0f1aa89a 0343d7d0 c342adf9 libmfxhw32!MFXVideoCORE_QueryPlatform+0x5b4a
06b0ddc4 0f1e700f 0343d7d0 00000001 c342ade5 libmfxhw32!MFXVideoCORE_QueryPlatform+0x2b9a
06b0de58 0f1e6b19 00000000 0343d778 0343dc94 libmfxhw32!MFXVideoVPP_GetVPPStat+0x2accf
06b0e020 0f1b620d 00000000 0343d778 0343dc94 libmfxhw32!MFXVideoVPP_GetVPPStat+0x2a7d9
06b0e044 0f1b7e85 00000000 0343d778 0343dc94 libmfxhw32!MFXVideoENC_GetVideoParam+0x18d
06b0e378 01174d0f 0b961d4c 00000000 0343d778 libmfxhw32!MFXVideoENCODE_EncodeFrameAsync+0x2d5
06b0e394 01169aac 0342b770 00000000 0343d778 image01160000+0x14d0f
06b0e3b0 0116d631 00000000 0343d778 0343dc94 image01160000+0x9aac
06b0e3f0 01174419 c4a29874 003cfbd0 00000006 image01160000+0xd631
06b0f8e8 01172289 00000000 00000000 06b0f930 image01160000+0x14419
06b0f8f8 707bc556 003cfbd0 c4a26f85 00000000 image01160000+0x12289
06b0f930 707bc600 00000000 06b0f948 75cd338a MSVCR100!endthreadex+0x3a
06b0f93c 75cd338a 00677700 06b0f988 77749882 MSVCR100!endthreadex+0xe4
06b0f948 77749882 00677700 6024bd47 00000000 kernel32!BaseThreadInitThunk+0x12
06b0f988 77749855 707bc59c 00677700 00000000 ntdll!RtlInitializeExceptionChain+0x63
06b0f9a0 00000000 707bc59c 00677700 00000000 ntdll!RtlInitializeExceptionChain+0x36
[/plain]

What else can I do to help in the correction?

0 Kudos
Anna_B_Intel
Employee
490 Views

Hi dj_alek,

I reproduced the problem and provided this information to the development team. Does this issue appear only with AVC encoder?  

Best wishes,

Anna

0 Kudos
OTorg
New Contributor III
490 Views

Anna B. (Intel) wrote:

I reproduced the problem and provided this information to the development team. Does this issue appear only with AVC encoder?  

Hi Anna,

Glad to hear you were able to reproduce the iissue.

We did AVC-encode tests only. Can't say anything about other formats/modules.

Kind regards,
dj_alek

0 Kudos
Anna_B_Intel
Employee
490 Views

Hi dj_alek,

The bug was fixed. Can you check it if we share binaries?

Best wishes,

Anna

0 Kudos
OTorg
New Contributor III
490 Views

Anna B. (Intel) wrote:
The bug was fixed. Can you check it if we share binaries?

Good news! (if it was really fixed:)

Yes, we can check it in the next few days.

 

0 Kudos
OTorg
New Contributor III
490 Views

Anna B. (Intel) wrote:
The bug was fixed. Can you check it if we share binaries?

And where are those binaries?

0 Kudos
Beese__Erin
Beginner
490 Views

Any update on this issue? Is the fix going to be in the next update - I'm experiencing something similar with the H264 encoder.

0 Kudos
OTorg
New Contributor III
490 Views

Beese, Erin wrote:
Any update on this issue?

silence... :)

0 Kudos
Reply