Open SukheshMajalkar opened 5 years ago
Can you share full code in a git repo so we can repro locally?
libvlc version : (Please fill) x86 + By installing vlc version 3.0.7 and coping into libvlc folder.
You should try nuget next time
This often indicates a memory corruption or something wrong on the native side. To help us further investigate, could you share a minimal project that we can run to reproduce the issue?
LibVlcDemo.zip In this zip i was created the application in which two vlc controls were 3 videos playing simultaneously, and put it on overnight testing, at morning i saw application got crashed and ntdll.dll error was occurred in event log. Kindly find the event log details: Faulting application name: LibVlcDemo.vshost.exe, version: 14.0.23107.0, time stamp: 0x559b788a Faulting module name: ntdll.dll, version: 10.0.17134.556, time stamp: 0x319e0a75 Exception code: 0xc0000374 Fault offset: 0x000d8529 Faulting process ID: 0x7a8 Faulting application start time: 0x01d52a95053be352 Faulting application path: D:\Share\VlcCode\LibVlcDemo - Copy\LibVlcDemo\bin\Debug\LibVlcDemo.vshost.exe Faulting module path: C:\WINDOWS\SYSTEM32\ntdll.dll Report ID: e586782e-a1c2-4b81-b531-dfa216d2e424 Faulting package full name: Faulting package-relative application ID:
Kindly help me out about this.
Also while playing full hd videos d3d11.dll error also occurred in event log and application get crashed.
I also have crash issues when I use multiple winforms VLC controls (wrapped in a WPF app) and I stress them (frequent play/stop)
I will try to create a simplified repro today.
here is the repro: https://github.com/srollinet/VlcDotNetCrashIssue
In the real application, it receives affectation commands from outside, se here I simulate this behavior with multiple tasks that do random video affectations
All the useful parameters are in MainWindow.xaml.cs
. You will have to change the StreamUris as they are all on a private network
All the vlc related stuff is in VideoPlayer.xaml.cs
Some remarks:
Thanks for the repro, I hope to have a look at it soon. Please ping me if you don't hear back before monday.
I tried your sample and I replaced the URL with 2 http urls (I don't have rtsp urls at hand to test). My streams failed and I didn't see any crash. I'll test more touroughly later. Can you try with files instead of streams and see if it fails too?
Thanks for the feedback. I will try with files as soon as possible.
Regarding the deadlock issue, is it normal that I have to interact with the player from another thread or is it a bug?
Not sure, it might be an issue with your app. Do you know at which line it deadlocks? Be careful : When Play() is called with your timer, you are already on the main thread. I'm not sure you need to switch to the main thread there: https://github.com/srollinet/VlcDotNetCrashIssue/blob/de0ef867ce444ab78e2fe30ddfe8a380a54f85f8/VlcCrashRepro/MainWindow.xaml.cs#L84
Where is the VideoPlayer.Stop() method called?
Stop is called from the outside and is also called from the main thread so there is no concurrent calls.
Yes, it is voluntary that the timer switch to the main thread, because in the real app the ViewModel is always used from the main thread (It does more UI stuff so I need to be on the UI thread)
What feels weird is that we have to interact with the player in another thread otherwise it may deadlock. This is not very common in a desktop application.
any solution on ntdll.dll error and application got a crash issue ?
Didn't had time to look at it, please ping me on wednesday if I don't reply until then
Can you try with files instead of streams and see if it fails too?
It doesn't seem to crash when using files
Didn't had time to look at it, please ping me on wednesday if I don't reply until then
Thank you for the quick reply.
@srollinet : Thanks for the repro. I was able to see it crash. It makes me think of a native crash, i'll try to reproduce it in https://github.com/jeremyVignelles/TestLibvlcNative in the next few days, but I need to be at work to have access to rtsp cameras.
While I will try to find the issue on my free time, you can still help by trying one or more of these things:
vlc.exe -I dummy "01_llama_drama_half.mp4" :sout=#gather:rtp{sdp=rtsp://:8555/} :sout-keep --loop
Another tip for next time : Please use the libvlc in NuGet, it's easier to install, and we don't need to wonder which version you used.
@srollinet : Thanks for the repro. I was able to see it crash. It makes me think of a native crash, i'll try to reproduce it in https://github.com/jeremyVignelles/TestLibvlcNative in the next few days, but I need to be at work to have access to rtsp cameras.
While I will try to find the issue on my free time, you can still help by trying one or more of these things:
- Try to create several rtsp streams with VLC, and see if that crashes the same way. Here is a sample command line;
vlc.exe -I dummy "01_llama_drama_half.mp4" :sout=#gather:rtp{sdp=rtsp://:8555/} :sout-keep --loop
- Try to reproduce with other kind of streams (http, HLS, udp streams, other codecs...)
- Try reducing the amount of code needed to reproduce the issue.
- Try eliminating the randomness, does it happen in reproducible conditions, like a really short timer?
Ok I will make several try these next days and I come back to you with the results
Another tip for next time : Please use the libvlc in NuGet, it's easier to install, and we don't need to wonder which version you used.
I think I use it from Nuget no? Or am I doing something wrong? https://github.com/srollinet/VlcDotNetCrashIssue/blob/master/VlcCrashRepro/VlcCrashRepro.csproj#L108 https://github.com/srollinet/VlcDotNetCrashIssue/blob/master/VlcCrashRepro/VideoPlayer.xaml.cs#L23
Oh you're right, I was mislead by the fact that Visual Studio showed me a list of plugins and libvlc.dll... These files doesn't appear when using a SDK-style project, hence the confusion...
What about playing multiple vlc controls crash?
Nothing more than yesteday, will try to continue in the next few days, but I'm nquite busy at work and getting home late.
@jeremyVignelles Thank you for your response.
I simplified your code while still crashing.
You can see the work in progress here : https://github.com/jeremyVignelles/VlcDotNetCrashIssue
Just tried your version with local rtsp streams (from VLC) No crashes for now, but sometimes threads are blocked here in VlcManager.cs
public void Stop(VlcMediaPlayerInstance mediaPlayerInstance)
{
if ((IntPtr) mediaPlayerInstance == IntPtr.Zero)
throw new ArgumentException("Media player instance is not initialized.");
this.myLibraryLoader.GetInteropDelegate<Stop>()((IntPtr) mediaPlayerInstance); //<---------
}
so all the "producers" are quickly blocked on the lock
section
How do you tell that threads are blocked? app becomes unresponsive?
Do you reproduce any of the bugs if you remove the player.Stop() line?
How do you tell that threads are blocked? app becomes unresponsive?
The app is still responsive because everything is done on background threads. But every time I stop the debugger, most of the tasks are blocked on lock (_vlcControlLock)
and 1-2 tasks are blocked in VlcManager.cs
This is not frequent, but it happened a few times.
Do you reproduce any of the bugs if you remove the player.Stop() line?
I will try now. But the problem when not stopping the player is that the old stream is still playing while the new one is loading.
In our application, we have an overlay with additional infos. So we don't want to display infos from a new camera on the old camera stream.
So we don't want to display infos from a new camera on the old camera stream.
You could switch your info when the Playing event is triggered.
That's weird you don't reproduce with my code, I'll retry tomorrow.
Do you know if the crash happens with a specific brand of camera or with all you tried?
That's weird you don't reproduce with my code, I'll retry tomorrow.
Could it be hardware related? Now I am at home, I have a desktop with a dedicated graphic card. When I am at work I use a laptop, and the target hardware is a NUC. So the conditions are not the same.
Also at home I have no cameras so I test with streams from VLC. I will test your code tomorrow at work
Do you know if the crash happens with a specific brand of camera or with all you tried?
I will check tomorrow, but in our dev env we have mostly Axis cameras
My main problem is not that a player crashes, it is that the whole app crashes.
But if we can't reproduce it and if it is not possible to catch the exception somehow, I can change the application design and create each player in a different process, so if one of the player crashes, I can restart it.
Could it be hardware related? Now I am at home, I have a desktop with a dedicated graphic card. When I am at work I use a laptop, and the target hardware is a NUC. So the conditions are not the same.
It could be hardware related, but I have a fast computer at work and it did crash. It could also be network related, stream related or anything else. In fact, anything that could cause two actions happening in the wrong order is a suspect.
Also at home I have no cameras so I test with streams from VLC. I will test your code tomorrow at work
That could also potentially explain why it doesn't crash... The stream is different.
My main problem is not that a player crashes, it is that the whole app crashes.
My guess is that the whole app crashes because of a native crash (bad pointer usage for example) in one of the player. My goal is currently to prove that the crash isn't caused by Vlc.DotNet and that it can be reproduced with only libvlc, but for that I need to strip down the code to its minimum before translating it to C/C++. Or maybe, in the process, I will find something weird in Vlc.DotNet that can cause the issue.
Anyway, you can't go to libvlc's trac and tell them there is a bug without something they can reproduce on their machine.
But if we can't reproduce it and if it is not possible to catch the exception somehow,
You can't catch native crashes by design. When an invalid pointer is accessed, the OS protects itself by shutting down the app.
I can change the application design and create each player in a different process, so if one of the player crashes, I can restart it.
You could do that, and that would be better for stability. However, keep in mind that you wouldn't be able to gather all videos in the same window after that...
I can change the application design and create each player in a different process, so if one of the player crashes, I can restart it.
You could do that, and that would be better for stability. However, keep in mind that you wouldn't be able to gather all videos in the same window after that...
It's not an issue in my case because the application is always full screen with x players, so I can open x windows and give them their size and location.
Attempt of the day : Did try with local files on my home computer, did not crash so far (10 minutes)... I'll need to try with VLC's RTSP streams or at office...
Did you have more info to share on your side?
I was able to make the repro crash today at work, with RTSP streams, but only once.
If I find the time, I will retry with the real app and try to find why it crashes more frequently.
I have seen this at work in a C++ application using libvlc directly. Cycling between two RTSP cameras every 5 seconds ended in a crash. Will need to dig deeper and report to videolan.
The bug has been reported to VideoLAN here : https://trac.videolan.org/vlc/ticket/22648 There are still things that I didn't have time to test (I'm going on vacation tomorrow):
If anyone has an answer for any of these, please post on the trac ticket.
I'm also on vacation so I don't have access to the cameras now.
@jeremyVignelles I didn't get any solution on the player crash while playing multiple videos controls, after retrying the following item:
I had only checked in windows machine. Note: Application crashes after running for a few hours, it does not crash immediately. In my case, it required 3 to 4 hours. Kindly suggest the solution for this.
@SukheshMajalkar I don't have any solution so far, and no workaround. This is something that needs to be fixed in libvlc.
How often do you switch videos? What kind of streams do you use?
Thank you for a quick reply, The issue occurred when playing a normal video with two vlc controls not streaming and it was reproduced after every 3-4 hours, switching duration between two videos is 30sec.
Ok, thanks. By any chance, are your videos encoded in h.264? (open VLC and look for the codec information)
Yes, almost all of them were h.264 codec, can it cause any problem?
I had this problem a few times recently with libvlcsharp. But it seems it is more or less related to the cameras.
Some observations: At work, I have a few Axis, A Flir ITS Dual and a Samsung iPolis. The crashes only occur with the Axis cams. In production I only have iPolis cams. It works great with unicast streams, but if I try to play multicast streams it crashes frequently.
I have an issue / a question (pick one) about Vlc.DotNet.
Generic information
Summary
On single window while playing two vlc controls application get crash and windows event log shows me the ntdll.dll error:
Faulting application name: XtremeMediaClient.exe, version: 1.0.0.0, time stamp: 0x5d0f325a Faulting module name: ntdll.dll, version: 10.0.14393.0, time stamp: 0x57898d9d Exception code: 0xc0000374 Fault offset: 0x000d9841 Faulting process id: 0x1ea4 Faulting application start time: 0x01d5299b54163009 Faulting application path: C:\Program Files (x86)\Xtreme Media\Xtreme Media Player\XtremeMediaClient.exe Faulting module path: C:\Windows\SYSTEM32\ntdll.dll Report Id: fec9d212-b70a-49f1-865f-fa9fe14f1bae Faulting package full name: Faulting package-relative application ID:
After playing some loops it will crash.