#1 2024-10-31 22:26:10

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

error in the server's logs

I am getting the following exception in the logs

31/10/2024 10:57:40.832    Exception    8        ESqlDBPostgres {Message:"TSqlDBPostgresLib Exec failed: 22021 [ERROR:  invalid byte sequence for encoding \"UTF8\": 0xa2\nCONTEXT:  unnamed portal parameter $14\n]",Statement:null} [R1:testdv1testdv0] at 8ccdc6 ../../../../../DG/mORMot2/src/db/mormot.db.raw.postgres.pas  (437) ../../../../../DG/mORMot2/src/db/mormot.db.sql.postgres.pas  (1015)

Offline

#2 2024-11-01 17:37:24

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

Re: error in the server's logs

It means that something you sent is not UTF-8.

Check your strings content.

Offline

#3 2024-11-03 05:27:56

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

Re: error in the server's logs

Thank you @ab.
Is it possible to check if a string is utf8 or has invalid characters?

Offline

#4 2024-11-03 07:59:09

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

Re: error in the server's logs

You have IsValidUtf8() from the mormot.core.unicode.pas unit.

Offline

#5 2024-11-12 20:49:03

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

Re: error in the server's logs

An other error I usually find:
Exception: 20241112 17391118  # EXC   ENetSock {LastError:"nrClosed",Message:"THttpClientSocket.SockRecv(283) read=0 [Closed - #5]"} [Main] at b2bf7e mormot.net.sock.pas TCrtSocket.SockRecv (5862)   mormot.net.client.pas THttpClientSocket.RequestInternal (2408) fastmm5.pas FastMM_GetMem_GetSmallBlock (7186) System.pas @GetMem (4969) System.pas @NewAnsiString (26157) System.pas @LStrSetLength (30045) mormot.net.client.pas THttpClientSocket.Request (2516) mormot.rest.client.pas TRestClientUri.IsOpen (2155) mormot.rest.client.pas TRestClientUri.IsOpen (2227) mormot.rest.http.client.pas TRestHttpClientSocket.InternalRequest (780) mormot.rest.http.client.pas TRestHttpClientGeneric.InternalUri (580) mormot.rest.http.client.pas TRestHttpClientGeneric.InternalUri (582) rest.wsclient.pas TPCHRclient.setJWTheader (278) rest.wsclient.pas TPCHRclient.setJWTheader (279) rest.wsclient.pas TPCHRclient.setJWTheader (280) mormot.rest.client.pas TRestClientUri.OnBackgroundProcess (1980) mormot.rest.client.pas CallInternalUri (2524) mormot.rest.client.pas TRestClientUri.Uri (2556) System.pas TMonitor.TryEnter (20364) System.pas TMonitor.TryEnter (20364) System.Generics.Collections.pas TListHelper.InternalDeleteRange4 (3873) System.Generics.Collections.pas TListHelper.InternalDeleteRange4 (3879) fastmm5.pas FastMM_GetMem_GetSmallBlock (7186) System.pas @GetMem (4969) System.pas @NewAnsiString (26157) mormot.soa.client.pas DoClientCall (643) mormot.soa.client.pas TServiceFactoryClient.InternalInvoke (688) mormot.soa.client.pas TServiceFactoryClient.Invoke (583) mormot.core.interfaces.pas TInterfacedObjectFake.FakeCallGetJsonFromStack (3448) mormot.core.interfaces.pas TInterfacedObjectFake.FakeCallInternalProcess (3544) mormot.core.interfaces.pas TInterfacedObjectFakeRaw.FakeCall (3307)

Is this expected due to network conditions?

Offline

#6 2024-11-12 20:52:38

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

Re: error in the server's logs

The following can exist also:
Exception: 20241108 20071551  ! EXC   EInterfaceFactory {Message:"TInterfacedObjectFakeClient.FakeCall(ImwbService.GetDBormvers) failed: 'Invalid returned JSON content: expects {result:...}, got "} [Main] at 45df37 mormot.core.text.pas ESynException.RaiseUtf8 (9507)   fresultcomp.pas Tresultcomp.FormCreate (150) Vcl.Forms.pas TCustomForm.DoCreate (5516) Vcl.Forms.pas TCustomForm.AfterConstruction (5384) System.pas @AfterConstruction (19735) Vcl.Forms.pas TCustomForm.Create (5373) feditdoc.pas Teditdocument.b_protoClick (713) Vcl.Controls.pas TControl.Click (8037) AdvGlowButton.pas TAdvCustomGlowButton.Click (3798) Vcl.Controls.pas TControl.WMLButtonUp (8177) AdvGlowButton.pas TAdvCustomGlowButton.WMLButtonUp (4342) Vcl.Controls.pas TControl.WndProc (7921) Vcl.Controls.pas TWinControl.IsControlMouseMsg (10886) Vcl.Controls.pas TWinControl.WndProc (11156) Vcl.Controls.pas TWinControl.MainWndProc (10823) System.Classes.pas StdWndProc (19092) Vcl.AppEvnts.pas TMultiCaster.GetAppEvents (687) Vcl.Forms.pas TApplication.ProcessMessage (13376) Vcl.Forms.pas TApplication.HandleMessage (13406) Vcl.Forms.pas TApplication.Run (13545)

GetDBormvers is declared as:
function GetDBormvers:rawjson;

Offline

#7 2024-11-13 07:05:02

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

Re: error in the server's logs

Ensure you use the latest framework version.

Offline

#8 2024-11-13 07:15:54

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

Re: error in the server's logs

I am using last version from GitHub,

Offline

#9 2024-12-22 19:44:22

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

Re: error in the server's logs

In a legacy application I have a mormot2 httpd server in a random port and the application user interface does calls to this server.
Sometimes after multiple requests to this server it happens the following:

When the interface function called in the server the response (before function ends) seems ok:
response.png

The client from the above request has the following after the call is finished:
badresponse.png

I noticed that the json is somehow different.
After a while (after other calls to the server), everything seems ok.

@ab Any idea, how to check further this problem?

Offline

#10 2024-12-22 21:17:31

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

Re: error in the server's logs

Run your project in the MM in full debug mode, to try to identify the cause of the memory corruption.

Our tests can't reproduce such behavior.

It does not look like memory corruption, but unexpected compression.

Offline

#11 2024-12-23 06:54:01

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

Re: error in the server's logs

FastMM5 runs in full debug mode without reporting memory corruption or memory leaks
Usually this problem can happen when I am expecting to receive calls from server in the websockets and at the same time I am using the same http websocket client to do calls to the server.
Should I keep a websocket http client just to receive and do all client's calls to the server through an other usual http client?

Concerning compression, clients and server are enabled for compression

Offline

#12 2024-12-23 09:00:55

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

Re: error in the server's logs

Ah you are using websockets.

Ensure you use the WebSockets client link in a single thread. But it is fine to do all input/output on a same WebSockets link.

Offline

#13 2024-12-23 09:37:48

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

Re: error in the server's logs

Just a question about that:
websocket's client can be used from other threads inside Synchronize/Queue ?

Offline

Board footer

Powered by FluxBB