You are not logged in.
Pages: 1
I'm using mORMot in a server in cloud (something like Amazon EC2), and my clients connect to the server through the internet.
The internet connection ain't perfect, so sometimes there is instability (a few seconds, usually), when that happens the client application freezes over waiting for the connection with the server.
How can we prevent something like that?
I've tried set a timeout on the connection but I couldn't make it work properly.
Any idea?
Offline
This is due to blocking access to the HTTP client.
Could be related to http://synopse.info/forum/viewtopic.php?id=1333
Or changing the SynCrtSock.pas unit to handle properly UI messages during connection attemps...
Online
Wich one is easier to implement?
Do you want me to create a ticket?
Offline
Ticket created: http://synopse.info/fossil/tktview?name=68337ae98a
Offline
OK
Let's implement it.
I've an idea to add an "Idle" callback event at TSQLRestClientURI level, which will use a background thread for the actual blocking communication, then run the "Idle" callback in loop, to maintain the application UI.
Of course, this callback will have a timing parameter, to allow displaying a popup window to help waiting.
Is it OK for you?
Online
I agree, let's do it!
Offline
I've just implemented it with http://synopse.info/fossil/info/d86d7dceb2.
Nice show-case of Delphi TThread and TEvent classes, by the way.
See also the ticket description, and our new blog article:
http://blog.synopse.info/post/2013/07/0 … responsive
We tested it with a 3 second artificial temporizer for each request, and the applications were running smoothly, even if slowly - but comparable to most web applications, in fact. The SynFile main demo (available in the SQlite3\Samples\MainDemo) folder defines such a callback.
Hope it fits your needs.
Online
Very well, thank you very much.
Offline
I was doing some testing and found that when a command is done very quickly, and there's no time to client retrieve the data from the server, and due of the use of threads, the client continues running the code, so that can result sometimes in "Access Violation" and "Invalid pointer operation" errors.
How can we treat this kind of behavior?
Offline
It happens with slower connections. Locally it's just too fast to cause this problem.
Offline
We added a 3 second delay per request, on the server side, to simulate very slow network.
It could be close to what you may have at worth...
Did you update all units of mORMot to the latest unstable version?
Since we are not able to reproduce the problem, please describe where the AV occur (source code line number), and context (stack trace).
Best is to provide some simple source code to reproduce the issue.
Online
Thanks also for this.
I was using using the new OnIdle event to catch exceptions, checking the LastErrorCode when ElapsedMS = -1.
This doesn't seem possible with the latest implementation. Is there another way to globally check the LastErrorCode?
Offline
Yes, I was trying to find a shortcut but now see this isn't so ok.
I've got a connected problem. I'm trying to set TSQLHttpClient.WinAPI.ConnectTimeout before a connection is made but get an AV as WinAPI is only created the moment the first connection is made. Is there a way round this? My test code is:
DB := TSQLHttpClient.Create('192.168.99.99', '80', TSQLModel.Create([]));//non-existant server
DB.WinAPI.ConnectTimeout := 5000;
DB.ServerTimeStampSynchronize;
Offline
My network can be somewhat unreliable at times (I suspect a DNS problem but don't control the network).
If I set the DB.WinAPI.ConnectTimeout after DB.ServerTimeStampSynchronize; It can take 21 seconds before I get a timeout error (code 12002) but this is intermittent. (Also I find that the maximum timeout I can set is 21 seconds which maybe to do with Windows 7)
So ideally I would like to set DB.WinAPI.ConnectTimeout before DB.ServerTimeStampSynchronize; to avoid a possible 21 second wait.
Offline
Hi, I've got a problem with setting
CanSelect := False;
within a TSQLTableToGrid.OnSelectCell procedure when onIdle is set.
If TSQLTableToGrid.OnSelectCell contains these lines
TSQLHttpClient(Database).ServerTimeStampSynchronize;
CanSelect := False;
it is still possible to select rows by clicking but not by pressing the up and down keyboard buttons. If TSQLRestClientURI.onIdle is nil or the database call in onSelectCell is removed it works - ie clicking on a row doesn't select it. Any ideas where this is going wrong? Thanks
Offline
Pages: 1