RemoteDataAdapter.FillWithDASQL / from Invoked delegate?

I have an asynchronous result coming back into a .NET / DA / Oxygene / Hydra client, which works fine, however I am having a problem with calling a FillDASQL call which is executed as a result of the invoked delegate. The method containing the Fill works fine when called from the plugin load and when just executed via a button for example. However it always hangs (no exception / no CPU activity etc.) when being executed as a result of a call when coming back from the async process. The aysnc result comes back like this :-

method TAN001RepClient.onServerBatchResult(aAsyncResult: IAsyncResult); 
begin
var iResult: System.Int32 := cData.BatchTServiceA.EndTAN001_Extract(aAsyncResult);

Invoke(new InvokeDelegate(SyncEvent), array of System.Object([OXY003.InvokeType.onASyncResult, array of System.Object([iResult])]));
end;

The invoked method SyncEvent is :-

method TAN001RepClient.SyncEvent(aType: OXY003.InvokeType; params aArgs: array of System.Object);
begin
  case aType of 
    OXY003.InvokeType.onMessage:  
	 begin
	 end;
    OXY003.InvokeType.onASyncResult:  
 	 begin
	     case System.Int32.Parse(aArgs[0].ToString) = -1 of
		true 	:	SetStatus(Status.Failure);
		false :	begin		
			    LoadRepClientControl;
			end;
	     end;
	 end;  
  end;
end;

…and the start of the LoadRepClient method looks like this :-

method TAN001RepClient.LoadRepClientControl;
var	dsDataTable  	: System.Data.DataTable;
	dsReader     	: System.Data.DataTableReader;
	ParamArray 	: array of RemObjects.DataAbstract.Server.DataParameter;
	dParam		: RemObjects.DataAbstract.Server.DataParameter;
   begin
	dsDataTable 	:= new System.Data.DataTable;
	Array.Resize(var ParamArray,1);
	dParam        := new RemObjects.DataAbstract.Server.DataParameter;
	dParam.Name   := 'ControlKey';
	dParam.Value  := 0;
	ParamArray[0] := dParam;

	RemoteDataAdapterI.FillWithDASql(dsDataTable,qoxy0022,ParamArray);
	dsReader := dsDataTable.CreateDataReader();

How can I avoid this hanging ? Is the fact that the FILL is being executed in the context of the main thread (I believe that’s right ?) the problem ?

Thanks in advance.

Hello

There should be no issues on executing a DataAdapter’s method in a main thread context. Additionally this issue doesn’t reproduce on a simplified testcase, where .FillWithDASql operation is executed in a similar fashion. So it seems that the issue is caused by something else, more specific for your project.

I can suggest to run the project under debugger and (once it hungs) pause its execution and check where exactly the execution is paused. After that it should be much easier to pinpoind and resolve the issue.

This could help to attach Data Abstract sources in case execution will stop somewhere in the Data Abstract code: http://wiki.remobjects.com/wiki/Platform_FAQs_(Data_Abstract)#How_can_I_enable_debugging_of_Data_Abstract_for_.NET_sources.3F

Regards

Hi,

I’ve stepped into the DA code and located where the hang occurs, but not why . This is the call stack :-

>	RemObjects.SDK.dll!RemObjects.SDK.SuperTcpClientChannel.IntDispatch(System.IO.Stream request, RemObjects.SDK.IMessage response = {RemObjects.SDK.BinMessage}) Line 758	C#
RemObjects.SDK.dll!RemObjects.SDK.ClientChannel.Dispatch(RemObjects.SDK.IMessage message = {RemObjects.SDK.BinMessage}) Line 303 + 0x11 bytes	C#
RemObjects.SDK.dll!RemObjects.SDK.DynamicRequest.InternalMakeRequest() Line 532	C#
RemObjects.SDK.dll!RemObjects.SDK.DynamicRequest.MakeRequest() Line 547 + 0x8 bytes	C#
RemObjects.DataAbstract.dll!RemObjects.DataAbstract.RemoteDataAdapter.SendFillRequest(System.Data.DataTable table = {System.Data.DataTable}, RemObjects.DataAbstract.Server.TableRequestInfoV6 tableRequest = {RemObjects.DataAbstract.Server.TableRequestInfoV6}, RemObjects.DataAbstract.Expressions.WhereExpression whereClause = nil, Boolean applySchema = true) Line 477	Oxygene
RemObjects.DataAbstract.dll!RemObjects.DataAbstract.DataAdapter.InternalFill(System.Data.DataTable table = {System.Data.DataTable}, RemObjects.DataAbstract.Server.TableRequestInfoV6 tableRequestInfo = {RemObjects.DataAbstract.Server.TableRequestInfoV6}, RemObjects.DataAbstract.Expressions.WhereExpression whereClause = nil, Boolean applySchema = true) Line 302 + 0x19 bytes	Oxygene
RemObjects.DataAbstract.dll!RemObjects.DataAbstract.DataAdapter.Fill(System.Data.DataTable table = {System.Data.DataTable}, RemObjects.DataAbstract.Server.TableRequestInfoV6 tableRequestInfo = {RemObjects.DataAbstract.Server.TableRequestInfoV6}, Boolean applySchema = true) Line 442	Oxygene
RemObjects.DataAbstract.dll!RemObjects.DataAbstract.DataAdapter.FillWithDASql(System.Data.DataTable table = {System.Data.DataTable}, String sql = 'select * from RepClientControl where ControlKey=:ControlKey', array of RemObjects.DataAbstract.Server.DataParameter parameters = array [0..0] of RemObjects.DataAbstract.Server.DataParameter) Line 854	Oxygene
OXY011.dll!OXY011.TAN001RepClient.LoadRepClientControl() Line 827	Oxygene
OXY011.dll!OXY011.TAN001RepClient.SyncEvent(OXY003.InvokeType aType = OXY003.InvokeType.onASyncResult, array of Object aArgs = array [0..0] of System.Object) Line 708 + 0xa bytes	Oxygene
[Native to Managed Transition]	
mscorlib.dll!System.Delegate.DynamicInvokeImpl(object[] args) + 0x76 bytes	
System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallbackDo(System.Windows.Forms.Control.ThreadMethodEntry tme = {System.Windows.Forms.Control.ThreadMethodEntry}) + 0x1b2 bytes	
System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(object obj) + 0x54 bytes	
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0xa7 bytes	
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) + 0x16 bytes	
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x41 bytes	
System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallback(System.Windows.Forms.Control.ThreadMethodEntry tme) + 0x7e bytes	
System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallbacks() + 0xe1 bytes	
System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) + 0x804 bytes	
System.Windows.Forms.dll!System.Windows.Forms.ScrollableControl.WndProc(ref System.Windows.Forms.Message m) + 0x5b bytes	
System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.WndProc(ref System.Windows.Forms.Message m) + 0x18 bytes	
System.Windows.Forms.dll!System.Windows.Forms.UserControl.WndProc(ref System.Windows.Forms.Message m) + 0x17 bytes	
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) + 0x11 bytes	
System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0xa0 bytes	
System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback(System.IntPtr hWnd, int msg = 49502, System.IntPtr wparam, System.IntPtr lparam) + 0x5f bytes	
[Appdomain Transition]	

The code is hanging on the lock(fwaitRequests) in IntDispatch. I’ll keep looking, but any thoughts as to what might be causing my problem ?

Thanks,

Hello

Thank you for the stacktrace.

Seems (not sure at this very moment, this requires deeper investigation) there is a race-condition somewhere in the event processing pipeline. Please contact us via support@ so we’ll provide you a fixed build once it is available.

Regards

Just to confirm my response by email. The fix you provided in beta build 8.0.82.1138 has worked.

Thanks.