You are not logged in.
Pages: 1
Hi,
I am using the framework for its WebSocket capabilities, and I am running into an exception when running it through IDE only (F9), when running outside of it (CTRL-F9) everything is good.
The Exception:
First chance exception at $77134192. Exception class EServiceException with message 'TServiceFactoryClient.Create(): IWSSGeneral interface or TSQLRestRoutingREST routing not supported by server [URI root/WSSGeneral._contract_ [] returned status 'Service Unavailable' (503 - Check the communication parameters and network config)]'. Process BugReportClient.exe (12248)
I am using Delphi 2010, and have confirmed the issue on two different environments (same version of Delphi).
On one environment it fails about half of the time, while on the other it is 100% of the time.
I did a pull on Monday (3/30/2020) so my sources are pretty recent.
I created a project with both server and client which reproduces the issue, the loop is in case whoever runs it is on a machine that works most of the time.
Unfortunately I am not able to figure out the source of the issue on my own (except the line which raises the error but as to why it does), any help would be greatly appreciated!
Client:
https://pastebin.com/wjZ10jE1
Server:
https://pastebin.com/0nyktRsW
Thank you!
Last edited by AntoineGS (2020-04-02 13:08:26)
Offline
Please follow the forum rules and don't post such huge piece of code in the messages.
Use an external gist or pastebin or whatever for this.
Sounds like a threading problem when running within the IDE.
Offline
Sorry about that, I moved it to pastebin.
Would you have any idea on how I can mitigate the issue?
Without the IDE I won't be able to debug client-side issues so that would make things pretty complicated.
Offline
Alright so the issue started creeping up when running the applications in Release as well, and was more common when the CPU was under load so I took some time to locate the issue.
It would seem the TWebSocketProcessClient is not ready when the first call is done.
I was able to get it working by doing the following but I do not feel like it is a good solution, we could end up in an infinite loop as there might be scenarios where it will stay at wpsCreate:
constructor TWebSocketProcessClient.Create[...]
[...]
while fState = wpsCreate do
sleep(0);
end;
Would there be a better solution for this?
Offline
It is weird that such code should be needed.
There is already:
function THttpClientWebSockets.Request(const url, method: SockString;
KeepAlive: cardinal; const header, Data, DataType: SockString;
retry: boolean): integer;
...
if fProcess<>nil then begin
if fProcess.fClientThread.fThreadState=sCreate then
sleep(10); // allow TWebSocketProcessClientThread.Execute warmup
which does the same: it waits for the thread to be ready.
Perhaps you may have reached a situation where the thread is started, but TWebSocketProcess.ProcessLoop not yet...
So it seems safe to wait for the process state to initiate.
So I have included your change (with a paranoid timeout), as a fix.
Please check https://synopse.info/fossil/info/ed462e765a
Offline
I just did a pull and re-ran the tests and everything ran great, thank you!
Offline
Pages: 1