#1 2016-04-05 14:58:45

corchi72
Member
Registered: 2010-12-10
Posts: 232

Error : 'winhttp.dll error 12002 (timeout)'

Hi, I have a timeout error when I execute a "IRemoteAction = interface(IInvokable)" that exceeds a few seconds of running time.

I implemented a service that performs a server-side, and after a few seconds you encounter the below error:

" ... raised exception class EWinHTTP with message 'winhttp.dll error 12002 (timeout)'."

and the error:

"TinterfaceObjectFackeClient.FakeCall(IRemoteAction.ExecuteSchedules) failed:'URI root/RemoteAction.ExecuteSchedules[[253],1,0] returned status 'Invalid Request' (501 - Server not reacheable)".


but the operation "ExecuteSchedules" is successful!!!

because waiting for the event execution order, you can only make a call?

//Interface declaration

 IRemoteAction = interface(IInvokable)
   ['{D6369DD7-6E9C-4C73-8283-87957977B2FC}']

    procedure ExecuteSchedules(const aIDs: TIntegerDynArray; Force: Integer;
      Preview: Integer);
   
  end;

..............
//Class declaration

TRemoteAction = class(TInterfacedObject, IRemoteAction)
public
      procedure ExecuteSchedules(const aIDs: TIntegerDynArray; Force: Integer = 1;
      Preview: Integer = 1);
end;

procedure TRemoteAction.ExecuteSchedules(const aIDs: TIntegerDynArray; Force, Preview: Integer);
begin

   if Assigned(DmdScheduleServer) then
     DmdScheduleServer.ExecuteSchedules(aIDs,Boolean(Force),Boolean(Preview));
end;

..........


//Server Side

     MemoryDB := TSQLLogRestServer.Create(MemoryModel,'ScheduleMemory',false,false);
 // register our TRemoteAction implementation
     MemoryDB.ServiceRegister(TRemoteAction,[TypeInfo(IRemoteAction)],sicSingle);
 // launch the HTTP server
     MemoryServer := TSQLHttpServer.Create(inttostr(fNuvRegistry.ScheduleServerHttpPort),[MemoryDB],'+',useHttpApiRegisteringURI);




........
//Client Side

 fClient.ServiceRegister([TypeInfo(IRemoteAction)],sicSingle);
    if fClient.Services['RemoteAction'].Get(I) then
        I.ExecuteSchedules(aIDs,Integer(Force),Integer(Preview));



 

thanks corchi

Offline

#2 2016-04-05 17:24:30

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,240
Website

Re: Error : 'winhttp.dll error 12002 (timeout)'

When you create the fClient instance, you can customize the timeout value.

But the best option may be to use a callback instead of a blocking process.

Offline

#3 2016-04-06 07:49:18

corchi72
Member
Registered: 2010-12-10
Posts: 232

Re: Error : 'winhttp.dll error 12002 (timeout)'

I tried to execute the "callback" but I have the same error when the procedure arrive to line that execute Ctxt.Success();

procedure TSQLLogRestServer.ExecuteSchedules(Ctxt: TSQLRestServerURIContext);
var
 i :Integer;
 IDs: TIntegerDynArray;
 sID:RawUTF8;
 aForce,aPreview: Integer;

begin
  UrlDecodeValue (Ctxt.Parameters,'IDS=',sID,@Ctxt.Parameters);
  if UrlDecodeNeedParameters(Ctxt.Parameters,'FORCE') then
     UrlDecodeInteger(Ctxt.Parameters,'FORCE=',aForce,@Ctxt.Parameters)
  else
    aForce := Integer(false);

  if UrlDecodeNeedParameters(Ctxt.Parameters,'PREVIEW') then
     UrlDecodeInteger(Ctxt.Parameters,'PREVIEW=',aPreview,@Ctxt.Parameters)
  else
    aPreview := Integer(false);

  CSVToIntegerDynArray(PUTF8Char(sID),IDs);


   DmdScheduleServer.ScheduleThread.AExecute(IDs, boolean(aForce),boolean(aPreview)); // This function takes about 30 seconds

   Ctxt.Success(); //when this line is executed the error occurs

end;

Offline

#4 2016-04-06 08:06:40

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,240
Website

Re: Error : 'winhttp.dll error 12002 (timeout)'

IMHO the timeout error is on client side, not server side...

When I was speaking about a "callback", I meant http://synopse.info/files/html/Synopse% … l#TITL_149 - not method-based service.

Offline

Board footer

Powered by FluxBB