Short version:
Opening/reading mp4 files with Xuggler sometimes does not work properly but causes program to crash.
Long version:
In my program i read, modify and write video files. It works fine with most formats i tested (avi, flv, mpg, mkv). The Xuggler functions i use are mostly:
//Example 1 IContainer container = IContainer.make(); int result = container.open(filename, IContainer.Type.READ, null);
and
//Example 2 IMediaReader filmReader = ToolFactory.makeReader(filename); filmReader.readPacket(); filmReader.close();
Working on mp4 file is lottery. Some files work mostly fine. Some files work with the Example 1 but not with Example 2 or vice versa. With some files program runs if it's Debug mode and with some it does not run in debug mode.
The effect i usually get is an error (look at the bottom of post).
The answer i'm looking for is why this happens and more importantly is it possible to fix?
Problem is especially hard for me to investigate because it seems semi random. It may behave differently in debug mode, sometimes even the time i wait in debug mode before pressing continue may cause program to run properly or crash.
Adding seemingly unrelated code may cause program to stop working with some files. For example:
Adding line:
IContainer container1 = IContainer.make();
Before program:
IMediaReader filmReader = ToolFactory.makeReader(filename); filmReader.readPacket(); filmReader.close(); IContainer container = IContainer.make(); int result = container.open(filename, IContainer.Type.READ, null); System.out.println(result);
Cause crashes with files that worked properly before.
The error:
# # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000006ee76520, pid=4448, tid=7192 # # JRE version: Java(TM) SE Runtime Environment (8.0_40-b26) (build 1.8.0_40-b26) # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.40-b25 mixed mode windows-amd64 compressed oops) # Problematic frame: # C [xuggle6554930242940580036.dll+0x736520] # # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows # # An error report file with more information is saved as: # C:\Michal\Java Workspace\TestMP4\hs_err_pid4448.log # # If you would like to submit a bug report, please visit: # http://bugreport.java.com/bugreport/crash.jsp # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. #
The log:
# # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000006ee76520, pid=1164, tid=8360 # # JRE version: Java(TM) SE Runtime Environment (8.0_40-b26) (build 1.8.0_40-b26) # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.40-b25 mixed mode windows-amd64 compressed oops) # Problematic frame: # C [xuggle7482689414368935779.dll+0x736520] # # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows # # If you would like to submit a bug report, please visit: # http://bugreport.java.com/bugreport/crash.jsp # The crash happened outside the Java Virtual Machine in native code. # See problematic frame for where to report the bug. # --------------- T H R E A D --------------- Current thread (0x00000000021fe800): JavaThread "main" [_thread_in_native, id=8360, stack(0x0000000002200000,0x0000000002300000)] siginfo: ExceptionCode=0xc0000005, reading address 0xffffffffffffffff Registers: RAX=0x00000000003e1130, RBX=0x0000000058fc0120, RCX=0x00000000003e1130, RDX=0x0000000000000009 RSP=0x00000000022fdd60, RBP=0x00000000003e0870, RSI=0x00000000003e2130, RDI=0x0000000000000004 R8 =0x000000006ee77580, R9 =0x000000006ee76490, R10=0x000000005902e880, R11=0x00000000003d16a0 R12=0x00000000003d1ea0, R13=0x0000000000000004, R14=0x0000000000000184, R15=0x000000006fab8f20 RIP=0x000000006ee76520, EFLAGS=0x0000000000010202 Top of Stack: (sp=0x00000000022fdd60) 0x00000000022fdd60: 000000006ee76665 000000006ee774c5 0x00000000022fdd70: 000000006ee77505 000000006ee77545 0x00000000022fdd80: 000000006ee77585 000000006ee79426 0x00000000022fdd90: 000000006fab8f20 00000000003e1130 0x00000000022fdda0: 0000000058fc25e0 0000000002650006 0x00000000022fddb0: 3fe0000000000000 0000000000000000 0x00000000022fddc0: 40c7760000000000 0000000000000000 0x00000000022fddd0: 3fe0000000000000 0000000000000000 0x00000000022fdde0: 0000000058fc35e0 000000006ea45d24 0x00000000022fddf0: 3f40624dd2f1a9fc 0000000000000000 0x00000000022fde00: 0000000000000000 0000000000000000 0x00000000022fde10: 0000000000000000 0000000000000000 0x00000000022fde20: 0000000058fcc4e0 000000006fab7320 0x00000000022fde30: 0000000055dbdc5d 0000000058fc0080 0x00000000022fde40: 0000000000000000 00000000003e0870 0x00000000022fde50: 00000000003e0870 0000000000000000 Instructions: (pc=0x000000006ee76520) 0x000000006ee76500: c4 e3 5d 0c c0 55 c5 e4 5c c8 c5 e4 58 c0 c5 fc 0x000000006ee76510: 29 01 c5 fc 29 49 20 c3 0f 1f 84 00 00 00 00 00 0x000000006ee76520: c5 fc 28 51 40 c5 fc 28 59 60 c5 ec 5c fb c5 ec 0x000000006ee76530: 58 d3 c5 c4 57 3d 26 41 84 00 c5 ec c6 df be c5 Register to memory mapping: RAX=0x00000000003e1130 is an unknown value RBX=0x0000000058fc0120 is an unknown value RCX=0x00000000003e1130 is an unknown value RDX=0x0000000000000009 is an unknown value RSP=0x00000000022fdd60 is pointing into the stack for thread: 0x00000000021fe800 RBP=0x00000000003e0870 is an unknown value RSI=0x00000000003e2130 is an unknown value RDI=0x0000000000000004 is an unknown value R8 =0x000000006ee77580 is an unknown value R9 =0x000000006ee76490 is an unknown value R10=0x000000005902e880 is an unknown value R11=0x00000000003d16a0 is an unknown value R12=0x00000000003d1ea0 is an unknown value R13=0x0000000000000004 is an unknown value R14=0x0000000000000184 is an unknown value R15=0x000000006fab8f20 is an unknown value Stack: [0x0000000002200000,0x0000000002300000], sp=0x00000000022fdd60, free space=1015k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) C [xuggle7482689414368935779.dll+0x736520] Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j com.xuggle.xuggler.XugglerJNI.IContainer_open__SWIG_1(JLcom/xuggle/xuggler/IContainer;Ljava/lang/String;IJLcom/xuggle/xuggler/IContainerFormat;ZZ)I+0 j com.xuggle.xuggler.IContainer.open(Ljava/lang/String;Lcom/xuggle/xuggler/IContainer$Type;Lcom/xuggle/xuggler/IContainerFormat;ZZ)I+19 j com.xuggle.mediatool.MediaReader.open()V+20 j com.xuggle.mediatool.MediaReader.readPacket()Lcom/xuggle/xuggler/IError;+8 j testmp4.TestMP4.main([Ljava/lang/String;)V+9 v ~StubRoutines::call_stub --------------- P R O C E S S --------------- Java Threads: ( => current thread ) 0x000000005631f800 JavaThread "Service Thread" daemon [_thread_blocked, id=5712, stack(0x0000000058560000,0x0000000058660000)] 0x0000000057d41000 JavaThread "C1 CompilerThread2" daemon [_thread_blocked, id=1836, stack(0x0000000058410000,0x0000000058510000)] 0x0000000057d40800 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=8572, stack(0x0000000058200000,0x0000000058300000)] 0x0000000056318000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=8172, stack(0x0000000057c40000,0x0000000057d40000)] 0x0000000056316800 JavaThread "Attach Listener" daemon [_thread_blocked, id=9060, stack(0x0000000057a00000,0x0000000057b00000)] 0x0000000056313800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=7208, stack(0x0000000057830000,0x0000000057930000)] 0x00000000562b7000 JavaThread "Finalizer" daemon [_thread_blocked, id=9876, stack(0x0000000057700000,0x0000000057800000)] 0x00000000562b0000 JavaThread "Reference Handler" daemon [_thread_blocked, id=10068, stack(0x0000000057560000,0x0000000057660000)] =>0x00000000021fe800 JavaThread "main" [_thread_in_native, id=8360, stack(0x0000000002200000,0x0000000002300000)] Other Threads: 0x00000000562aa800 VMThread [stack: 0x0000000057370000,0x0000000057470000] [id=5480] 0x0000000057de5800 WatcherThread [stack: 0x00000000586c0000,0x00000000587c0000] [id=8516] VM state:not at safepoint (normal execution) VM Mutex/Monitor currently owned by a thread: None Heap: PSYoungGen total 28672K, used 8878K [0x00000000e0300000, 0x00000000e2300000, 0x0000000100000000) eden space 24576K, 36% used [0x00000000e0300000,0x00000000e0bab8e8,0x00000000e1b00000) from space 4096K, 0% used [0x00000000e1f00000,0x00000000e1f00000,0x00000000e2300000) to space 4096K, 0% used [0x00000000e1b00000,0x00000000e1b00000,0x00000000e1f00000) ParOldGen total 65536K, used 0K [0x00000000a0800000, 0x00000000a4800000, 0x00000000e0300000) object space 65536K, 0% used [0x00000000a0800000,0x00000000a0800000,0x00000000a4800000) Metaspace used 5529K, capacity 5564K, committed 5888K, reserved 1056768K class space used 645K, capacity 660K, committed 768K, reserved 1048576K Card table byte_map: [0x0000000011a10000,0x0000000011d10000] byte_map_base: 0x000000001150c000 Marking Bits: (ParMarkBitMap*) 0x0000000059fc4040 Begin Bits: [0x0000000012660000, 0x0000000013e40000) End Bits: [0x0000000013e40000, 0x0000000015620000) Polling page: 0x0000000001c80000 CodeCache: size=245760Kb used=1840Kb max_used=1840Kb free=243919Kb bounds [0x0000000002650000, 0x00000000028c0000, 0x0000000011650000] total_blobs=690 nmethods=352 adapters=251 compilation: enabled Compilation events (10 events): Event: 1.648 Thread 0x0000000057d41000 348 3 java.net.URLClassLoader$1::run (5 bytes) Event: 1.649 Thread 0x0000000057d41000 nmethod 348 0x000000000281cd50 code [0x000000000281cec0, 0x000000000281d068] Event: 1.649 Thread 0x0000000057d41000 349 ! 3 java.net.URLClassLoader$1::run (63 bytes) Event: 1.649 Thread 0x0000000057d41000 nmethod 349 0x000000000281c390 code [0x000000000281c560, 0x000000000281ca88] Event: 1.649 Thread 0x0000000057d41000 350 s 3 sun.misc.Resource::cachedInputStream (20 bytes) Event: 1.650 Thread 0x0000000057d41000 nmethod 350 0x000000000281bd90 code [0x000000000281bf00, 0x000000000281c2c8] Event: 1.652 Thread 0x0000000057d41000 351 s! 3 java.net.URLStreamHandler::getHostAddress (54 bytes) Event: 1.652 Thread 0x0000000057d41000 nmethod 351 0x000000000281b110 code [0x000000000281b2c0, 0x000000000281ba58] Event: 1.659 Thread 0x0000000057d41000 352 3 java.lang.ref.WeakReference::<init> (7 bytes) Event: 1.659 Thread 0x0000000057d41000 nmethod 352 0x000000000281ac10 code [0x000000000281ad80, 0x000000000281b030] GC Heap History (0 events): No events Deoptimization events (0 events): No events Internal exceptions (10 events): Event: 0.081 Thread 0x00000000021fe800 Exception <a 'java/security/PrivilegedActionException'> (0x00000000e0497968) thrown at [D:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u40\3098\hotspot\src\share\vm\prims\jvm.cpp, line 1382] Event: 0.081 Thread 0x00000000021fe800 Exception <a 'java/security/PrivilegedActionException'> (0x00000000e0498c08) thrown at [D:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u40\3098\hotspot\src\share\vm\prims\jvm.cpp, line 1382] Event: 0.081 Thread 0x00000000021fe800 Exception <a 'java/security/PrivilegedActionException'> (0x00000000e0498dc0) thrown at [D:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u40\3098\hotspot\src\share\vm\prims\jvm.cpp, line 1382] Event: 0.081 Thread 0x00000000021fe800 Exception <a 'java/security/PrivilegedActionException'> (0x00000000e0499fe8) thrown at [D:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u40\3098\hotspot\src\share\vm\prims\jvm.cpp, line 1382] Event: 0.081 Thread 0x00000000021fe800 Exception <a 'java/security/PrivilegedActionException'> (0x00000000e049a1a0) thrown at [D:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u40\3098\hotspot\src\share\vm\prims\jvm.cpp, line 1382] Event: 0.107 Thread 0x00000000021fe800 Exception <a 'java/security/PrivilegedActionException'> (0x00000000e0578158) thrown at [D:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u40\3098\hotspot\src\share\vm\prims\jvm.cpp, line 1382] Event: 0.107 Thread 0x00000000021fe800 Exception <a 'java/security/PrivilegedActionException'> (0x00000000e0578310) thrown at [D:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u40\3098\hotspot\src\share\vm\prims\jvm.cpp, line 1382] Event: 0.108 Thread 0x00000000021fe800 Exception <a 'java/security/PrivilegedActionException'> (0x00000000e057c238) thrown at [D:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u40\3098\hotspot\src\share\vm\prims\jvm.cpp, line 1382] Event: 0.108 Thread 0x00000000021fe800 Exception <a 'java/security/PrivilegedActionException'> (0x00000000e057c3f0) thrown at [D:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u40\3098\hotspot\src\share\vm\prims\jvm.cpp, line 1382] Event: 0.135 Thread 0x00000000021fe800 Exception <a 'java/io/FileNotFoundException'> (0x00000000e07157c0) thrown at [D:\re\workspace\8-2-build-windows-amd64-cygwin\jdk8u40\3098\hotspot\src\share\vm\prims\jni.cpp, line 709] Events (10 events): Event: 1.654 loading class java/util/concurrent/TimeUnit$6 Event: 1.655 loading class java/util/concurrent/TimeUnit$6 done Event: 1.655 loading class java/util/concurrent/TimeUnit$7 Event: 1.655 loading class java/util/concurrent/TimeUnit$7 done Event: 1.658 loading class com/xuggle/xuggler/IContainer$Type Event: 1.658 loading class com/xuggle/xuggler/IContainer$Type done Event: 1.659 loading class com/xuggle/xuggler/IContainer$Type$SwigNext Event: 1.659 loading class com/xuggle/xuggler/IContainer$Type$SwigNext done Event: 1.659 loading class com/xuggle/xuggler/IContainerFormat Event: 1.659 loading class com/xuggle/xuggler/IContainerFormat done Dynamic libraries: 0x000000013fca0000 - 0x000000013fcd7000 C:\Program Files\Java\jdk1.8.0_40\bin\java.exe 0x0000000077190000 - 0x0000000077339000 C:\Windows\SYSTEM32\ntdll.dll 0x0000000076f70000 - 0x000000007708f000 C:\Windows\system32\kernel32.dll 0x000007fefc210000 - 0x000007fefc27c000 C:\Windows\system32\KERNELBASE.dll 0x000007fefce80000 - 0x000007fefcf5b000 C:\Windows\system32\ADVAPI32.dll 0x000007fefc650000 - 0x000007fefc6ef000 C:\Windows\system32\msvcrt.dll 0x000007fefcf60000 - 0x000007fefcf7f000 C:\Windows\SYSTEM32\sechost.dll 0x000007fefd110000 - 0x000007fefd23d000 C:\Windows\system32\RPCRT4.dll 0x0000000077090000 - 0x000000007718a000 C:\Windows\system32\USER32.dll 0x000007fefce10000 - 0x000007fefce77000 C:\Windows\system32\GDI32.dll 0x000007fefca10000 - 0x000007fefca1e000 C:\Windows\system32\LPK.dll 0x000007fefd240000 - 0x000007fefd309000 C:\Windows\system32\USP10.dll 0x000007fefaa50000 - 0x000007fefac44000 C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_fa396087175ac9ac\COMCTL32.dll 0x000007fefc280000 - 0x000007fefc2f1000 C:\Windows\system32\SHLWAPI.dll 0x000007fefcd40000 - 0x000007fefcd6e000 C:\Windows\system32\IMM32.DLL 0x000007fefca20000 - 0x000007fefcb29000 C:\Windows\system32\MSCTF.dll 0x000007fef3430000 - 0x000007fef34bd000 C:\Program Files (x86)\AVG\AVG2015\avghooka.dll 0x000000005ade0000 - 0x000000005aeb2000 C:\Program Files\Java\jdk1.8.0_40\jre\bin\msvcr100.dll 0x00000000597c0000 - 0x000000005a043000 C:\Program Files\Java\jdk1.8.0_40\jre\bin\server\jvm.dll 0x000007fef5130000 - 0x000007fef5139000 C:\Windows\system32\WSOCK32.dll 0x000007fefc7e0000 - 0x000007fefc82d000 C:\Windows\system32\WS2_32.dll 0x000007fefc6f0000 - 0x000007fefc6f8000 C:\Windows\system32\NSI.dll 0x000007fef9010000 - 0x000007fef904b000 C:\Windows\system32\WINMM.dll 0x000007fefaf40000 - 0x000007fefaf4c000 C:\Windows\system32\VERSION.dll 0x0000000077350000 - 0x0000000077357000 C:\Windows\system32\PSAPI.DLL 0x000000005c230000 - 0x000000005c23f000 C:\Program Files\Java\jdk1.8.0_40\jre\bin\verify.dll 0x000000005c200000 - 0x000000005c229000 C:\Program Files\Java\jdk1.8.0_40\jre\bin\java.dll 0x000000005c1e0000 - 0x000000005c1f6000 C:\Program Files\Java\jdk1.8.0_40\jre\bin\zip.dll 0x000007fefd310000 - 0x000007fefe099000 C:\Windows\system32\SHELL32.dll 0x000007fefcb30000 - 0x000007fefcd33000 C:\Windows\system32\ole32.dll 0x000007fefbed0000 - 0x000007fefbedf000 C:\Windows\system32\profapi.dll 0x000007fefb6c0000 - 0x000007fefb6d8000 C:\Windows\system32\CRYPTSP.dll 0x000007fefb3c0000 - 0x000007fefb407000 C:\Windows\system32\rsaenh.dll 0x000007fefc090000 - 0x000007fefc0ae000 C:\Windows\system32\USERENV.dll 0x000007fefbd20000 - 0x000007fefbd2f000 C:\Windows\system32\CRYPTBASE.dll 0x000000005c1c0000 - 0x000000005c1da000 C:\Program Files\Java\jdk1.8.0_40\jre\bin\net.dll 0x000007fefb660000 - 0x000007fefb6b5000 C:\Windows\system32\mswsock.dll 0x000007fefb650000 - 0x000007fefb657000 C:\Windows\System32\wship6.dll 0x000007fef8730000 - 0x000007fef8757000 C:\Windows\system32\IPHLPAPI.DLL 0x000007fef8780000 - 0x000007fef878b000 C:\Windows\system32\WINNSI.DLL 0x000007fef83c0000 - 0x000007fef83d8000 C:\Windows\system32\dhcpcsvc.DLL 0x000007fef8050000 - 0x000007fef8061000 C:\Windows\system32\dhcpcsvc6.DLL 0x000000005ba80000 - 0x000000005ba91000 C:\Program Files\Java\jdk1.8.0_40\jre\bin\nio.dll 0x000000006e740000 - 0x000000006fda5000 C:\Users\User\AppData\Local\Temp\xuggle\xuggle7482689414368935779.dll 0x000007feefda0000 - 0x000007feefdb7000 C:\Windows\system32\AVICAP32.dll 0x000007feef200000 - 0x000007feef229000 C:\Windows\system32\MSVFW32.dll 0x000007fef63b0000 - 0x000007fef64d5000 C:\Windows\system32\dbghelp.dll VM Arguments: jvm_args: -Dfile.encoding=UTF-8 java_command: testmp4.TestMP4 java_class_path (initial): C:\Michal\Java Workspace\Xuggler\commons-cli-1.2-bin\commons-cli-1.2\commons-cli-1.2.jar;C:\Michal\Java Workspace\Xuggler\xuggle-xuggler-5.4.jar;C:\Michal\Java Workspace\Xuggler\logback-1.1.2\logback-1.1.2\logback-classic-1.1.2.jar;C:\Michal\Java Workspace\Xuggler\logback-1.1.2\logback-1.1.2\logback-core-1.1.2.jar;C:\Michal\Java Workspace\Xuggler\slf4j-1.7.10\slf4j-1.7.10\slf4j-api-1.7.10.jar;C:\Michal\Java Workspace\TestMP4\build\classes Launcher Type: SUN_STANDARD Environment Variables: PATH=C:\ProgramData\Oracle\Java\javapath;C:\Michal\Xuggler\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;c:\Program Files (x86)\Intel\iCLS Client\;c:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Qt\Qt5.0.0\5.0.0\msvc2010\bin;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Mingw\bin;C:\Qt\4.8.4\bin;C:\Program Files (x86)\QuickTime\QTSystem\ USERNAME=User OS=Windows_NT PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 58 Stepping 9, GenuineIntel --------------- S Y S T E M --------------- OS: Windows 7 , 64 bit Build 7601 (6.1.7601.18409) CPU:total 4 (4 cores per cpu, 1 threads per core) family 6 model 58 stepping 9, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, aes, clmul, erms, tsc, tscinvbit, tscinv Memory: 4k page, physical 6253844k(2125080k free), swap 12505832k(7349476k free) vm_info: Java HotSpot(TM) 64-Bit Server VM (25.40-b25) for windows-amd64 JRE (1.8.0_40-b26), built on Mar 7 2015 13:51:59 by "java_re" with MS VC++ 10.0 (VS2010) time: Mon Mar 23 20:32:59 2015 elapsed time: 1 seconds (0d 0h 0m 1s)
Or just a popup saying java stopped working with exit code: Java Result: -1073741819