#1 2024-09-05 07:36:06

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 430

ERROR_SUCCESS in winsock

I am getting this exception but I have not managed to find any problem during runtime:

https://gist.github.com/dkounal/d1a0b1c … ad54746744

The only code that comes from TPCHRclient.setJWTheader is:

245: function TPCHRclient.setJWTheader(Sender: TRestClientUri): boolean;  var b:Boolean; st:RawUtf8;
246: begin st:=''; repeat b:=jwl.TryReadLock; if b then try
247: if (Jexp>0) and (Jexp>{UnixTimeUtc}(DateTimeToUnixTime(Now)+jsdif)) then st:=jwth;
248: finally jwl.ReadUnLock; end else Sleep(20); until b;
249: result:=st<>''; if result then sender.SessionHttpHeader:=st; end;

Any contribution is welcome

Offline

#2 2024-09-05 09:25:13

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

Re: ERROR_SUCCESS in winsock

This is a weird no-error for sure.

Are you receiving a huge file content?
The "read" parameter seems big, around 8MB.
Perhaps it is a buffer issue.

Which version of Windows are you using?

Offline

#3 2024-09-05 09:31:17

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 430

Re: ERROR_SUCCESS in winsock

Win10 and I am receiving a RetrieveListJSON output with about 14000 records
How can I make mormot http server to compress the request response?

Offline

#4 2024-09-06 05:49:26

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

Re: ERROR_SUCCESS in winsock

If you use TRestHttpServer with HTTPSERVER_DEFAULT_OPTIONS, you have rsoCompressGzip enabled.

My guess is that TCrtSocket.TrySockRecv returns false because of a timeout.
Enable the logs in verbose mode, and put them into a gist link.
What if the TimeOut value you are using on the client side?

Edit:
After more investigation, you requested 15,803,002 bytes, then it stopped after reading 8,759,020 bytes.
My final guess is that it was perhaps not a real timeout, but the wsarecv() syscall did return after more than 8MB of data, waiting for calling it back.
Which it did not.
I am trying to fix it now.

Offline

#5 2024-09-06 07:55:56

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

Re: ERROR_SUCCESS in winsock

Please try with
https://github.com/synopse/mORMot2/commit/31ab52e2
and
https://github.com/synopse/mORMot2/commit/b15c5279

But, with huge resultsets, you may:
1) consider paging the results
2) try the "non expanded" output format, which would be smaller in size, and faster to emit on the server side, and parse on the client side

Offline

#6 2024-09-06 10:59:24

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 430

Re: ERROR_SUCCESS in winsock

thank you a lot @ab

Offline

Board footer

Powered by FluxBB