x265 crash

Issue #391 resolved
shinchiro created an issue

I get crashed randomly in a few video file with --pmode on. Using 52782ae and running on Ryzen 7 1700.

CREATE_PROCESS PID=1232 TID=6200 lpBaseOfImage=00007FF6BDA20000 x265.exe
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FF815710000 ntdll.dll
CREATE_THREAD PID=1232 TID=7916
CREATE_THREAD PID=1232 TID=7616
CREATE_THREAD PID=1232 TID=8156
CREATE_THREAD PID=1232 TID=7208
CREATE_THREAD PID=1232 TID=5488
CREATE_THREAD PID=1232 TID=3400
CREATE_THREAD PID=1232 TID=1864
CREATE_THREAD PID=1232 TID=10780
CREATE_THREAD PID=1232 TID=10900
CREATE_THREAD PID=1232 TID=8276
CREATE_THREAD PID=1232 TID=388
CREATE_THREAD PID=1232 TID=9516
CREATE_THREAD PID=1232 TID=9800
CREATE_THREAD PID=1232 TID=1356
CREATE_THREAD PID=1232 TID=9068
CREATE_THREAD PID=1232 TID=10264
CREATE_THREAD PID=1232 TID=4116
CREATE_THREAD PID=1232 TID=6284
CREATE_THREAD PID=1232 TID=6024
CREATE_THREAD PID=1232 TID=8048
CREATE_THREAD PID=1232 TID=9252
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FF812F30000 kernel32.dll
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FF8124D0000 KernelBase.dll
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FF80FF50000 apphelp.dll
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FF813FA0000 shell32.dll
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FF813F00000 msvcrt.dll
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FF812400000 cfgmgr32.dll
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FF812300000 ucrtbase.dll
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FF813930000 SHCore.dll
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FF8135C0000 rpcrt4.dll
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FF813050000 combase.dll
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FF812450000 bcryptprimitives.dll
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FF811B10000 windows.storage.dll
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FF813510000 advapi32.dll
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FF815670000 sechost.dll
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FF812FF0000 shlwapi.dll
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FF813360000 gdi32.dll
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FF812740000 gdi32full.dll
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FF812260000 msvcp_win.dll
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FF8137A0000 user32.dll
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FF8128E0000 win32u.dll
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FF811AF0000 kernel.appcore.dll
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FF811AA0000 powrprof.dll
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FF811A60000 profapi.dll
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FF8092E0000 vcruntime140d.dll
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FFFF1940000 msvcp140d.dll
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FFFF1780000 ucrtbased.dll
LOAD_DLL PID=1232 TID=6200 lpBaseOfDll=00007FF8155E0000 imm32.dll
CREATE_THREAD PID=1232 TID=5516
EXCEPTION PID=1232 TID=5516 ExceptionCode=0x80000003 dwFirstChance=1
EXIT_THREAD PID=1232 TID=5516 dwExitCode=0x0
EXCEPTION PID=1232 TID=9800 ExceptionCode=0xc0000008 dwFirstChance=0
x265.exe caused an Invalid Handle at location 00007FF815712B10 in module ntdll.dll.

AddrPC           Params
00007FF815712B10 FFFFFFFFFFFFFFFF 0000008B043FE480 CCCCCCCCCCCCCCCC  ntdll.dll!RtlRaiseStatus
00007FF81575AF46 0000024E44C7B600 CCCCCCCC00000001 CCCCCCCC00000001  ntdll.dll!RtlpUnWaitCriticalSection
00007FF81573DB17 0000008B03FFF700 CCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCC  ntdll.dll!RtlLeaveCriticalSection
00007FF6BDC8968E 0000008B043FE480 CCCCCCCC0000000B CCCCCCCC00000000  x265.exe!x265::ThreadSafeInteger::incr  [d:\msys\x265_compile\x265\source\common\threading.h @ 238]
   236:         m_val++;
   237:         WakeAllConditionVariable(&m_cv);
>  238:         LeaveCriticalSection(&m_cs);
   239:     }
   240: 
00007FF6BDE8C788 0000024E42222408 CCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCC  x265.exe!x265::WorkerThread::threadMain  [d:\msys\x265_compile\x265\source\common\threadpool.cpp @ 139]
   137:         {
   138:             m_bondMaster->processTasks(m_id);
>  139:             m_bondMaster->m_exitedPeerCount.incr();
   140:             m_bondMaster = NULL;
   141:         }
00007FF6BDD40D2E 0000024E42222408 CCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCC  x265.exe!x265::stackAlignMain  [d:\msys\x265_compile\x265\source\common\threading.cpp @ 91]
    89: {
    90:     // defer processing to the virtual function implemented in the derived class
>   91:     instance->threadMain();
    92: }
    93: 
00007FF6BDD40CE8 0000024E42222408 0000000000000000 0000000000000000  x265.exe!x265::ThreadShim  [d:\msys\x265_compile\x265\source\common\threading.cpp @ 98]
    96: static DWORD WINAPI ThreadShim(Thread *instance)
    97: {
>   98:     STACK_ALIGN(stackAlignMain, instance);
    99: 
   100:     return 0;
00007FF812F41FE4 0000000000000000 0000000000000000 0000000000000000  KERNEL32.DLL!BaseThreadInitThunk
00007FF81577EFC1 0000000000000000 0000000000000000 0000000000000000  ntdll.dll!RtlUserThreadStart

EXIT_THREAD PID=1232 TID=8156 dwExitCode=0xc0000008
EXIT_THREAD PID=1232 TID=7616 dwExitCode=0xc0000008
EXIT_THREAD PID=1232 TID=6200 dwExitCode=0xc0000008
EXIT_THREAD PID=1232 TID=7208 dwExitCode=0xc0000008
EXIT_THREAD PID=1232 TID=3400 dwExitCode=0xc0000008
EXIT_THREAD PID=1232 TID=10780 dwExitCode=0xc0000008
EXIT_THREAD PID=1232 TID=8276 dwExitCode=0xc0000008
EXIT_THREAD PID=1232 TID=1864 dwExitCode=0xc0000008
EXIT_THREAD PID=1232 TID=9516 dwExitCode=0xc0000008
EXIT_THREAD PID=1232 TID=1356 dwExitCode=0xc0000008
EXIT_THREAD PID=1232 TID=9068 dwExitCode=0xc0000008
EXIT_THREAD PID=1232 TID=4116 dwExitCode=0xc0000008
EXIT_THREAD PID=1232 TID=10264 dwExitCode=0xc0000008
EXIT_THREAD PID=1232 TID=6284 dwExitCode=0xc0000008
EXIT_THREAD PID=1232 TID=6024 dwExitCode=0xc0000008
EXIT_THREAD PID=1232 TID=9252 dwExitCode=0xc0000008
EXIT_THREAD PID=1232 TID=10900 dwExitCode=0xc0000008
EXIT_THREAD PID=1232 TID=388 dwExitCode=0xc0000008
EXIT_THREAD PID=1232 TID=5488 dwExitCode=0xc0000008
EXIT_THREAD PID=1232 TID=7916 dwExitCode=0xc0000008
EXIT_THREAD PID=1232 TID=8048 dwExitCode=0xc0000008
EXIT_PROCESS PID=1232 TID=9800 dwExitCode=0xc0000008

Comments (11)

  1. Ashok Kumar Mishra

    Hi Shinchiro,

    Can you please share the command line you have used, so that we can look this issue from our side.

    Thanks Ashok.

  2. shinchiro reporter

    Commandline: --crf 23 --preset veryslow --ctu 32 --max-tu-size 16 --limit-tu 2 --rdpenalty 1 --ssim-rd --psy-rd 2.0 --rc-lookahead 60 --aq-mode 2 --aq-strength 1.2 --bframes 6 --deblock 1:1 --splitrd-skip --pmode --pme --no-rect --no-amp --no-b-intra --no-weightb --no-psy-rdoq --no-rdoq-level --no-strong-intra-smoothing --no-sao

    Some extra info since I think there is race condition bug somewhere

    x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
    x265 [info]: Main 10 profile, Level-3.1 (Main tier)
    x265 [info]: Thread pool created using 16 threads
    x265 [info]: Slices                              : 1
    x265 [info]: frame threads / pool features       : 4 / wpp(23 rows)+pmode+pme
    
  3. shinchiro reporter

    sure

    x265 [info]: HEVC encoder version 2.6+42-52782aeb2081
    x265 [info]: build info [MSVC 1912]
    

    I also passing along these switches when compiling /favor:AMD64 /arch:AVX2 /GS- /GL /Gw

  4. Pradeep Ramachandran Account Deactivated

    Unfortunately, we don't have access to a Ryzen machine to test this out. I don't see the same crash on an Intel x86 machine.

  5. shinchiro reporter

    I wonder if you're still tracking this issue. If yes, I would like to add a few bits observations I saw till now.

    Encoding with pmode on while browsing using firefox quantum will constantly making it crash somewhere

    Leaving the encoding alone without doing any sidework will not crash. Using microsoft edge also doesn't crash

  6. Ashok Kumar Mishra

    You need to look into the application you are working to solve this issue. We can't track this issue since the standalone encoder is working fine with --pmode and --pme. We don't have access to Ryzen m/c. Please check the below log for a test with your command line.

    y4m [info]: 1920x1080 fps 2400/100 i420p8 frames 0 - 239 of 240 raw [info]: output file: test.hevc x265 [info]: HEVC encoder version 2.7+26-ff627c18ce72 x265 [info]: build info [Windows][MSVC 1800][64 bit] 8bit x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 x265 [info]: Main profile, Level-4 (Main tier) x265 [info]: Thread pool created using 8 threads x265 [info]: Slices : 1 x265 [info]: frame threads / pool features : 3 / wpp(34 rows)+pmode+pme x265 [info]: Coding QT: max CU size, min CU size : 32 / 8 x265 [info]: Residual QT: max TU size, max depth : 16 / 3 inter / 3 intra x265 [info]: ME / range / subpel / merge : star / 57 / 4 / 4 x265 [info]: Keyframe min / max / scenecut / bias: 24 / 250 / 40 / 5.00 x265 [info]: Intra 32x32 TU penalty type : 1 x265 [info]: Lookahead / bframes / badapt : 60 / 6 / 2 x265 [info]: b-pyramid / weightp / weightb : 1 / 1 / 0 x265 [info]: References / ref-limit cu / depth : 5 / off / on x265 [info]: AQ: mode / str / qg-size / cu-tree : 2 / 1.2 / 32 / 1 x265 [info]: Rate Control / qCompress : CRF-23.0 / 0.60 x265 [info]: tools: limit-modes rd=6 ssim-rd psy-rd=2.00 rskip splitrd-skip x265 [info]: tools: limit-tu=2 signhide tmvp deblock(tC=1:B=1) x265 [info]: frame I: 2, Avg QP:22.05 kb/s: 33385.63 x265 [info]: frame P: 44, Avg QP:22.95 kb/s: 14785.56 x265 [info]: frame B: 194, Avg QP:28.16 kb/s: 2973.14 x265 [info]: Weighted P-Frames: Y:0.0% UV:0.0% x265 [info]: consecutive B-frames: 6.5% 0.0% 0.0% 26.1% 8.7% 43.5% 15.2%

    encoded 240 frames in 123.37s (1.95 fps), 5392.19 kb/s, Avg QP:27.16

  7. Log in to comment