#1 Re: mORMot Framework » TRestBatch does not use Replace sql commands? » 2022-06-28 19:47:42

Thank you a lot @ab
I was thinking that in an array only TRestServerDBObjArray[0] will process the inserts and above [0] will do the read process

#2 Re: mORMot Framework » TRestBatch does not use Replace sql commands? » 2022-06-28 19:44:18

Thank you @ab, no problem for that.

An other question I have is the following:
Lets use a scenario like that in https://synopse.info/forum/viewtopic.php?id=5788
multiple TREstServerDB like in TRestServerDBObjArray = array of TRestServerDB;
each client calls an interface and the interface is getting randomly one TREstServerDB instance to communicate.
if EngineAddUseSelectMaxID=false, each TRestServerDB will have its own fEngineLockedMaxID
when inserting new records using a randomly selected TRestServerDB instance, how the fEngineLockedMaxID is shared between them, without a select max(ID) query?

#3 Re: mORMot Framework » TRestBatch does not use Replace sql commands? » 2022-06-28 19:18:45

Difficult day today
TRestStorageExternal.EngineAdd does not find an ID so it requests a new from EngineLockedNextID
The problem is that in line 970 from mormot.orm.sql, if EngineAddUseSelectMaxID=true, it is always requested from DB, even fEngineLockedMaxID>0 and even if it is a batch of records for the same table

 if (fEngineLockedMaxID = 0) or
     EngineAddUseSelectMaxID then
    RetrieveFromDB;
  inc(fEngineLockedMaxID);

As the previous record was not yet inserted in the database the fEngineLockedMaxID is getting again again the same value

#4 Re: mORMot Framework » TRestBatch does not use Replace sql commands? » 2022-06-28 06:58:17

I am using the following from mormot.orm.core line 4447:

   function Add(Value: TOrm; SendData: boolean; ForceID: boolean = false;
      const CustomFields: TFieldBits = []; DoNotAutoComputeFields: boolean = false): integer;

SendData=true ForceID=false

#5 Re: mORMot Framework » TRestBatch does not use Replace sql commands? » 2022-06-28 05:24:24

it happens using the above code, but with

ba.Add(dr.objs[n],True,false)

I am setting EngineAddUseSelectMaxID  with the following:

((DBsrv.Orm as TRestOrmServer).StaticTable[Tormapiobjs] as TRestStorageExternal).EngineAddUseSelectMaxID:=true;

where DBsrv is a TRestServerDB

#6 Re: mORMot Framework » TRestBatch does not use Replace sql commands? » 2022-06-27 16:31:50

An other bug I noticed using BatchSend is the following:
if EngineAddUseSelectMaxID for a table is enabled then in every record/orm item a select max is issued resulting to the same RowID for all new items in the batch

#8 Re: mORMot Framework » TRestBatch does not use Replace sql commands? » 2022-06-20 20:40:18

It is not solved
mormot.orm.sql, line 1071 Why the BatchOptions argument is empty?

                 SQL := JsonDecodedPrepareToSql(Decode, ExternalFields, Types,
                    Occasion, [], {array=}true);

That will result in line 2129 to have again Batchoptions empty

 result := EncodeAsSqlPrepared(Decoder, fTableName, Occasion,
    fStoredClassMapping^.RowIDFieldName, BatchOptions);

and EncodeInsertPrefix will not add a replace into

Thank a lot for your work

#9 mORMot Framework » TRestBatch does not use Replace sql commands? » 2022-06-20 07:02:37

dcoun
Replies: 15

I am trying to have a TRestBatch to enter 10000 records in a table at server side. Connection is with Zeos 8.0-patches (from GitHub) to Mariadb using Delphi 11.1/win11

ba:=TRestBatch.Createnorest(DBsrvPool.GetDBsrv.Model, Tormapiobjs, 3000, [boInsertOrReplace,boExtendedJson]);
for n:=0 to 10000 do ba.Add(dr.objs[n],True,true);
BatchSend(DBsrvPool.GetDBsrv.Orm);

If a record with the same primary id exists I am getting an error in ZDBcMySql, line 1263:
First chance exception at $7504F192. Exception class EZSQLException with message
'SQL Error: Duplicate entry '24' for key 'PRIMARY'
Code: 1062 SQL: insert into apiobjs (ID,ecode,bcode,galid,cnameonly) values (?,?,?,?,?)'.
Process mormottesting.exe (21148)

I expected a replace instead of insert, Mariadb & mysql support REPLACE.
Should I configure something and I did not?

Thank you in advance

#11 mORMot Framework » Delphi compilation error with last commits » 2022-06-18 09:03:14

dcoun
Replies: 3

[dcc32 Error] mormot.crypt.secure.pas(2093): E2250 There is no overloaded version of 'FormatString' that can be called with these arguments

#12 mORMot Framework » Using compression in THttpRequest derived classes » 2022-06-15 12:04:02

dcoun
Replies: 0

When using the THttpRequestClass that it is returned by MainHttpClass function (both TWinHttp and TCurlHttp can be returned), and especially when using the class functions GET/POST/PUT/DELETE that are derived from THttpRequest , is it possible to enable automatic handling of received from the http server compressed data with deflate+gzip?
if not, is that possible though an example with mormot2's libraries?
Thank you in advance

#13 Re: mORMot Framework » Get a Ilist<> from json » 2022-06-13 15:03:15

Now it works perfectly!!!
Thank you a lot @ab

#14 Re: mORMot Framework » Get a Ilist<> from json » 2022-06-13 10:01:11

The idea is to have a generic function to create and fill a Ilist<Torm>  from a json array, without using generics in the function definition
Reading from mormot2's code, I found that I can create a TIListParent with plist:=Table.NewIList(list);
Reading fast data with plist.Data.LoadFromJson(json); from json that came from a Retrievelistjson does not work. Only ID is set, all published properties from torm objects are not.
Does it need something special in the Json array?
Does plist.data or ilist<Trom> need something more before/after LoadFromJson?

Thank you in advance

#15 Re: mORMot Framework » Get a Ilist<> from json » 2022-06-12 09:33:42

Trying an other Torm class I do not get an access violation, but only the ID is correct, all the other is garbage

Try this orm class

  TOrmApicities=class(Torm)
    private
      Fnam:rawutf8;
      Fnomosid:ptrint;
      Fact:boolean;
    published
      property nam:rawutf8 index 250 read Fnam write Fnam;
      property nomosid:ptrint read Fnomosid write Fnomosid;
      property act:boolean read Fact write Fact;
  end;

With the following json data:

[{"ID":1,"nam":"ΑΘΗΝΑ","nomosid":5,"act":1},{"ID":2,"nam":"ΠΕΡΙΣΤΕΡΙ","nomosid":5,"act":1},{"ID":3,"nam":"ΜΑΡΟΥΣΙ","nomosid":5,"act":1},{"ID":4,"nam":"ΑΙΓΑΛΕΩ","nomosid":5,"act":1},{"ID":5,"nam":"ΑΓΙΑ ΠΑΡΑΣΚΕΥΗ","nomosid":5,"act":1},{"ID":6,"nam":"ΧΑΛΑΝΔΡΙ","nomosid":5,"act":1}]

#16 Re: mORMot Framework » Get a Ilist<> from json » 2022-06-12 09:04:36

Thank you @ab.
I tried first with a local rawutf8 variable but the same happens. Also the same problem happens with the new commit
The problem should be in TRttiJson.ValueLoadJson or somewhere in json parsing.
As I said I am using the result of a Retrievelistjson from an other retrieval that is like the following:

[{"ID":-1,"bcode":269,"galid":0,"cnameonly":"ΓΑΛΗΝΙΚΟ","formcod":""},{"ID":2,"bcode":269,"galid":0,"cnameonly":"ΓΑΛΗΝΙΚΟ","formcod":""}]

Is something missing from TIListParent's processing?

#17 mORMot Framework » Get a Ilist<> from json » 2022-06-11 18:20:58

dcoun
Replies: 6

I am trying to have a general procedure to fill an ilist<> from a json string
The following code seems to fill the ilist<> (it has correct amount of items) but when trying to access the items in the ilist<> I am getting a access violation error and contents are garbage.

procedure GetIList(Table: TOrmClass; var list; const json: Rawjson);
var plist: TIListParent; 
begin IInterface(list):=nil; 
plist:=Table.NewIList(list);
plist.Data.LoadFromJson(Putf8char(json));
end;

The json is produced by a RetrieveListJson from a other call
What am I missing?
Thank you in advance

#18 mORMot Framework » TObjectListPropertyHashed / TObjectListHashed » 2022-06-11 09:16:40

dcoun
Replies: 1

Do TObjectListPropertyHashed / TObjectListHashed exist in Mormot2 ?
How are they renamed?

#19 Re: mORMot Framework » mORMot 2 Release » 2022-06-09 09:47:16

About mobile apps ?
expired JWT automatic re-creation?

#20 Re: mORMot Framework » Threads pool for websocket service » 2022-06-05 12:43:13

Too much in one message and I donot  help....
For the Linux and the TSynThreadPool.QueueLength everything is ok.

run the example with fastmm4 and report leaks enabled in windows with delphi, press button1, many times button4 and then button2. When everything is finished, close the app. it will report all objects in the IOCP as leaked even with the above commit

I will check OnThreadStart/OnThreadTerminate. Thank you a lot @ab

#21 Re: mORMot Framework » Threads pool for websocket service » 2022-06-05 07:57:10

The above commit did not help. The problem is the following in windows:
if I destroy the TSynThreadPool, all items in IOCP are not destroyed. The code in the commit should be in the destroy procedure, or not? Is it needed in the Execute procedure too?

In linux, we do not have the queue of IOCP if more requests are pushed than the available threads. There is a fPendingContext array with a maximum value of 10000 as length and we can use it, if it is created with

ttr:=TmySynThreadPool.Create(4,true);

Am I right?

Also an other question for a perfect use of TSynThreadPool:
I need to initiate a couple of object for use by each thread.
Is it possible to have a derived class in TSynThreadPoolWorkThread to override its create/destroy procedures? 
Or, should I use an external array coupled with TSynThreadPool.WorkThread for each TSynThreadPoolWorkThread object's data?

#22 Re: mORMot Framework » Threads pool for websocket service » 2022-06-04 17:22:52

Do you propose something more in the following example?

https://gist.github.com/dkounal/993c8d5 … fe3c4f81bb

In linux I should create it like the following in order to have a queue for more that the running threads request in Push?

ttr:=TmySynThreadPool.Create(4,true);

Also, I noticed in windows, that if destroyed before finishing all iocp queue, the objects in the iocp queue are not freed. How to overcome this?

#23 Re: mORMot Framework » Threads pool for websocket service » 2022-06-04 16:00:04

I am already using TSynBackgroundTimer.Add and it is working excellent for having a serial list of tasks that they are completed one-by-one

TSynThreadPool is really interesting and can do what I am thinking about parallel processing using a predefined number of threads
Push is to add a procedure to be executed by a thread as I understand
Is there an example that I can play with?
Thank you in advance

#24 mORMot Framework » Threads pool for websocket service » 2022-06-04 08:59:10

dcoun
Replies: 7

When we have a websocket service that needs to use a thread to finish long time work, we can use the TRestThread to create a thread that will do the job as shown in the example restws_longworkserver.
In a production environment, I face two problems:

a) Many many websocket requests that create a TRestThread will slow down the server. A solution is to have a pool of requests to be completed by a limited number of threads and return the output. TsynDictionary is probably a good solution for that. I do not know if you can propose something else.

b) Creating a thread is time consuming, and to have a pool of threads to be used on request is probably a good solution. What do you propose for that?
- Delphi has a working library for that and a couple of other libraries to help with that. What about FPC? I tried for example Quicklib and it does not work with FPC for threads.
- When does it worth to have a thread pool mechanism to deal with time consuming works in a REST server?
- Does mormot2 has already such a threadpool class that could be used?
- Do you already use a multi-environment FPC library for that and which?

Thank you in advance

#25 Re: mORMot Framework » How to start a Linux server in the background ? » 2022-05-29 13:05:19

A systemd service file for mormot2 TsynDaemon that works: start/stop, auto-restart if process stop

[Unit]
Description=My Mormot2 Service
After=network.target mariadb.service
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
RestartSec=1
User=user2run
ExecStart=/usr/local/bin/mymormotserviceexecutable -r
ExecStop=kill -s SIGSTOP $MAINPID

[Install]
WantedBy=multi-user.target

#26 mORMot Framework » Encryption in the client side accessing a server storage » 2022-05-13 08:19:36

dcoun
Replies: 1

Last months I am looking for a solution to use a cloud to store database data encrypted and having the encryption being applied at the client side. In this way,you can have a centralized datastorage (that does not know the real contents of data it stores) whose data are encrypted/decrypted when accessing it from the client that access it.

Reading the documentation for mirroring and have proxies with mormot I was wonder if the following is somehow possible:

Mormot uses SQLITE as mid-end node between and external database to create a backend.
Is it possible for sqlite to encrypt inside the mormot framework the data that will be saved in the database? With pure sqlite and a remote filesytem I believe it is possible. But what about an external database?
My main purpose is to have encrypted data in a cloud server with a mormot backend  in an other place that does the encryption/decryption of data in the database for its clients
Thank you in advance

#27 Re: mORMot Framework » What is the correct way to create API web server and how to start ? » 2022-05-10 09:07:37

1. I believe using ZEOS database connection will allow you to use ADO
2. Take a look in examples from Mormot1 and use Mormot2 to start learning. Read the documentation, search the forum and invest time. Start creating only an interface based API and do not expose the database bindings.
3. It has to do with what you want to do. It is a feature rich framework for API creation.

#28 Re: mORMot Framework » Delphi 11.1 Patch1 + mormot2 » 2022-05-10 08:55:26

?????
No. I am using most of the time remote desktop, but not in a virtual machine mapped drive

#29 Re: mORMot Framework » Delphi 11.1 Patch1 + mormot2 » 2022-05-09 14:31:49

Thank you me too ab
Now it stops in a non user breakcode in line 5075 of mormot.core.log as you can see in the other images and log
And websockets in 2.3 do not pass

Check the gist for new images

#31 Re: mORMot Framework » Delphi 11.1 Patch1 + mormot2 » 2022-05-09 14:00:51

With today's mormot2 32bit is running OK from inside/outside of Delphi 11.1 patch 1 IDE in a computer with win11
Compiled for 64Bit it runs ok outside IDE, but inside's ide I am getting all I sent to you by message in a gist
There are differences in errors in 64bit between Release/Debug config when running from inside IDE

#32 Re: mORMot Framework » Delphi 11.1 Patch1 + mormot2 » 2022-05-09 09:39:21

ab wrote:

This may be the culprit.
What is your decimal separator?

comma instead of point
Point is used to divide thousands

#33 Re: mORMot Framework » Delphi 11.1 Patch1 + mormot2 » 2022-05-09 09:34:22

ab wrote:

What is the Windows system code page: 1252 ?

737 or 1253

#34 Re: mORMot Framework » what happened to ab? » 2022-05-06 20:09:12

Everyday this week, I was thinking what could have happened to ab

The following is really good news.

#35 Re: mORMot Framework » Delphi 11.1 Patch1 + mormot2 » 2022-04-30 20:39:49

In delphi 11.1 patch 1 win64 only the following is still happening:

 1.2. Core process:
  - RTTI: 1,345 assertions passed  794us
  - Url encoding: 300 assertions passed  1.57ms
! Core process - Encode decode JSON
! Exception EInvalidOp raised with messsage:
!  Invalid floating point operation
  - JSON benchmark: no assertion  746us
  - Wiki markdown to html: 56 assertions passed  737us
  - Variants: 124 assertions passed  546us
  - Mustache renderer: 166 assertions passed  1.85s
  - TDocVariant: 90,791 assertions passed  43.43ms
  - TDecimal128: 17,446 assertions passed  2.12ms
  - BSON: 245,070 assertions passed  3.65ms
     100000 TBsonObjectID.ComputeNew in 2.36ms i.e. 40.2M/s, aver. 23ns
  - TSelectStatement: 229 assertions passed  839us
  - TSynMonitorUsage: 1,202 assertions passed  204us
  Total failed: 0 / 491,391  - Core process PASSED  1.95s

In the log only the following entries, expected exception also

0000000000000000  ! EXCOS EInvalidOp (c0000090) [Main] at 1db400 @Trunc 
0000000003F275C7  ! EXC   Exception {Message:"expected exception"} [Main] at 57928e mormot.core.interfaces.pas TInterfaceStub.Invoke (6241) 

As shown also before:

dcoun wrote:

The following sometimes happens, sometimes does not, in 64bit both in release/debug mode

! Core process - Encode decode JSON
! Exception EInvalidOp raised with messsage:
!  Invalid floating point operation

In 64 bit release mode running from inside IDE:
a) it shows a Float_invalid_operation on line 4460 of mormot.core.buffers in the above error of core process

In 32bit everything is OK in delphi 11.1 patch 1

Thanks a lot @ab

#36 Re: mORMot Framework » Delphi 11.1 Patch1 + mormot2 » 2022-04-30 06:41:39

OK that really help.
So 32bit works with Delphi 11.1 patch 1 without any problem
64Bit does not. But that happens to Delphi 11 too.

#37 Re: mORMot Framework » Delphi 11.1 Patch1 + mormot2 » 2022-04-29 07:40:14

Even in my previous machine running Delphi 11 I got this error that I do not  remember to exist in the past

In the log it is only:

0000000000000002  ! EXC   Exception {Message:"expected exception"} [Main] at 68d0e4  

and in the screen after running:

 3.2. Service oriented architecture:
  - Weak interfaces: 56 assertions passed  549us
  - Service initialization: 268 assertions passed  4.64ms
  - Direct call: 1,389,825 assertions passed  31.82ms
  - Server side: 1,389,845 assertions passed  36.40ms
  - Client side REST: 1,853,127 assertions passed  888.98ms
  - Client side REST as json object: 1,853,121 assertions passed  930.17ms
  - Client side REST sessions stats: 1,853,121 assertions passed  1.02s
  - Client side REST locked: 1,853,125 assertions passed  862.39ms
  - Client side REST main thread: 1,853,125 assertions passed  5.60s
  - Client side REST background thread: 1,853,125 assertions passed  5.43s
  - Client side REST sign with crc 32c: 1,853,121 assertions passed  831.84ms
  - Client side REST sign with xxhash: 1,853,121 assertions passed  884.18ms
  - Client side REST sign with md 5: 1,853,121 assertions passed  883.73ms
  - Client side REST sign with sha 256: 1,853,121 assertions passed  923.63ms
  - Client side REST sign with sha 512: 1,853,121 assertions passed  1.06s
  - Client side REST weak authentication: 1,853,121 assertions passed  794.42ms
  - Client side REST basic authentication: 1,853,121 assertions passed  1.04s
  - Client side REST custom record layout: 1,853,121 assertions passed  880.32ms
  - Client side REST service log to DB: 1,853,121 assertions passed  3.25s
  - Client side json RPC: 1,853,121 assertions passed  1.10s
  - Test over HTTP: 18,274 assertions passed  1.60s
  - Security: 139 assertions passed  3.69ms
! Service oriented architecture - Mocks and stubs
! Exception Exception raised with messsage:
!  expected exception
  Total failed: 0 / 32,478,392  - Service oriented architecture PASSED  28.18s

all tests passed but I have an error?
I am not sure if it helps, Eurekalog does not provide an error report. I am not sure if mormot2tests takes care of all exceptions before.

#38 Re: mORMot Framework » Delphi 11.1 Patch1 + mormot2 » 2022-04-28 21:32:34

Reverted Mormot2 back to Jan 23 with static SQLITE 3.37.2
In 32 bit from inside IDE it gives errors in websockets in 2.8 Multithread process
In 32bit running outside the IDE it gives error in SOA 3.2

  - Client side json RPC: 1,853,121 assertions passed  639.36ms
  - Test over HTTP: 18,274 assertions passed  3.87s
  - Security: 139 assertions passed  1.80ms
! Service oriented architecture - Mocks and stubs
! Exception Exception raised with messsage:
!  expected exception
  Total failed: 0 / 32,478,392  - Service oriented architecture PASSED  19.52s

#39 Re: mORMot Framework » Delphi 11.1 Patch1 + mormot2 » 2022-04-28 20:48:32

The following sometimes happens, sometimes does not, in 64bit both in release/debug mode

! Core process - Encode decode JSON
! Exception EInvalidOp raised with messsage:
!  Invalid floating point operation

In 64 bit release mode running from inside IDE:
a) it shows a Float_invalid_operation on line 4460 of mormot.core.buffers in the above error of core process
b) After the above, it stops many times with non-user breakpoint at line 3783 of mormot.core.json and sets RED the websockets
c) The above continues for ever in SOA 3.1. Core script

#40 Re: mORMot Framework » Delphi 11.1 Patch1 + mormot2 » 2022-04-28 20:29:28

re-testing with more options
Delphi 11.1 patch 1
32Bit running tests inside IDE's debugging no problem, But when running it in debug mode without IDE's debugging the exception exists

64bit Running from IDE's debugging I am getting an exception Float_invalid_Operation in line 3023 of mormot.core.datetime when running the 3rd test in 1.2 Core process

 - Url encoding: 300 assertions passed  453us
! Core process - Encode decode JSON
! Exception EInvalidOp raised with messsage:
!  Invalid floating point operation

it stops again and again "Non-user breakpoint" in line 5075 of mormot.core.log In websockets in 2.8. Multi thread process
then an exception in access_violation in line 6000 of mormot.core.os
  - Websockets: 55 / 8,104 FAILED  5m12
     1=2611/s  2=1423/s  5=619/s  10=319/s  30=97/s  50=4/s
I stopped there

When running outside the IDE in 64bit again the
the executable closes when starting SOA

#41 Re: mORMot Framework » Delphi 11.1 Patch1 + mormot2 » 2022-04-28 18:13:56

hmmm the same happens with Delphi 11, It is not the new patch nor the Delphi 11.1
It's the bleeding edge mormot2.
A month ago, I remember both to pass at least the compiled tests for 32bit

#42 mORMot Framework » Delphi 11.1 Patch1 + mormot2 » 2022-04-28 18:03:08

dcoun
Replies: 23

I though it is good idea to run the test with the last version of Delphi 11.1 after yesterday's official patch 1
Last commit of Mormot2 from github:
32bit compile
...
!  - Mime types: 22 / 582 FAILED  44.29ms
....
! Service oriented architecture - Mocks and stubs
! Exception Exception raised with messsage:
!  expected exception

Log:

0000000000000001  ! fail  #81 1651167975<>1651167975755 FileAgeToUnixTimeUtc 
0000000000000B25  ! fail  #88 1651167975<>1651167975761 FileAgeToUnixTimeUtc 
0000000000002765  ! fail  #95 1651167975<>1651167975763 FileAgeToUnixTimeUtc 
0000000000003719  ! fail  #102 1651167975<>1651167975771 FileAgeToUnixTimeUtc 
0000000000003B4F  ! fail  #109 1651167975<>1651167975775 FileAgeToUnixTimeUtc 
000000000000485B  ! fail  #116 1651167975<>1651167975776 FileAgeToUnixTimeUtc 
0000000000004BEF  ! fail  #123 1651167975<>1651167975779 FileAgeToUnixTimeUtc 
0000000000004FCC  ! fail  #130 1651167975<>1651167975780 FileAgeToUnixTimeUtc 
000000000000584E  ! fail  #137 1651167975<>1651167975781 FileAgeToUnixTimeUtc 
00000000000063A2  ! fail  #144 1651167975<>1651167975783 FileAgeToUnixTimeUtc 
00000000000067BC  ! fail  #151 1651167975<>1651167975786 FileAgeToUnixTimeUtc 
00000000000071F9  ! fail  #348 1651167975<>1651167975788 FileAgeToUnixTimeUtc 
000000000000787D  ! fail  #355 1651167975<>1651167975790 FileAgeToUnixTimeUtc 
0000000000007BE3  ! fail  #362 1651167975<>1651167975791 FileAgeToUnixTimeUtc 
0000000000007E8A  ! fail  #369 1651167975<>1651167975792 FileAgeToUnixTimeUtc 
0000000000008162  ! fail  #376 1651167975<>1651167975793 FileAgeToUnixTimeUtc 
000000000000841B  ! fail  #383 1651167975<>1651167975793 FileAgeToUnixTimeUtc 
00000000000086F4  ! fail  #390 1651167975<>1651167975794 FileAgeToUnixTimeUtc 
00000000000089D6  ! fail  #397 1651167975<>1651167975795 FileAgeToUnixTimeUtc 
0000000000008CAC  ! fail  #404 1651167975<>1651167975796 FileAgeToUnixTimeUtc 
0000000000008F54  ! fail  #411 1651167975<>1651167975796 FileAgeToUnixTimeUtc 
00000000000091CE  ! fail  #418 1651167975<>1651167975797 FileAgeToUnixTimeUtc 
0000000003CB79E4  ! EXC   Exception {Message:"expected exception"} [Main] at b2de64  

64Bit
same mime errors

When starting SOA tests the window closes and the log is very big: https://gist.github.com/dkounal/1423de3 … f5db3ec3ca

#43 Re: mORMot Framework » mormot 2 on Linux-aarch64 » 2022-04-22 12:17:57

It is fixed now @ab, thank you a lot

#44 mORMot Framework » mormot 2 on Linux-aarch64 » 2022-04-22 11:46:10

dcoun
Replies: 2

I installed today the Ubuntu 22.4 LTS on a raspeberry Pi 4 4GB and cross compiler FPC 3.2.0 for aarch64-linux in my windows machine
Trying to compile an already tested project in Linux-aarch64 I am getting the following errors during linking:

Debug: C:\fpcupdeluxe\fpcupdeluxe\cross\bin\aarch64-linux\aarch64-linux-gnu-ld.exe: C:\Delphi\G\mORMot2\src\crypt\..\..\static\aarch64-linux\armv8.o: in function `crc32arm64':
Debug: armv8.c:(.text+0x0): multiple definition of `crc32arm64'; C:\Delphi\G\mORMot2\src\core\..\..\static\aarch64-linux\armv8.o:armv8.c:(.text+0x0): first defined here
Debug: C:\fpcupdeluxe\fpcupdeluxe\cross\bin\aarch64-linux\aarch64-linux-gnu-ld.exe: C:\Delphi\G\mORMot2\src\crypt\..\..\static\aarch64-linux\armv8.o: in function `crc32carm64':
Debug: armv8.c:(.text+0xe8): multiple definition of `crc32carm64'; C:\Delphi\G\mORMot2\src\core\..\..\static\aarch64-linux\armv8.o:armv8.c:(.text+0xe8): first defined here
Debug: C:\fpcupdeluxe\fpcupdeluxe\cross\bin\aarch64-linux\aarch64-linux-gnu-ld.exe: C:\Delphi\G\mORMot2\src\crypt\..\..\static\aarch64-linux\armv8.o: in function `crc32cby4arm64':
Debug: armv8.c:(.text+0x1d0): multiple definition of `crc32cby4arm64'; C:\Delphi\G\mORMot2\src\core\..\..\static\aarch64-linux\armv8.o:armv8.c:(.text+0x1d0): first defined here
Debug: C:\fpcupdeluxe\fpcupdeluxe\cross\bin\aarch64-linux\aarch64-linux-gnu-ld.exe: C:\Delphi\G\mORMot2\src\crypt\..\..\static\aarch64-linux\armv8.o: in function `crc32blockarm64':
Debug: armv8.c:(.text+0x1d8): multiple definition of `crc32blockarm64'; C:\Delphi\G\mORMot2\src\core\..\..\static\aarch64-linux\armv8.o:armv8.c:(.text+0x1d8): first defined here
Debug: C:\fpcupdeluxe\fpcupdeluxe\cross\bin\aarch64-linux\aarch64-linux-gnu-ld.exe: C:\Delphi\G\mORMot2\src\crypt\..\..\static\aarch64-linux\armv8.o: in function `crc32blocksarm64':
Debug: armv8.c:(.text+0x218): multiple definition of `crc32blocksarm64'; C:\Delphi\G\mORMot2\src\core\..\..\static\aarch64-linux\armv8.o:armv8.c:(.text+0x218): first defined here
Debug: C:\fpcupdeluxe\fpcupdeluxe\cross\bin\aarch64-linux\aarch64-linux-gnu-ld.exe: C:\Delphi\G\mORMot2\src\crypt\..\..\static\aarch64-linux\armv8.o: in function `aesencryptarm128':
Debug: armv8.c:(.text+0x278): multiple definition of `aesencryptarm128'; C:\Delphi\G\mORMot2\src\core\..\..\static\aarch64-linux\armv8.o:armv8.c:(.text+0x278): first defined here
Debug: C:\fpcupdeluxe\fpcupdeluxe\cross\bin\aarch64-linux\aarch64-linux-gnu-ld.exe: C:\Delphi\G\mORMot2\src\crypt\..\..\static\aarch64-linux\armv8.o: in function `aesencryptarm192':
Debug: armv8.c:(.text+0x2f0): multiple definition of `aesencryptarm192'; C:\Delphi\G\mORMot2\src\core\..\..\static\aarch64-linux\armv8.o:armv8.c:(.text+0x2f0): first defined here
Debug: C:\fpcupdeluxe\fpcupdeluxe\cross\bin\aarch64-linux\aarch64-linux-gnu-ld.exe: C:\Delphi\G\mORMot2\src\crypt\..\..\static\aarch64-linux\armv8.o: in function `aesencryptarm256':
Debug: armv8.c:(.text+0x378): multiple definition of `aesencryptarm256'; C:\Delphi\G\mORMot2\src\core\..\..\static\aarch64-linux\armv8.o:armv8.c:(.text+0x378): first defined here
Debug: C:\fpcupdeluxe\fpcupdeluxe\cross\bin\aarch64-linux\aarch64-linux-gnu-ld.exe: C:\Delphi\G\mORMot2\src\crypt\..\..\static\aarch64-linux\armv8.o: in function `MakeDecrKeyArm':
Debug: armv8.c:(.text+0x418): multiple definition of `MakeDecrKeyArm'; C:\Delphi\G\mORMot2\src\core\..\..\static\aarch64-linux\armv8.o:armv8.c:(.text+0x418): first defined here
Debug: C:\fpcupdeluxe\fpcupdeluxe\cross\bin\aarch64-linux\aarch64-linux-gnu-ld.exe: C:\Delphi\G\mORMot2\src\crypt\..\..\static\aarch64-linux\armv8.o: in function `aesdecryptarm128':
Debug: armv8.c:(.text+0x440): multiple definition of `aesdecryptarm128'; C:\Delphi\G\mORMot2\src\core\..\..\static\aarch64-linux\armv8.o:armv8.c:(.text+0x440): first defined here
Debug: C:\fpcupdeluxe\fpcupdeluxe\cross\bin\aarch64-linux\aarch64-linux-gnu-ld.exe: C:\Delphi\G\mORMot2\src\crypt\..\..\static\aarch64-linux\armv8.o: in function `aesdecryptarm192':
Debug: armv8.c:(.text+0x4b8): multiple definition of `aesdecryptarm192'; C:\Delphi\G\mORMot2\src\core\..\..\static\aarch64-linux\armv8.o:armv8.c:(.text+0x4b8): first defined here
Debug: C:\fpcupdeluxe\fpcupdeluxe\cross\bin\aarch64-linux\aarch64-linux-gnu-ld.exe: C:\Delphi\G\mORMot2\src\crypt\..\..\static\aarch64-linux\armv8.o: in function `aesdecryptarm256':
Debug: armv8.c:(.text+0x540): multiple definition of `aesdecryptarm256'; C:\Delphi\G\mORMot2\src\core\..\..\static\aarch64-linux\armv8.o:armv8.c:(.text+0x540): first defined here
Debug: C:\fpcupdeluxe\fpcupdeluxe\cross\bin\aarch64-linux\aarch64-linux-gnu-ld.exe: C:\Delphi\G\mORMot2\src\crypt\..\..\static\aarch64-linux\armv8.o: in function `gf_mul_h_arm':
Debug: armv8.c:(.text+0x5e0): multiple definition of `gf_mul_h_arm'; C:\Delphi\G\mORMot2\src\core\..\..\static\aarch64-linux\armv8.o:armv8.c:(.text+0x5e0): first defined here

Something stupid I probably done again but I am not sure

Project's options path is set as the following:

c:\Delphi\G\mORMot2\static\$(TargetCPU)-$(TargetOS)

#45 Re: mORMot Framework » M2: different results Delphi/FPC, using RecordLoadJson » 2022-04-19 13:08:33

Thanks a lot. I though it was changed in last versions of FPC.

#47 mORMot Framework » M2: different results Delphi/FPC, using RecordLoadJson » 2022-04-19 11:41:21

dcoun
Replies: 3

Console application with Mormot2 connecting to the same Mysql server using RetrieveIList inside an REST Interface call

The code is the following:

 var     upedia:ilist<TOrmUFpedia>; upedio:TOrmUFpedia;
....
srv.Orm.RetrieveIList(TOrmUFpedia,upedia,'RowID,title,descr,opts');
for upedio in upedia do ..... 

TOrmUFpedia is declared as follows:

  TOrmUFpedia = class(TOrm)
    private
      Ftitle, Fdescr, Fopts: utf8string;
      function Getopts: utf8string;
      procedure Setopts(const Value: utf8string);
    public
      cOpts:Dufoptions;
    published
      property title:utf8string index 500 read Ftitle write Ftitle;
      property descr:utf8string index 500 read Fdescr write Fdescr;
      property opts:utf8string read Getopts write Setopts;
  end;

function TOrmUFpedia.Getopts: utf8string;
begin result:=RecordSaveJson(cOpts,typeinfo(Dufoptions)); end;

procedure TOrmUFpedia.Setopts(const Value: utf8string);
begin if (Value='') or (not RecordLoadJson(cOpts,value,typeinfo(Dufoptions))) then cOpts:=Default(Dufoptions); end; 

where Dufoptions is a record

The code using the above is compiled by both Delphi 11.1 and FPC 3.2.0-r47409 [2022/04/01] for i386, all units are used the same, only project file is different
Compiled executable (32 & 64bit for FPC, 32bit for Delphi 11.1) runs using the same database Mysql 10.6.7

When I access the upedio.opts in for each loop as returned by RetrieveIList ...:
a) In Delphi 11.1,  upedio.opts is returned OK
b) In FPC 3.2 I am getting a "￰DA4AAA==" as content

Does  RecordLoadJson needs records like Dufoptions to be registered somehow in FPC ?

#48 Re: mORMot Framework » mORMot2 on ARM » 2022-04-19 05:40:22

Ubuntu 22 LTS is optimized for Raspberry 4 too, getting out this week

#50 Re: mORMot Framework » Getting error accessing interfece from android using sicPerThread » 2022-04-18 08:33:52

I think the problem is that in

function CallGetResult(const aCall: TSQLRestURIParams; var outID: integer): variant;

outid is integer and the number it is returning is int64 causing overflow

{
    "result": [
        "{\"var1\":\"\",\"var2\":\"\"}"
    ],
    "id": 140173798573824
}

Is the id above a 32bit integer?

Board footer

Powered by FluxBB