You are not logged in.
Hi ab, I'm trying to add a new restserver which exposes interface service running in Mainthread. But if client call the new service, server will hang on this request till timeout.
Server side compiled with FPC(tried with: 3.2.0-beta-r41498 & 3.1.1-r39235 ) + mormot (latest code on github) running on Linux x64.
server code like this:
aServer.ServiceRegister(TServiceRemoteSQL,[TypeInfo(IRemoteSQL)], sicPerThread).SetOptions([], []);
bServer.ServiceRegister(TServiceRemoteTS,[TypeInfo(IRemoteTS)], sicClientDriven).SetOptions([], [optExecInMainThread,optFreeInMainThread]);
aHTTPServer := TSQLHttpServer.Create(PORT_NAME,[aServer, bServer]);
Request URL:
http://172.16.13.122:6610/boot/RemoteTS … 595fe9b2ca //this request fine
http://172.16.13.122:6610/boot/RemoteTS … 59a13f2640 //this request will hang
server log :
20190308 02331860 # srvr mORMot.TSQLRestServerFullMemory(00007F9CF08E4D30) User 172.18.0.3 POST root/RemoteSQL.ExeBin Interface=200 out=397 B in 3.95ms
20190308 02331860 # - 00.004.030
20190308 02331901 # + mORMot.TSQLRestServerFullMemory(00007F9CF08E6DF0).URI POST boot/RemoteTS._instance_?session_signature=6a48c0cf007f71595fe9b2ca in=2 B
20190308 02331901 # auth mORMot.TSQLRestRoutingREST(00007F9CEE8F5D30) User/1783152847 172.18.0.3
20190308 02331901 # debug mORMot.TSQLRestServerFullMemory(00007F9CF08E6DF0) TServiceFactoryServer.InternalInstanceRetrieve: Adding RemoteTS(00007F9CF07B2600) instance (id=1) count=1
20190308 02331901 # srvr mORMot.TSQLRestServerFullMemory(00007F9CF08E6DF0) User 172.18.0.3 POST boot/RemoteTS._instance_ Interface=200 out=12 B in 124us
20190308 02331901 # ret mORMot.TSQLRestServerFullMemory(00007F9CF08E6DF0) {"result":1}
20190308 02331901 # - 00.000.234
20190308 02331903 # + mORMot.TSQLRestServerFullMemory(00007F9CF08E6DF0).URI POST boot/RemoteTS.TransactionStart/1?session_signature=6a48c0cf007f7159a13f2640 in=2 B
20190308 02331903 # auth mORMot.TSQLRestRoutingREST(00007F9CEE8F5D30) User/1783152847 172.18.0.3
20190308 02334961 $ info SetThreadName 00007F9CEFB17700=TSQLHttpServer 8888/root boot TSynThreadPoolSubThread
20190308 02334961 $ trace mORMot.TSQLRestServerFullMemory(00007F9CF08E4D30) BeginCurrentThread(TSynThreadPoolSubThread) root=root ThreadID=00007F9CEFB17700 ThreadCount=3
20190308 02334961 $ trace mORMot.TSQLRestServerFullMemory(00007F9CF08E6DF0) BeginCurrentThread(TSynThreadPoolSubThread) root=boot ThreadID=00007F9CEFB17700 ThreadCount=3
20190308 02334961 $ + mORMot.TSQLRestServerFullMemory(00007F9CF08E6DF0).URI POST boot/RemoteTS._free_/1?session_signature=6a48c0cf007f71d255b6dea8 in=2 B
20190308 02334961 $ auth mORMot.TSQLRestRoutingREST(00007F9CED18C970) User/1783152847 172.18.0.3
20190308 02342161 % info SetThreadName 00007F9CEFA96700=TSQLHttpServer 8888/root boot TSynThreadPoolSubThread
20190308 02342161 % trace mORMot.TSQLRestServerFullMemory(00007F9CF08E4D30) BeginCurrentThread(TSynThreadPoolSubThread) root=root ThreadID=00007F9CEFA96700 ThreadCount=4
20190308 02342161 % trace mORMot.TSQLRestServerFullMemory(00007F9CF08E6DF0) BeginCurrentThread(TSynThreadPoolSubThread) root=boot ThreadID=00007F9CEFA96700 ThreadCount=4
20190308 02342161 % + mORMot.TSQLRestServerFullMemory(00007F9CF08E4D30).URI GET root/Auth?UserName=User&Session=520179731&session_signature=1f015013007f724f984fdeb5 in=0 B
20190308 02342161 % auth mORMot.TSQLRestRoutingREST(00007F9CED124BF0) User/520179731 172.18.0.3
...
20190308 02405509 % + mORMot.TSQLRestServerFullMemory(00007F9CF08E4D30).URI GET root/timestamp in=0 B
20190308 02405509 % srvr mORMot.TSQLRestServerFullMemory(00007F9CF08E4D30) 172.18.0.3 GET root/timestamp Method=200 out=12 B in 39us
20190308 02405509 % ret mORMot.TSQLRestServerFullMemory(00007F9CF08E4D30) 135502113335
20190308 02405509 % - 00.000.133
Offline
uh , my low level bug, thank you ab.
used Syncommons.ConsoleWaitForEnterKey , which will give mainthread chance to work on windows, so works well on windows; but this function just Readln on linux, so mainthread is starved to end.
And is there some util-function can do this work ?
Offline
We use signals and fpPause for this
Signal interception https://git-pub.intecracy.com/unitybase … m.pas#L270
Signal handler https://git-pub.intecracy.com/unitybase … m.pas#L261
Main thread https://git-pub.intecracy.com/unitybase … m.pas#L557
Offline
We use signals and fpPause for this
Signal interception https://git-pub.intecracy.com/unitybase … m.pas#L270
Signal handler https://git-pub.intecracy.com/unitybase … m.pas#L261
Main thread https://git-pub.intecracy.com/unitybase … m.pas#L557
Hello mpv, interesting, I assume you mean (https://www.freepascal.org/docs-html/rt … pause.html)
Do you know similar things exist for Delphi for Windows
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Thanks mpv, your code works fine , it helps gracefully quit app. And fpPause will just sleep mainthread but not respond to later sub-thread synchorize , and CheckSynchronize(10) will do the work.
Offline