#1 Re: mORMot 2 » regression AESSHA256Full » 2025-08-14 15:39:33

It was the missing first line (4289):

ctx.Flags := [];

in function TAes.DecryptInitFrom(const Encryption: TAes;

Now it works.

https://github.com/synopse/mORMot2/pull/374

#2 mORMot 2 » regression AESSHA256Full » 2025-08-14 10:58:35

danielkuettner
Replies: 1

Hello,

under Win64/Delphi 10.4 with current mORMot2 AESSHA256Full (decrypt) results in av
  by call of MoveFast(Encryption, self, SizeOf(TAes)); //line 4294 in mormon.crypt.core.pas
  in mormot.core.base.asmx64.inc (MoveFast line 395).

With revision 9f99b38beac50b425f46420aec27a93f5d109f42 from 2025-05-13 it was still working.

https://gist.github.com/danielkuettner/ … 5ad0349de4

#4 Re: mORMot 2 » TOpenApiParser fails on this OpenApi-Schema... » 2025-08-11 18:28:12

Luwo wrote:

I have no idea why the name was chosen that way. But I'm sure there's a reason for it...   ...but I just don't know it :-)

Wawi is a short for Warenwirtschaft.
JTL-Software-GmbH are Germans. For such Wawi is a fundamental word in their business language (just like beer for English -> beer -> bearer)

#5 Re: mORMot 2 » Not expected behaviour with Dictionary » 2025-08-05 16:06:48

Why didn't you include Integer into your Int64 normalization?
What is working for Byte should also work for Integer.

#6 Re: mORMot 2 » ACME + TMVCApplication » 2025-08-02 09:53:31

chaa wrote:

But at the moment, I dont understand difference between SSL_CTX_add0_chain_cert and SSL_CTX_add_extra_chain_cert.

https://mailman.nginx.org/pipermail/ngi … 08252.html

#7 Re: mORMot 2 » Upcoming FPC 3.2.4 » 2025-06-28 10:08:35

When I downloaded https://downloads.freepascal.org/fpc/be … -linux.tar
and call install.sh included I get right version:

daniel@ubuntu-32gb-hel1-1:~/fpc-3.2.4$ ./bin/fpc
Free Pascal Compiler version 3.2.4-rc1 [2024/07/20] for x86_64

Result of mormot2test compiled with that fpc version looks also good:

Software version tested: 2.3.10979 (2025-06-28 10:06:27)

Ubuntu 24.04.1 LTS - Linux 6.8.0-49-generic [utf8 30.6GB 6080010]
    16 x AMD EPYC Processor [512KB] (x64)
    on Hetzner vServer 20171111
Using mORMot 2.3.10979 x64MMs 28 Jun 2025 and OpenSSL 3.0.13 30 Jan 2024
    TSqlite3LibraryStatic 3.46.1 with internal MM
Generated with: Free Pascal 3.2.4 64 bit Linux compiler

Time elapsed for all tests: 28.32s
Performed 28 Jun 2025, 10:07:10 by daniel on ubuntu-32gb-hel1-1

Total assertions failed for all test suits:  12 / 123,667,941
! Some tests FAILED: please correct the code.

#8 Re: mORMot 2 » Transaction with Multi-Table » 2025-06-20 08:50:16

An alternative of TSynUniqueIdentifierGenerator.ComputeNew is using of sequences to compute the ID's before building the Batch.

#9 Re: mORMot 2 » got av in mormot.core.unicode after update » 2025-05-24 12:08:35

If you need a vm to test, I'd have one for you.
If you need help to setup your own vm + fpc, please don't be to shy to mail me. I don't want to wast your time with DevPps stuff.

#10 Re: mORMot 2 » got av in mormot.core.unicode after update » 2025-05-22 09:12:32

Hi Arnaud,

I hope you are back from holidays...

The issue remains with current mORMot2 under -O2/-O3. With -O1 it works. Do you plan some fixing here? Could you generate the vm for FreeBSD?

Daniel

#11 Re: mORMot 2 » Simple Question for new DoLog/Enter » 2025-05-13 10:26:05

The best way is not to use TSynLog.Enter(...
Instead use:

var
  aLog: ISynLog;
begin
  aLog:= TSynLog.Enter(Self); //this is the first line before any other log
  aLog.Log(sslInfo, ...

#12 Re: mORMot 2 » got av in mormot.core.unicode after update » 2025-05-12 19:00:49

Sorry, but -02/-03 doesn't work with current version under fpc 3.2.0.
Disable inlining of FastNewString seems to be not enough:

Thread 4 "http1root" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff6ae5700 (LWP 32094)]
ADDTEXT (this=0x0, TEXT=0x0, ESCAPE=TWJSONESCAPE)
    at ../../mORMot2/src/core/mormot.core.json.pas:6776
6776        AddDirect('"');

Note: fpc 3.2.2 (and my FreeBSD) all works without issue under current mORMot2 version.

#13 Re: mORMot 2 » got av in mormot.core.unicode after update » 2025-05-11 05:54:26

All right.
FreeBSD is worth it. It's really free and I have used it for years. The updates are better than under Linux. Kqueue should be better tan epoll. And bhyve is comparable with kvm.
And mORMot as a server system would be perfect as a FreeBSD-Port.
If you need something, please let me know.

#14 Re: mORMot 2 » got av in mormot.core.unicode after update » 2025-05-10 19:21:14

Yes I know.

In test.net.proto.pas there is an issue starting from line

1543   try^M
   1544     // validate raw TCP tunnelling^M

But I'm lost with all of that.

#15 Re: mORMot 2 » got av in mormot.core.unicode after update » 2025-05-10 15:16:48

With fpc 3.2.2 under freebsd 14.0-RELEASE-p11 no more memleak.

But in Network protocols a got an error:

- RTSP over HTTP buffered write: 2,100 assertions passed  44.04ms
! Network protocols - TTunnelLocal
! Exception OS EAccessViolation at 4257eb: 2025-05-10 15:04:12 []
  - IP addresses: 53 assertions passed  7us

#17 Re: mORMot 2 » got av in mormot.core.unicode after update » 2025-05-09 14:09:25

It looks like heaptrc...

Memory Status:
Small:  1/880B  including tiny<=128B arenas=8 fed from Medium
Medium: 2MB/132MB    peak=53MB current=2 alloc=106 free=104 sleep=3
Large:  0B/4GB    peak=27MB current=0 alloc=3K free=3K sleep=0
Total Sleep: count=3
Small Blocks since beginning: 46M/4GB (as small=45/46 tiny=56/56)
  48=16M  64=9M  16=5M  80=4M  96=2M  112=1M  528=1M  32=1M
Small Blocks current: 1/880B
  880=1

Leaks Identified:
small block leak x1 of size=880  (getmem=10373 freemem=10372)
Total small block leaks = 1
probable TEccCertificateSecret leak (808/880 bytes) at $00007FF4FD390CE0
Total objects leaks = 1

#19 Re: mORMot 2 » got av in mormot.core.unicode after update » 2025-05-08 16:57:29

Perfect!

Test are also successfully.
(mget was missing, in build_fpc.sh before compiling test a line for building mget works for me:

>fpc -MDelphi -Sci -Ci -g -gl -gw2 -Xg -k'-rpath=$ORIGIN' -k-L$BIN \
...
-B -Se1 "$LIB2/src/tools/mget/mget.dpr"

But some memleaks were reported:

WARNING! THIS PROGRAM LEAKS MEMORY!
Memory Status:
Small:  33/5KB  including tiny<=128B arenas=8 fed from Medium
Medium: 13MB/117MB    peak=53MB current=11 alloc=94 free=83 sleep=4
Large:  0B/4GB    peak=27MB current=0 alloc=2K free=2K sleep=0
Total Sleep: count=4
Small Blocks since beginning: 54M/5GB (as small=45/46 tiny=56/56)
  48=19M  64=10M  16=5M  80=4M  96=2M  528=1M  112=1M  32=1M
Small Blocks current: 33/5KB
  128=10  32=8  160=4  304=2  48=2  288=2  112=2  352=2

#20 Re: mORMot 2 » got av in mormot.core.unicode after update » 2025-05-08 14:33:17

disable inlining in FastNewString was it! Thanks a lot.

(mormot2tests doesn't compile, I don't know what's wrong. No error, just Error in ./build_fpc.sh on line 117)

#21 mORMot 2 » got av in mormot.core.unicode after update » 2025-05-08 13:13:20

danielkuettner
Replies: 19

Hi Arnaud,

after update (since Februar) I got under linux/fpc 3.2.0 with -02/-03 following av:

An unhandled exception occurred at $000000000052D2F4:
EAccessViolation: Access violation
  $000000000052D2F4  CASECOPY,  line 7632 of ../../mORMot2/src/core/mormot.core.unicode.pas
  $0000000000415F24
  $0000000000CA7401  ADDIMPLEMENTATION,  line 1803 of ../../mORMot2/src/soa/mormot.soa.server.pas
  $000000000051ADAA  SERVICEREGISTER,  line 7400 of ../../mORMot2/src/rest/mormot.rest.server.pas

With -01 it works. Under Windows/Delphi 10.4 it works too.

Greetings,
Daniel

#22 Re: mORMot 2 » ServerKeepAliveTimeOut » 2025-02-12 15:01:40

Thanks for explain, make sense.

So when using plain THttpServer, what's your proposal to set ServerKeepAliveTimeOut:= 0 (disabled keep alive)?

I'm creating just a TRestHttpServer which could creates different kinds of HttpServers (Socket, Api, Async) and ServerKeepAliveTimeOut property isn't public over  TRestHttpServer.HttpServer.

--> THttpServer(aTRestHttpServerInstance).ServerKeepAliveTimeOut:= 0; <-- looks like a hack

#23 Re: mORMot 2 » ServerKeepAliveTimeOut » 2025-02-12 08:10:30

I'm not using websockets, just plain Http.

But why I shouldn't use async server for that? I use HTTP_DEFAULT_MODE for TRestHttpServer and under linux this leads to useHttpAsync.

And I'm aware (now) of disabled keep alive is not for async server.

What do you mean with plain THttpServer? useHttpSocket?

#24 Re: mORMot 2 » logging with agl-angelize » 2025-02-12 08:01:38

@dcoun
As I remember I had the same issue with TSynLog for years. It's probably not related to mORMo2 but Windows:

https://stackoverflow.com/questions/687 … owsservice

#25 Re: mORMot 2 » ServerKeepAliveTimeOut » 2025-02-11 19:19:46

Interesting.

I hadn't issues with wrk and disabled keep-alive, but
under wrk nothing noticed about performance, but
much slower response times in production.

In production enviroment I use ngingx as a reverse proxy. Perhaps this is the difference.

But wrk and errors sound more like a race condition. Perhaps you could test with heaptrc and gdb for a longer time?

#26 Re: mORMot 2 » ServerKeepAliveTimeOut » 2025-02-11 18:39:51

Sure is a great word and what does it mean to you, when I am?
Better I show you what the log file says:

20250211 15375400  !  +            uHTTPServer.TSOneHttpServer(020f4f28).Create useHttpAsync (secNone) on port 8281
20250211 15375400  !  +                mormot.net.async.THttpAsyncConnections(03205f68).Create(THttpAsyncServerConnection,root,32)
20250211 15375401  " info  SetThreadName 7f69b8b6c640 140092047279680=R0:root
20250211 15375401  " trace uRestServerDB.TSOneRestServerDB(01dfe208) BeginCurrentThread(TAsyncConnectionsThread) root=root ThreadID=7f69b8b6c640 'R0:root' ThreadCount=1

#27 mORMot 2 » ServerKeepAliveTimeOut » 2025-02-11 15:53:52

danielkuettner
Replies: 9

Hello Arnaud,

a setting of ServerKeepAliveTimeOut:= 0 for TRestHttpServer (async) was the reason for 10x slower req times.

I used this option in past (never change a running system) and I reactivated it yesterday without any knowledge about it.
In context of the super fast progress/changing of mORMot may a ask if this option still usefull/relevant yet?

#28 Re: mORMot 2 » unexpected request timeouts » 2025-02-06 15:50:15

Hello Arnaud,

I could find the location of our culprit today.
But I'm not able to understand it by now and have to test more.

Thanks
Daniel

#30 Re: mORMot 2 » unexpected request timeouts » 2025-02-03 15:18:59

@ab
Today we had "same" behavior like @itSDS (I'm looking for errors on our side first and since weeks), but it's not a client issue on our side.
1. service isn't responsive any more (/timestamp over curl gives timeout too).
2. absolut no cpu-usage in any thread
3. no exceptions or error in (verbose) log file before.
4. absolut no timeout in postgres.

Our service runs since yesterday evening and we had about 40' request per hour till the issue at 2:20 pm.
We are using mORMot commit #fe67be7b8 / heap.inc / linux (fpc 3.2.0).

#31 Re: mORMot 2 » Issue about CP_54936 converting » 2025-01-29 13:33:23

@zen010101
Thanks.
I've also read about it but I wasn't able to belief or understand why it were done this way. When I set a codepage or save a file in utf8, then I expect utf8 and not utf16.

#32 Re: mORMot 2 » Issue about CP_54936 converting » 2025-01-29 09:56:43

I don't want to waste your time. It's a fpc issue I don't understand.

locale:
LANG=C.UTF-8
LC_CTYPE="C.UTF-8"
LC_COLLATE="C.UTF-8"
LC_TIME="C.UTF-8"
LC_NUMERIC="C.UTF-8"
LC_MONETARY="C.UTF-8"
LC_MESSAGES="C.UTF-8"
LC_ALL=

fpc:
compiled with -FcUTF-8
mormot.defines.inc inlcuded

file SOneSrv2.dpr:
Unicode text, UTF-8 (with BOM) text (also tested without BOM)

in .dpr just a writeln('ü') -> output: '?'

Thanks you,
Daniel

#33 Re: mORMot 2 » Issue about CP_54936 converting » 2025-01-28 19:07:02

But it is not a regression, you are right.

With mOMRmot2 054d2568 and Free Pascal Compiler version 3.2.2 [2023/11/14] for x86_64 under FreeBSD it has same behavior.

#34 Re: mORMot 2 » Issue about CP_54936 converting » 2025-01-28 19:01:43

all my units have a options.inc include with your
{$I mormot.defines.inc}

#35 Re: mORMot 2 » Issue about CP_54936 converting » 2025-01-28 18:51:36

Sorry (3.2.0), Free Pascal Compiler version 3.2.0-r45643 [2021/04/13] for x86_64
../source/VendorInterface/ImportVendor/Luxottica/uLuxottica.pas: UTF-8 Unicode (with BOM) text

Just a simple writeln('ü') output a ?.
But a writeln(StringTo('ü')) outputs correct ü.

#36 Re: mORMot 2 » Issue about CP_54936 converting » 2025-01-28 18:16:18

Just a question from today when working under linux (system codepage utf8), unit.pas is set to utf8 using fpc 3.2.2:

When I make a function Example(const s: RawJSON/RawUtf8/UTF8String) call with:

Example('äöü') -> it's not working any more. I have to call
Example(StringToUtf8('äöü')) to get the right string.

Is this a new behavior from this update. I can't remember to have such issues in past.

#37 Re: mORMot 2 » High-Performance Frameworks » 2025-01-17 16:59:18

I had added a new error in my service and that's the reason of the error accumulation from today. Sorry for that.
But it seems to exists an issue before my update, so I have posted here.
The conversation was nevertheless useless, becaus my service runs now in debug mode so I'm able to give you a map file next time the issue will occur.
Thanks for your help!

#38 Re: mORMot 2 » High-Performance Frameworks » 2025-01-17 11:59:20

I don't have a stack trace on my production system, just a log file (in verbose logging).

The mongdb call is a simple aggregate with a small result, called over a sicSingle service method. Not complex, just a very simple method.

I believe the root of the issue comes from our side, not from mORMot2. But I don't find any entries of interest in my logs.
The mongodb call methods are so simple, that there couldn't be any issue come from. I have 32 workers and every worker has its own mongodb connection in his own threadvar. No race condition, no blocking issue.
MongoDB calls are the main work in our service. If any worker connection would have an issue I would have a crash or errors instantly.

Atm I don't use your new rewrite version (just ef8764e2c).

To find out if async server is involved, should I switch to useHttpSocket and watch?

#39 Re: mORMot 2 » High-Performance Frameworks » 2025-01-17 11:45:35

After running for days without errors, today there are ones again.
Although my service is still running, I have got an av in the log:

20250117 11262413  % EXC    EOutOfMemory {Message:"Out of memory"} [R3:root] at 41c307

which comes from a call that will be called always and without issues at all. There is enough memory (45GB free of 100GB), so I guess cmem should find a free block.

I couldn't find anything interesting in log before that EXC. There is only this:

20250117 11262407  C trace mormot.net.async.THttpAsyncConnections(7f1eaaf795e0) DoGC #1=0 #2=13 free=0 client=0

But as you wrote before, nothing interesting.

#41 Re: mORMot 2 » High-Performance Frameworks » 2025-01-17 11:30:18

@ab
today I had a crash of my service. My log shows following entry:
20250117 09214012  C trace mormot.net.async.THttpAsyncConnections(7f48913675e0) DoGC #1=0 #2=8 free=0 client=3

that could be related to
the first exception
20250117 09214037  # EXCOS  EAccessViolation (8ff6e188) [R1:root] at 41c680

which comes from an harmless mongodb call.

Is it possible that DoGC (I guess it means "Do garbage collector") is the culprit?

#42 Re: mORMot 2 » High-Performance Frameworks » 2024-11-18 21:12:30

@ab Yes mem issue is outside of pipeline.
Today we had such an issue in our program (of course without pipeline):

SOneSrv2: malloc.c:4302: _int_malloc: Assertion `(unsigned long) (size) >= (unsigned long) (nb)' failed

We had no error in Postgres log at all. But we are using cmem.

#43 Re: mORMot 2 » SynZip in c# » 2024-11-05 20:16:53

@ebekman Congrats, you're almost there! SynZip is able to decompress your data. The pascal example from @zen010101 is working.

Now you need somebody who create a pascal .dll/.so for you that can be called from your c#.

#44 Re: mORMot 2 » threadvar // do not publish for compilation within Delphi packages » 2024-11-05 13:34:21

Threadvar's are created in a special memory area (thread-local storage). At compile time the addresses of that space for a thread created at runtime isn't fix.
Therefore libraries linked at compile time (which packages are) could have an issue with threadvar's. Dynamically loaded libraries are fine, because they will loaded at runtime, when the threads run.

Because of this it doesn't matter whether a threadvar is declared in interface or implementation part.

#45 Re: mORMot 2 » Validating JWT from JWKS certs in OAuth2 » 2024-11-01 19:32:13

@cadnan works and is much easier than my version, thanks.

but you shouldn't forget

try
...
finally
  FToken.Free;
end;

#46 Re: mORMot 2 » Validating JWT from JWKS certs in OAuth2 » 2024-11-01 14:35:51

I've implemented this task some time ago to check if I could handle it. It's not so easy, but perhaps the situation is more easy if I would have a real AD.

To verify the JWT you need the public key.
The public key in pem format you get from the x5c value. In my test case (at microsoft) the key changes every time (I can't remember the interval e.g. every 30 days).
To get it you have to call -> https://login.microsoftonline.com/'+ response.tenantId +'/discovery/v2.0/keys?appid=...
and compare the kid included in the JWT which you want to verify.

If you have the public key you can verify the JWT with this func:

function VerifyJWT(const aJWT: RawByteString; const aPublicKey: RawByteString; out JWT: Variant): Boolean;
  function VerifyWithmORMot(const aJWT: RawByteString; out JWT: Variant): Boolean;
  var
    Header, Payload, Signature: RawByteString;
    sigBinary, msgBinary: TBytes;
    idx, step: Integer;
    aBuf: PAnsiChar;
  begin
    Header:= '';
    Payload:= '';
    Signature:= '';
    idx:= 0;
    step:= 0;
    aBuf:= PAnsiChar(aJWT);
    while aBuf[idx] <> '' do begin
       INC(idx);
       if aBuf[idx] = '.' then begin
         INC(step);
         if step=1 then
           SetString(Header, aBuf, idx)
         else
         if step=2 then
           SetString(Payload, aBuf, idx)
         else
           SetString(Signature, aBuf, idx);
         INC(aBuf, idx+1);
         idx:= 0;

       end;
    end;

    if (idx > 0) and (step < 3) then
      SetString(Signature, aBuf, idx);

    JWT:= _Obj([]);
    sigBinary:= Base64UrlDecode(Signature);
    RawByteStringToBytes(Header+'.'+Payload, msgBinary);

    Result:= OpenSslVerify('', '', Pointer(msgBinary), Pointer(aPublicKey), Pointer(sigBinary), Length(msgBinary), Length(aPublicKey), Length(sigBinary));
    if Result then
      JWT:= Js2Var(Base64uriToBin(PAnsiChar(Payload), Length(Payload)));
  end;

begin
  Result:= VerifyWithmORMot(aJWT, JWT);
end;

#47 Re: mORMot 2 » malloc(): unaligned tcache chunk detected » 2024-10-29 20:25:42

I've changed our code to get a stable version of our software. The errors are away.
I know there is no issue in the async/socket part of mORMot. But I don't know what exactly had cause the errors.
My guess is an issue with TSynLocker. Perhaps we haven't use it right or made some mistake in the way of lock/unlock.

#48 Re: mORMot 2 » malloc(): unaligned tcache chunk detected » 2024-10-22 16:44:44

I wrote again because I think it could be useful to stabilize the interfaces/network (mormot.core.interfaces / mormot.core.soa) part of the framework, so it is useful for all users:

My pov is, executing of interfaced methods isn't thread safe in some circumstances. Two parallel (sicSingle) service calls comes and their params will be mixed/override. In my case there are such corrupt bison's in mongodb queries.

@Ab could you please check TInterfaceMethodExecuteCached if there is anything what could go wrong under heaver load? All my wrk tests looks good but the live system has this error behavior and all other processes looks good, also the syslog looks good so far.

I've commented out this part of TInterfaceMethodExecuteCached .Aquire

if fCached.TryLock then
  begin
    // reuse this shared instance between calls
    SetOptions(opt);
    exec := self;
    fCachedWR.CancelAllAsNew;
    WR := fCachedWR;
  end

but its not enough or not the right place.
Are there any other changes in past that comes with https://blog.synopse.info/?post/2022/01 … e-Them-All the that I could test easily?

Perhaps it is not an issue of wrong locking but of not initialization of something reused because of caching?

#49 Re: mORMot 2 » malloc(): unaligned tcache chunk detected » 2024-10-21 08:01:02

Back to the EThreadError the source comes from:

20241021 06575224  . debug  uRestServerDB.TSOneRestServerDB(02eb3298) TServiceFactoryServer.InstanceFree: ignored EThreadError exception during IPersons._Release

So I would love to get further instructions from you.

#50 Re: mORMot 2 » malloc(): unaligned tcache chunk detected » 2024-10-18 15:03:56

Hi ab,

just fyi the error in my service from today and the syslog entries bring me to the nested option for lxc containers and I think I'll give it a try:

https://forum.proxmox.com/threads/lxc-a … -13.36173/

Board footer

Powered by FluxBB