You are not logged in.
Hi Arnaud, what do you mean ?
You need more details ?
The Problem occours not very often !
Hi Arnaud,
today we had this Problem:
TSynLog.Family.RotateFileCount := 100
TSynLog.Family.RotateFileSizeKB := 500MB
TSynLog.Family.RotateFileDailyAtHour := 23
LogSize : 946MB
And 100 Files Created each containing the Log with some few lines added
It seems that the Log is not truncated / deleted after creating the synlz
so that every synlz contains the Log beginning at the same Line but enhanced with some newly added rows.
After restarting the Service everything runs as expected
Any Idea ?
Ty for your answer, i understand that client should not wait long for answers
Hi Arnaud, i found this topic: https://synopse.info/forum/viewtopic.php?id=6249
and have a similar problem.
On Client Side i prepare a lot of Data lets say 50000 Records.
I pass them as an array of Records thru a SOA Function
The Server needs 10min to work on this records.
so i have to set my Timeouts > 10min (Send/Receive/Connect)
else a retry will occur and send the Records again.
As you wrote in the topic the server should only use ms to answer.
What will be the best approach to realise this big task ?
Should i implement an own thread handling it and send notifications during processing to client ?
Also as in topic, debugging is anoying with the retry.
What is the reason to retry the sending of data ? Should this not be handled in the SOA Call.
Good Tip thank you very much
Hi Arnaud, today i had a litte bit of time to fix the Problem.
in my Code a had lots of
TSynLog.Add.Log(sllEnter, .... (Used in Class Procedure)
But there is no automatically genereted sllLeave
LogView uses a recursive function: ComputeProperTime to calc times
This was called to often.
i made to things:
1. i increased the Stack Size of LogView with Compiler Switch: {$M 16384,4194304}
2. i changed the sllEnter to sllDebug
How can i use sllEnter in class functions/procedures to get runtime ?
Should i manually add sllLeave ?
Just to end this Ticket, with OPENSSL Version the Connection coulf be establiched.
One Thing: if i copy only the first dll (libcrypto...) and Libssl is missing, the Error Message should be like: libssl.. is missing ...
Ty just to give more information:
On Server Side Client Connection works in both modes.
Only Clients connecting over Network get timeout error
OpenSSL is disabled, I'll try it using OpenSSL
Hi i just switched from WinHttp to Socket client and get error 10060
Log Output
InternalUri GET
...
ESChannel {recv : Socket Error 10060}
ENetSocket {THttpClientSocket.DoTlsAfter: TLS failed ..
after a timeout of 30s
With WinHttp the connection can be established
We connect to a server with valid certificate.
I need a clou how to find the reason for the error- any thougths ?
Hi thank you very much tomas, actually we have modified the mustache Template an can use it with m2. I ll report some things if we are finished
Hi ttomas, thanks for the code. i directly testet it and have some results !
1. The nested records are fine now
but there are the following problems now:
1. the definition of all the dynamic array types is behind (under) the use of them in the previous defined records. (May be depending on the wrapper
2. in the variant2 and 2variant function there is something wrong added
would be easier to understand if i provide some graphics
Link with pictures
I testet today with the latest release - Same Error - Syncrossplatform Client can not be created with m2
ty i tried my best but was a little confused converting from c to delphi. But now it works and certificate is found.
Now after getting the Handle the next error comes in AfterAccept:
Erste Gelegenheit für Exception bei $76CCDD80. Exception-Klasse ESChannel mit Meldung '<>: AcquireCredentialsHandleW returned 8009030E [2148074254], System Error 1312 [Eine angegebene Anmeldesitzung ist nicht vorhanden. Sie wurde gegebenenfalls bereits beendet]'.
Something about missing Credentials
Yes certificate is in HKLM/Software/Microsoft/SystemCertificates/MY/Certificates
But CertOpenStore returns nil ...
May Be Something wrong with Parameters:
CERT_STORE_PROV_SYSTEM = 10;
CERT_STORE_MAXIMUM_ALLOWED_FLAG = $00001000;
CERT_SYSTEM_STORE_CURRENT_USER = $00010000;
CERT_SYSTEM_STORE_LOCAL_MACHINE = $00020000;
var LProvider : AnsiChar := #10; // CERT_STORE_PROV_SYSTEM or CERT_STORE_MAXIMUM_ALLOWED_FLAG
var LMy := 'MY';
fAcceptCertStore := mormot.lib.sspi.CertOpenStore(@LProvider, 0, nil, CERT_SYSTEM_STORE_LOCAL_MACHINE, @LMy);
tried also with Admin rights / Ask for User also does not work.
ty ab-
I'm a few steps further, Moving my Certiicate to MY private storage and looking for ThumbPrint now works:
LsThumbPrint := '12097c0d0db94e85b83b415bc8b6aa324dcd9dc1';
flags := Length(LsThumbPrint) div 2;
SetLength(certblob, flags);
HexToBinFast(PAnsiChar(LsThumbPrint), PByte(certblob), flags);
blob.cbData := flags;
blob.pbData := pointer(certblob);
fAcceptCert := mormot.lib.sspi.CertFindCertificateInStore(fAcceptCertStore, X509_ASN_ENCODING or PKCS_7_ASN_ENCODING, 0, $10000, @blob, nil);
if fAcceptCert = nil then
raise ESChannel.Create('AfterBind: no Certificate available');
But if i use my request to local machine (See above) and then look for thmubprint does not work - may something wrong with selecting right storage
You need to use the TNetTlsContext fields.
My guess is that you need client TLS authentication using a certificate with a private key stored within the local windows storage?But it depends on the TLS engine used.
For OpenSSL you can specify CertificateFile or other fields if needed.
For SSPI (default on Windows), you can't specify a client certificate (yet).You can try to modify TSChannelNetTls in mormot.net.sock.windows.inc to add the ability to specify a client Certificate in TNetTlsContext.
Either as a file name or a file fingerprint using CertFindCertificateInStore(CERT_FIND_HASH).
If you need it for SSPI, I could try to implement it, and you may validate/test it.
Hi Arnaud, my certificate is stored in local Machine storage. so i tried to add it to SChannel Afterbind, but get error on start i can not explain to me:
procedure TSChannelNetTls.AfterBind(var Context: TNetTlsContext);
var
certblob: RawByteString;
blob: TCryptDataBlob;
pass: SynUnicode;
flags: integer;
begin
if Context.CertificateFile = '' then begin
// Load certificate and private key from Windows certificate store
// fAcceptCertStore := CertOpenSystemStoreW(nil, 'MY')
var LProvider : WideChar := WideChar(CERT_STORE_PROV_SYSTEM);
var LMy := 'MY';
fAcceptCertStore := mormot.lib.sspi.CertOpenStoreW(@LProvider, 0, nil, CERT_SYSTEM_STORE_LOCAL_MACHINE, @LMy);
end else
begin
certblob := StringFromFile(TFileName(Context.CertificateFile));
At Programm start a message pops up CertOpenStoreW not found in dll (my exe name) in source is it declared as extern crypt32.dll
any idea ?
Just for your information, yesterday i got corrupted packets at size 1.6MB with 7177
i checked it with latest version 7184 and it worked !
You can use certmgr.msc to import .p7b file and then export as .pfx.
i tried it, but the file does not include the private key - Export is grey for this
Hi i have the p7b File of the Certificate can i use this ?
Hi Arnaud,
im Using WEBSOCKET_DEFAULT_MODE in some of my new services.
Before i used useHttpApiRegisteringURI
now i have to switch some services also using https from http to Socket mode. There was a Certificate attached to the service by fingerprint from Windows certificate storage.
I read your Blog with detailed information on how to setup the tls:
https://blog.synopse.info/?post/2022/07 … WebSockets
Is it possible to use the Certificate from Windows Storage as TLS Parameter ?
Or is there a way to export it to give tls the cert files ?
But one question, i set HTTPSERVER_DEBUG_OPTIONS in TRestHttpServer.Create(...
But fDebugLog in mormot.net.async - procedure TPollAsyncSockets.ProcessWrite( const notif: TPollSocketResult; sent: integer); is nil an no Debug written,
where should i set rsoLogVerbose ?
Hi Arnaud i can confirm that it works now as expected. Thank you !
Question, i saw lot of DoLOG lines in the Socket Code, how can i activate it ? May be i can find the Error on the server
I switched Server to useHttpApiRegisteringURI and the Request works as before. So definitelly a server problem with WEBSOCKETS_DEFAULT_MODE
I think the Problem is on the Server Side,
i digged a little Deeper
i swiched client to Socket Client and put FileFromString in mormot.net.http GetBody line 4266:
if Http.CompressContentEncoding >= 0 then
Http.UncompressData;
if Assigned(OnLog) then
OnLog(sllTrace, 'GetBody len=%', [Http.ContentLength], self);
FileFromString(http.Content, 't:\sockresp.txt');
if SockIn <> nil then
the received data is corrupted. In Former test i used WinHttp Client.
i wrote resp in File (Line 724 mormot.soa.client) and the same value as in log i described further, Log is correct.
begin
FileFromString(resp, 't:\resp.txt', true);
if (JsonDecode(pointer(resp), ['result', // 0
'id' // 1
i use WEBSOCKETS_DEFAULT_MODE
Hi Arnaud, i debugged the code and compared V 2.2.6792 with 2.2.7166
with 7166 the parser said - Error in File, so i compared the Log Outputs from 6792 and 7166 both Server Side and Client Side.
6792 works as expected. But in 7166 Client Log the JSON Buffer was corrupted after Byte 524288, is there a Buffer to small ? My Data has in all cases 692979 Byte !
The Client got 692979 Byte but after Byte 524288 was a copy starting at byte 262144
There Seems to be a buffer Problem in the 7166 client
Hi Arnaud, today i get an error calling a simple SOA function:
here a part of the log:
27.02.2024 14:36:12.224 Enter 1 mormot.soa.client.TServiceFactoryClient(18f37450).InternalInvoke IDomBelegverwaltung.GetAlleAuftraege("",1) 1
27.02.2024 14:36:12.224 Enter 1 mormot.rest.http.client.TRestHttpClientWinHttp(18f738a0).InternalUri POST
27.02.2024 14:36:12.256 Client 1 mormot.rest.http.client.TRestHttpClientWinHttp(18f738a0) POST LSYS/DomBelegverwaltung.GetAlleAuftraege/1?session_signature=000d4a4f0018aa4462b2baf2 status=200 len=692979 state=5
27.02.2024 14:36:12.256 Leave 1 00.039.894
27.02.2024 14:36:12.256 Service return 1 mormot.soa.client.TServiceFactoryClient(18f37450) {"result":[[{State:2,Anlagedatum:"2023-09-20T10:53:14",LetzteAenderung:"2023-12-14T15:08:53",....
27.02.2024 14:36:12.256 Leave 1 00.046.140
27.02.2024 14:37:45.976 Exception 1 EInterfaceFactory {Message:"TInterfacedObjectFakeClient.FakeCall(IDomBelegverwaltung.GetAlleAuftraege) failed: 'Invalid returned JSON content: expects {result:...}, got {\"result~:[[{State:2,Anlagedatum:\"2023-09-20T10:53:14\",LetzteAenderung:\"2023-12-14T15:08:53
As you can see the server sends everything ok, but in last line instead of result: there is \"result~: and other Strings are also escaped.
Not every SOA Call has this behavior, may be it depends on the amount of Data received.
Hi Arnaud,, forget my last question, i read in other posts in the forum that the callback like approach will not work with WebSockets.
I'll do it in a different way
Hi i have implemented a client Server for windows now. And the next step is to be notified on a Webpage using WebSocket
i tried it but WebSocket does not connect. So created a litte sample for your restws_chatserver.exe. But also can not connect.
Is there a sample on how to connect to that kind of WebSocket from JavaSript/html ?
I like to do something similar as with the ChatClient
Calling Join Funktion and receive the Chat in the Callback.
Sample (copied from : SimpleEchoServer - mormot1) but here i try to connect to Chatserver.
function init(){
try
{
socket = new WebSocket("ws://localhost:8888/root/","synopsebin");
log('WebSocket - status '+socket.readyState);
socket.onopen = function(msg){
console.log(msg);
log("onopen: Welcome - status "+this.readyState);
};
socket.onmessage = function(msg){
console.log(msg);
log("onmessage: ("+msg.data.length+" bytes): " + (msg.data.length < 5000 ? msg.data : (msg.data.substr(0, 30) + '...')));
};
socket.onerror = function(msg){
console.log(msg);
log("onerror - code:" + msg.code + ", reason:" + msg.reason + ", wasClean:" + msg.wasClean + ", status:" + this.readyState);
};
socket.onclose = function(msg){
console.log(msg);
log("onclose - code:" + msg.code + ", reason:" + msg.reason + ", wasClean:" + msg.wasClean + ", status:" + this.readyState);
};
}
catch(ex)
{
log(ex);
}
$("msg").focus();
}
ty
I think i can solve it with the Samples from m2: ex/rest-websockets.
Hi Ab, is there a simple Solution to this Idea:
Lets say i have 10(or more) client showing data from my Server received with some SOA Calls.
Now one of the clients does some updates on the data and sends it to the server, using SOA - Update call.
Now i like the Server to inform the Client about data changes, to display the changed data.
I don't like to pull the Data every 5s from the client.
i like to have a kind of Push message from the Server to the clients interested in this message.
The Client could also be a Webseite using WebSockets.
Is it possible to use the same port as the SOA Server for the Socket Server or do i need a second port ?
i read this: https://blog.synopse.info/?post/2022/05 … n-mORMot-2
Ty Arnaud, for me it works now. Using the Cache is not so Important than a successful reconnect - for Performance.
Our Trafic is very low.
Hi we have some Reconnect Problem (Backend is MySQL with UniDAC) by auth?/Username=
Let me Explain
We Connect a SOA Client with mormot Authentication.
For test Reason i build up a Query Cache by Calling 20 SOA - Calls from my SOA Client.
Then i disconnect/connect my MySQL Server (To Force a Connection lost)
After this the First SOA Call returns with Error 403 (unknown user)
(Here NewStatementPrepared finds the Statement: NewStatementPrepared(select ID,LogonName,DisplayName,PasswordHashHexa,GroupRights from DFSQLAuthUser where LogonName=? limit 1) in Cache and returns without Reconnect
The Next SOA Call works because NewStatementPrepared does a Reconnect.
What do you think ? Is there an Error in the Authentication because it does not reconnect ?
Here is a Screenshot from the Log: https://ufile.io/su7052wv
Hi Arnaud,
i like to remember to this Problem postet before:
https://synopse.info/forum/viewtopic.php?id=5835)
it would be nice to have the possibility to produce SynCrossplatform Client with m2 - is there any progress to expect ?
br
May be this is already discussed, but i don't know...
Im looking for an fast and resource - saving way to check if my Server is reachable.
like a ping.
is there something contained in mormot ?
Hi Arnaud,
i get Stack Overflow in Log Viewer (64Bit) Not (32Bit) - Where Should i send the Log file ?
Hi Arnaud,
im Thinking about to Replace SynCrossPlatform Client mainly for SOA - WebServices (from Mormot2)
Actually i use Windows Client which works Perfectly with it. But now i like to use this on Android/iOS Client without SynCrossPlatform Wrapper.
(One of the Reason is as in one of my former tickets - That i can not build SynCrossplatform Client for mormot2 (https://synopse.info/forum/viewtopic.php?id=5835))
The Client is very easy - Connect / SetUser
Then call the Interface functions.
But the whole interface seems to be optimized by Assembler Code.
For my Mobile i do not need that much speed, so i think a PUREPASCAL Implementation could be enough here. (And it will be automatically work on iOS / Android)
Is it Possible to build a Client for Mobile for this ? Or are there any plans ?
just for my interest
in the above sample you use Writeln( with dst as parameter
i think writeln uses an implicit cast of RawUtf8 To String or am i wrong ?
tyvm i can work with it
Hey Arnaud, we call a SOA Interface function from a client.
we have 5 "Object" Parameter and 2 are initialized with nil on the Client.
On the Server this Parameter are not set to nil, they contain an "empty" Object. Is it possible to get the "nil" parameter.
Specially if one of the Parameter is an "out" Parameter, how is it with memory Management ?
Example:
TMyObject = class TSynPersistent...
interface...
function SOAFunktion(out AResultObject : TMyObject; const AParam1, Param2, AParam3 : TMyObject; const AParam4:TMyObject = nil) : TResultRecord;
Client Calls
var LResult : TMyObject := nil;
AServer.SOAFunction(LResult, p1, p2, p3, nil);
On the Server Side all 5 Objects does contain a TMyObject, p1-3 are the desired Objects. but AResultObject and AParam4 should be nil ?!
Tyvm
Im not pretty sure "when" it changed. but we noticed today, that RawByteStrings (member of a record) are send without JSON_BASE64_MAGIC Chars at the beginning.
SynCrossplatformJSON's Base64JSONStringToBytes testet for this by default and as it is not present my Blob is not received.
I changed the Withbase64Magic to false and my Blob is received correct.
my m2 Record looks like this:
RRecord = packed record
dateiname : RawUtf8;
groesseinbytes : integer;
dateityp : RawUtf8;
dateidatum : TDateTime;
dokument : RawByteString; // <- This Data is send without magic
end;
On Client it looks like this:
RRecord = record
dateiname: String;
groesseinbytes: Integer;
dateityp: String;
dateidatum: TDateTime;
dokument: TSQLRawBlob;
end;
function Variant2RRecord (_variant: variant): RRecord;
var _a: integer;
_arr: PJSONVariantData;
begin
result.dateiname := _variant.dateiname;
result.groesseinbytes := _variant.groesseinbytes;
result.dateityp := _variant.dateityp;
result.dateidatum := Iso8601ToDateTime(_variant.dateidatum);
result.dokument := VariantToBlob(_variant.dokument);
end;
Is this the new "default" behavior or is it an Error ?
@AB the Tester(from Apple) can access the MVC Server from the device Safari browser, but not the soa server from our app.
Syncrossplatformclient from m1 latest release.
@dcoun - the m2 server is behind a iis reverse proxy, and is encrypted with https and Letsencrypt certificate
Hi alltogether, may be one of you encounterd the same Problem with a similar case.
we use m2 as server, this server has 2 function a mvc view which can be used to browse some data and a soa webservice with function called from a syncrossplatform client.
the Tester at apple uses an iphone connected by tethering.
The Tester can open the mvc pages and browse it, but as he uses our app, no connection can be established.
I think there is a kind of content filter blocking the SOA - Traffic.
Im not so deep in network so may you can help. Is there an option to let the SOA trafic look like normal website trafic as the mvc view - for the content filter.
Or does anyone have another thougt / clue
thank you in advance
I forgot to mention, we don't have the connection Problem with many other devices...
sry arnaud, I defined both what meens it did not work defining both defines in Projekt-Options.
I tried now with secTLSSelfSigned - Same Error
USE_OPENSSL - Here the initialization with NewOpenSslNetTls is not called (Set breakpoint) Do i have to set some more parameter ?
One more info the self signed certificate on my develop computer uses sha256RSA