Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetDataSetDirectoryAsync got System.AccessViolationException #498

Open
Tivaty opened this issue Mar 19, 2024 · 7 comments
Open

GetDataSetDirectoryAsync got System.AccessViolationException #498

Tivaty opened this issue Mar 19, 2024 · 7 comments

Comments

@Tivaty
Copy link

Tivaty commented Mar 19, 2024

Hello,

Evinronment: C#
Lib version 1.5.3

When I set MaxPduSize to 1000 app crash happens.
The reason I need to set it to 1000 to GetLogicalDeviceVariablesAsync without problem of timeout. When the value of MaxPduSize is larger than 1000 IED timeout error happens frequently.

IedConnection con = new IedConnection();
con.MaxPduSize = 1000; // GetDataSetDirectoryAsync and GetDataSetDirectory Failed

System.AccessViolationException HResult=0x80004003 Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Source=<Cannot evaluate the exception source> StackTrace: <Cannot evaluate the exception stack trace>

Untitled
@mzillgith
Copy link
Contributor

In what function does the application crash?
Do you have a stack trace?

@Tivaty
Copy link
Author

Tivaty commented Mar 19, 2024

In what function does the application crash? Do you have a stack trace?

Hi,
This is C# library so there is no stacktrace, only error message.

App crashed at "con.GetDataSetDirectoryAsync"

string dsRef = dataSetRef.Replace('$', '.');
Debug.WriteLine(dsRef);
waitForCallBack.Reset();
con.GetDataSetDirectoryAsync(dsRef, delegate (uint invokeId, object parameter, IedClientError err, List<string> dataSetDirectory, bool isDeletable)
{
	if (dataSetDirectory != null)
	{
		foreach (var doName in dataSetDirectory)
		{
			Debug.WriteLine("\t" + doName);
		}
	}
	else
	{
		Debug.WriteLine("Get dataset directory error: " + err.ToString());
	}
	waitForCallBack.Set();
}, null);
waitForCallBack.WaitOne(); 

@Tivaty
Copy link
Author

Tivaty commented Mar 19, 2024

Please note that, when con.MaxPduSize does not set. (default value 65000) this function works well.
And I have 2 dataset LLN0$PROT1 have much more variable than LLN0$PROT2.

@mzillgith
Copy link
Contributor

I found an issue with the .NET wrapper when the server doesn't send a response but an error message instead. Could this be the case here? I guess the dataset is too big to fit into a the small MMS PDU size and the server is sending an error message instead.

@Tivaty
Copy link
Author

Tivaty commented Mar 19, 2024

I found an issue with the .NET wrapper when the server doesn't send a response but an error message instead. Could this be the case here? I guess the dataset is too big to fit into a the small MMS PDU size and the server is sending an error message instead.

You are correct. And the issue I want to point out is the dataset is too big to fit into a the small MMS PDU size.
In the GetNameListHandler there is a bool moreFollow. But with GetDataSetDirectoryHandler there is only isDeletable.

the reason PDU size is 1000 is for GetNameListHandler work well, when PDU larger than 1000 I got many IED timeout with my test.

@mzillgith
Copy link
Contributor

There is no way to send a larger dataset when the MMS size is too small. Only the getnamelist MMS service supports splitting the response in multiple MMS messages.

But the issue (crash) should be resolved with this fix: 681d1b0

@Tivaty
Copy link
Author

Tivaty commented Mar 20, 2024

There is no way to send a larger dataset when the MMS size is too small. Only the getnamelist MMS service supports splitting the response in multiple MMS messages.

But the issue (crash) should be resolved with this fix: 681d1b0

Okay. Thank youuuu. Let me try again with the latest source code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants