Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 9th May 2015, 16:15   #1  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 6,480
CAVIStreamSynth: System exception - Access Violation at ...

I'm calling a function named SMDegrain() in StaxRip x64 using avifile API, when I load the same script in VirtualDub x64 I don't see this problem.

Does VirtualDub x64 interface with AviSynth via avifile API or like most applications directly?

How can I find out which module is causing this exception and in particular where in the source code. I've not really experience with native coding so could use some hints, there are issues with nnedi3 and DGDecNV and it all might relate, I'm sure I can get to the bottom of this, question is only how long will it take...
stax76 is offline   Reply With Quote
Old 9th May 2015, 16:48   #2  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,012
When you search the forum for "CAVIStreamSynth" it seems that several people had problems with exceptions/access violations.

Maybe it's time to start using the native Avisynth interface. If you can't implement that in Basic there is possibly code for a wrapper somewhere.
As far as I know, VirtualDub uses it's own wrapper involving AVIFile API, have a look at the source.
__________________
Groucho's Avisynth Stuff

Last edited by Groucho2004; 9th May 2015 at 16:57.
Groucho2004 is offline   Reply With Quote
Old 9th May 2015, 17:07   #3  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 6,480
I could replace my complete interface probably in less then 3 hours, I doubt it would help however but I can search for a existing app or make a small sample app, should be fairly easy.
stax76 is offline   Reply With Quote
Old 9th May 2015, 17:25   #4  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,417
Quote:
Originally Posted by stax76 View Post
I've not really experience with native coding so could use some hints, there are issues with nnedi3 and DGDecNV and it all might relate
There are no problems with DGDecNV 64-bit. The problem is in your application.

Quote:
Maybe it's time to start using the native Avisynth interface.
Amen, bro.

Last edited by videoh; 9th May 2015 at 18:41.
videoh is offline   Reply With Quote
Old 9th May 2015, 18:03   #5  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 6,480
How would you know the bug is in my code? Years ago when MediaInfo crashed StaxRip but not VirtualDub the bug wasn't in StaxRip. Actually I have a theory and I could search or ask about the technical background, my theory is there is a bad pointer trying to access managed memory, it might as well be my code, the thing is nobody knows anything at this point and asking for samples, scripts and VirtualDub simply does not help, for debugging you need:

Win8/Win10 x64
AviSynth+ x64
.NET AviSynth client x64 using avifile API

Within in hour I could find out if MeGUIs completely different interop layer yields also to this problem, it's only like 50 lines code, even if it succeeds the bug is still unknown, why do 15 plugins work and only 2 don't, isn't this a indication there might be something wrong with this 2 plugins? I work since 15 years on StaxRip and have at least done a couple small C++ applications and some of these C++ applications where using different interop techniques, C, COM+, I've even written a C++/CLR application so I have some C++ and native/managed interop knowledge. You are hardly qualified to tell me where the bug is if you've not done native/managed interop.
stax76 is offline   Reply With Quote
Old 9th May 2015, 18:47   #6  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,417
Quote:
the thing is nobody knows anything at this point
Au contraire. We know that DGDecNV works flawlessly with the major applications and no crashes have been reported for a long time. So the prior probability of there being a problem in DGDecNV is extremely low compared to your brand new StaxRip 64-bit implementation. DGDecodeNV is a simple DLL and contains no "pointers into managed space". And you still haven't actually told us what problem you have with DGDecNV. Is it so unreasonable to ask about it?

If you have an access violation did you do some code stepping through your app to see when it occurs? That seems to me to be the obvious place to start. Also, how are you invoking Avisynth? Can you show us your code for that?

Last edited by videoh; 9th May 2015 at 19:12.
videoh is offline   Reply With Quote
Old 9th May 2015, 18:50   #7  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 6,480
What is so difficult to understand that the only thing you need is a x64 .NET client and what is so difficult to understand that the fact that the bug surfaces only with a .NET client doesn't necessarily mean the bug is in the .NET client?
stax76 is offline   Reply With Quote
Old 9th May 2015, 19:13   #8  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,417
I understand perfectly.

I asked you some questions to try to help you. Do you want to answer them? Here are the questions again:

Exactly what problem do you have with DGDecNV 64-bit? Do you have a crash dump to show us or something similar?

If you have an access violation did you do some code stepping through your app to see when it occurs? That seems to me to be the obvious place to start.

Also, how are you invoking Avisynth? Can you show us your code for that?
videoh is offline   Reply With Quote
Old 9th May 2015, 21:13   #9  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,012
Quote:
Originally Posted by stax76 View Post
I've not really experience with native coding so could use some hints
avs2yuv is a nice example. Apart from that, the Development section on avisynth.nl has lots of info.
__________________
Groucho's Avisynth Stuff

Last edited by Groucho2004; 9th May 2015 at 21:16.
Groucho2004 is offline   Reply With Quote
Old 9th May 2015, 21:16   #10  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 6,480
Quote:
Exactly what problem do you have with DGDecNV 64-bit? Do you have a crash dump to show us or something similar?
You and DG did hardly read or understand or did not want to understand what I wrote at his board, the problem happens with any media and any script, it happens not with VirtualDub but with StaxRip. It took me a few minutes since I'm clumsy with curly braces but here is a sample application with code with MeGUIs interop layer:

http://www.mediafire.com/download/1j...5wb281p/avs.7z

the layer is completely different interfacing with AviSynth directly with a native wrapper library and not using avifile API. avifile API might be old but it works perfectly, is blazing fast and requires 5 times less code and no wrapper library. My experience told me it won't help and MPC crashes as well and I verified with ProcessExplorer the CLR isn't loaded into MPC process space by a shell extension or something.

Quote:
Exactly what problem do you have with DGDecNV 64-bit? Do you have a crash dump to show us or something similar?
It crashes and it's ridiculous easy to reproduce with 2 sample applications I made with 2 different interop layers, it's of course much easier to say my interop code is flawed. I do not have a crash dump because I never had to debug with such a technique, I already asked to guide me with this.

Quote:
If you have an access violation did you do some code stepping through your app to see when it occurs? That seems to me to be the obvious place to start.
I already tried everything obvious, AviSynth returns a error message which I handle, after this sometimes a native crash happens.

Quote:
Also, how are you invoking Avisynth? Can you show us your code for that?
I posted it in a code tag at DGs forum and also uploaded a sample application with code, nobody tried to understand what I wrote there so I just left.

Last edited by stax76; 9th May 2015 at 21:19.
stax76 is offline   Reply With Quote
Old 9th May 2015, 21:28   #11  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 6,480
here is the avifile sample application and code I posted at DGs board:

http://www.mediafire.com/download/tr...pplication1.7z
stax76 is offline   Reply With Quote
Old 9th May 2015, 21:57   #12  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,417
Quote:
AviSynth returns a error message which I handle, after this sometimes a native crash happens
What are you doing in your code that returns the error message, and what is the error message and how do you handle it?

Some people may not want to install a .NET development environment and then build and debug your application to help with interfacing properly to Avisynth.

Last edited by videoh; 9th May 2015 at 22:08.
videoh is offline   Reply With Quote
Old 9th May 2015, 22:32   #13  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 6,480
With DGDecNV I get the error message:

System exception - Access Violation
(D:\Temp\test temp files\test.avs, line 2)

LoadPlugin("D:\Software\Medien\DGDecNV\DGDecodeNV.dll")
DGSource("D:\Temp\test temp files\test.dgi")

both sample applications and MPC-BE show this error, the only plugins with this problem is DGDecNV and nnedi3, nnedi3 work with opt=1 disabling asm, on Win7 everything works if I remember right, before this mess started I was on Win7, now I'm on Win10, I had a few pointer related bugs in my interop code that surfaced only on Win8/Win10 so I migrated to Win10.
stax76 is offline   Reply With Quote
Old 9th May 2015, 22:36   #14  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,417
Are you able to run your code in the VB .NET debugger? If so, you can break on the access violation and see what's going on. Just start debugging and make the error happen. When you get the access violation popup, tell it to break. You will be right at the call to the faulting module, can see who called it, etc.

You can get crash dumps various ways. Dr Watson is one popular choice.

Last edited by videoh; 10th May 2015 at 01:10.
videoh is offline   Reply With Quote
Old 10th May 2015, 00:58   #15  |  Link
captainadamo
Registered User
 
Join Date: Feb 2015
Posts: 70
Another way is to use Task Manager as long as the process is still running when you get the error message popup. You can right click the process and tell it create a crash dump.
captainadamo is offline   Reply With Quote
Old 10th May 2015, 01:07   #16  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 6,480
It's always terminating after a few seconds, I got some clues now however.
stax76 is offline   Reply With Quote
Old 10th May 2015, 01:10   #17  |  Link
captainadamo
Registered User
 
Join Date: Feb 2015
Posts: 70
What I mean is if you get the access violation popup message don't close it and then you can use task manager to create a crash dump. Obviously if you close the popup the process will terminate.
captainadamo is offline   Reply With Quote
Old 10th May 2015, 01:12   #18  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,417
He's got clues now but won't tell us what they are.

He also won't answer simple, direct questions, such as "Are you able to run your code in the VB .NET debugger?"
videoh is offline   Reply With Quote
Old 10th May 2015, 01:27   #19  |  Link
stax76
Registered User
 
Join Date: Jun 2002
Posts: 6,480
I was debugging nnedi3 and I know the line causing the access violation, first I thought my crop dialog works so I thought there is something in my code but I forgot that the crop dialog uses only the source filter so it did not use nnedi3 or DGindexNV. DG can download both super simple test projects for visual studio and debug his code, it's not my problem any longer.
stax76 is offline   Reply With Quote
Old 10th May 2015, 01:34   #20  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,417
Quote:
I was debugging nnedi3 and I know the line causing the access violation
But you won't tell us what line that is. Anyway, we are talking about DGDecode, not nnedi3. Do you think nnedi3 calls code in dgdecodenv.dll?

If you give Graft a simple C++ based project I'm sure he will be able to help you. But if you give him VB .NET + avifile + "reflection hack", he is not going to be interested, and you'll have to debug that stuff yourself.

Last edited by videoh; 10th May 2015 at 16:48.
videoh is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:04.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.