#1 Re: mORMot 1 » Delphi audio signal analysis » 2024-03-26 12:34:31

What? We don't have audio processing in mORMot big_smile
@ab, you started this with your 1.0594631 constant...

#2 Re: mORMot 2 » mormot.core.variants advice on a "memory leak" situation » 2024-03-09 14:17:49

Thanks Arnaud for your valuable response.

I have tried to implement a package using mormot.core.variants and a VCL application using this package dynamically. Everything works as expected without my changes to the mormot.core.variants. Difficult to blame Delphi RTL for a problem in this case given that we are using a custom/proprietary plugin framework. I simply need to put more effort into debugging if this framework does something out of ordinary.

#3 mORMot 2 » mormot.core.variants advice on a "memory leak" situation » 2024-03-08 08:45:44

cadnan
Replies: 2

I am using Delphi 11 and latest mORMot2. When closing an application I have a memory leak pointing to mormot.core.variants. The exception is almost the same as in this topic: Memory leak starting rev. 179, with the exception of TObject.DisposeOf being called last in the call stack.

But, we have a proprietary/custom made plugin framework (host application is loading bpl's at the runtime) and this memory leak is happening only when using this framework inside a bpl loaded by the host and not when using mormot.core.variants directly in the host. Given this situation I did my own analysis and made a fix for which I need your opinion.

Problem seems to be in the SynVariantTypes array and "my fix" was to simply add the DeInitializeUnit at the end of mormot.core.variants:

procedure DeInitializeUnit;
var
  i: integer;
begin
  SynVariantTypesSafe.Lock;
  try
    for i := 0 to length(SynVariantTypes) - 1 do
    begin
      SynVariantTypes[i].Free;
    end;
  finally
    SynVariantTypesSafe.UnLock;
  end;
end;

initialization
  InitializeUnit;

finalization
  DeInitializeUnit;

Is it OK to do it like this? Am I making some huge mistake by doing it like this? Would it harm to have this code in the official release of mORMot2 so I don't have to patch it every time we update the library?

Thanks,
+adnan

#4 Re: mORMot 2 » Creating a server/client with a custom TCP protocol » 2024-01-19 08:24:41

Thanks Arnaud!

Indeed, HTTP is a prime example of a custom TCP protocol big_smile

#5 mORMot 2 » Creating a server/client with a custom TCP protocol » 2024-01-18 09:31:36

cadnan
Replies: 2

I would like to create my own application (instead of the one delivered by a vendor) that communicates with a proprietary system.
They are using a custom/proprietary TCP protocol, but luckily I have a Wireshark dissector for it.

My question is if anyone can give me some hints/tips/starting points in how to achieve this in mORMot2?

My guess is that I will spend a lot of time in mormot.net.sock unit smile but if someone has a public repo or an example of how one defines custom TCP header, message length bytes etc.. it would be really helpful.

Thanks,
+adnan

#6 Re: mORMot 2 » Parsing JWT from keycloak (custom header) » 2024-01-17 10:26:28

I think I found the solution for this.

Once you instantiate a TJwtCrypt class (or similar) you can set Options to [joHeaderParse].
In case I am doing it wrong, please let me know.

Thanks,
+adnan

#7 mORMot 2 » Parsing JWT from keycloak (custom header) » 2024-01-17 10:07:37

cadnan
Replies: 2

I am just giving keycloak as an example of a problem.

Keycloak generates a JWT with the following header, for example:

{
  "alg": "RS256",
  "typ": "JWT",
  "kid": "Ov1FFK-avlBR40w6MHNNdCkR5Rl4QcL-STw7h2H11fc"
}

When parsing token this if line is activated in mormot.crypt.jwt, line 1074:

if (toklen <= headerlen) or
    not CompareMem(pointer(fHeaderB64), tok, headerlen) then
    exit;

I suspect that fHeaderB64 is created with the following "template" in mind:

if fHeader = '' then
  FormatUtf8('{"alg":"%","typ":"JWT"}', [aAlgorithm], fHeader);

Any idea what would be a recommended course of action for me here?

Thanks!

#8 Re: mORMot 2 » Delphi 12 and mORMot 2 » 2023-08-30 09:52:32

Works for both Win32 and Win64.

THandle is defined as following in System.pas

THandle = NativeUInt;

which I guess explains the problem with -1 as an initial value.

#9 mORMot 2 » Delphi 12 and mORMot 2 » 2023-08-30 07:37:10

cadnan
Replies: 3

In case it is of interest to someone:

Software version tested: 2.1.5802 (2023-08-30 09:00:57)

Windows 10 64bit (10.0.19045) [WinAnsi 15.8GB 4A651701]
    4 x Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz 4MB cache (x86)
    on LENOVO 20J4000XMX ThinkPad L470
Using mORMot 2.1.5802
    TSqlite3LibraryStatic 3.42.0 with internal MM
Generated with: Delphi 12 Next 32 bit Win compiler

Time elapsed for all tests: 4m04

Total assertions failed for all test suits:  0 / 77,927,545
! All tests passed successfully.
Software version tested: 2.1.5802 (2023-08-30 09:16:02)

Windows 10 64bit (10.0.19045) [WinAnsi 15.8GB 4A651701]
    4 x Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz 4MB cache (x64)
    on LENOVO 20J4000XMX ThinkPad L470
Using mORMot 2.1.5802
    TSqlite3LibraryStatic 3.42.0 with internal MM
Generated with: Delphi 12 Next 64 bit Win compiler

Time elapsed for all tests: 4m21

Total assertions failed for all test suits:  0 / 77,892,415
! All tests passed successfully.

In order to compile mormot2tests I had to make a minor change in the mormot.net.sock.pas file on lines 4699 and 4721, changing:

Handle := {$ifdef FPC}THandle{$endif}(-1);

to

Handle := {$ifdef FPC}THandle{$endif}(0);

The original code raise the following error:

[dcc64 Error] mormot.net.sock.pas(4699): E1012 Constant expression violates subrange bounds

Not sure if my "fix" is the best one, but "it works"™


Thanks for making mORMOt a "future-proof" framework.

Board footer

Powered by FluxBB