#1 mORMot 1 » mORMot 2 commit build number reset to 2.0.1 » 2022-04-15 12:38:55

PBa
Replies: 6

Dear ab,

with commit 5d53eb7c91ee894dc6a3faf3ce4b425a18e0d238 dated April 14th the build number of mormot.commit.inc has been reset from 2.0.200 to 2.0.1 instead of 2.0.201.

Has this been done intentionally?

Best regards and have a good Easter weekend!

Paul

#2 mORMot 1 » Typing errors in TTestCoreCrypto.Catalog » 2022-01-05 16:47:10

PBa
Replies: 1

Dear ab,

IMHO there are two typing errors in TTestCoreCrypto.Catalog:

1) line 2175: c2.GetSerial instead of c1.GetSerial

    Check(c1.IsEqual(c2));
    CheckEqual(c1.GetSerial, c1.GetSerial);   //  <== should be replaced by: CheckEqual(c2.GetSerial, c1.GetSerial);
    CheckEqual(c2.GetSubject, c1.GetSubject);

1) line 2220: c2.Instance.ClassType instead of c3.Instance.ClassType

    c2 := st1.CertAlgo.New;
    Check(c3.Instance.ClassType = c1.Instance.ClassType);  //  <== should be replaced by: Check(c2.Instance.ClassType = c1.Instance.ClassType);
    c2.Generate([cuCA], '', c1);

Thank you!
Best regards and all the best for 2022!
Paul

#3 Re: mORMot 1 » Revision 2.x of the framework » 2021-01-18 19:22:36

PBa
PBa wrote:

@ab:
in mORMot2 survey you also asked how to continue with source code management and there were many answers to also keep fossil as scm (at least in parallel to github). Just for curiosity: do you intend to set up also a fossil repository for mORMot2 in future?
Thanks a lot and have a nice evening!
Paul

#4 Re: mORMot 1 » Revision 2.x of the framework » 2021-01-10 11:44:19

PBa

@ab:
in mORMot2 survey you also asked how to continue with source code management and there were many answers to also keep fossil as scm (at least in parallel to github). Just for curiosity: do you intend to set up also a fossil repository for mORMot2 in future?
Thanks a lot and have a nice weekend!
Paul

#5 mORMot 1 » mORMot2: bug in TRestServer.SessionDeleteDeprecated? » 2020-12-30 18:54:17

PBa
Replies: 1

@ab:
SessionDeleteDeprecated returns the system tix count number in second resolution.
But why is this result increased every time when a deprecated session is found and deleted within the loop below?
IMHO „inc(result)“ should be deleted as this line will change the deletion condition for each next session item in fSessions.List.
Or am I missing something?

Thanks a lot!
Paul

function TRestServer.SessionDeleteDeprecated: cardinal;
...
begin // caller made fSessions.Safe.Lock
  result := GetTickCount64 shr 10;
  if (self <> nil) and
    ...
    fSessionsDeprecatedTix := result;
    for i := fSessions.Count - 1 downto 0 do
      if result > TAuthSession(fSessions.List[i]).TimeOutTix then
      begin
        SessionDelete(i, nil);
        inc(result); // <== why increasing result within this loop?
      end;
  end;
end;

#6 mORMot 1 » Bug in newly added function ObjArrayAppend (SynCommons V 1.18.4686) » 2018-07-25 19:12:33

PBa
Replies: 1

Dear ab,

IMHO there is a bug in the newly intoduced function

function ObjArrayAppend(var aDestObjArray, aSourceObjArray): integer;
var n: integer;
    s: TObjectDynArray absolute aSourceObjArray;
    d: TObjectDynArray absolute aDestObjArray;
begin
  result := length(d);
  n := length(s);
  SetLength(d,result+n);
  MoveFast(s[0],d[result],n*SizeOf(pointer));
  //d := nil; // d[] will be owned by s[]
  s := nil; // s[] will be owned by d[]    <== change suggested by PBa
  inc(result,n);
end;

as described in line 6779:
// - aSourceObjArray[] items will be owned by aDestObjArray[], therefore
// aSourceObjArray is set to nil

Thanks a lot!
Best regards,
Paul

#7 mORMot 1 » Bug in newly added function "RenameInCSV" (SynCommons.pas) » 2018-01-05 13:32:54

PBa
Replies: 1

Dear AB,

it seems that there is a bug in your recently added function "RenameInCSV": it does not rename the first item in the CSV list.
Short test code to reproduce this issue:

program TestRenameInCSV;
{$APPTYPE CONSOLE}
{$I Synopse.inc} // define HASINLINE USETYPEINFO CPU32 CPU64 OWNNORMTOUPPER
uses
  SysUtils, SynCommons;
var
  csv: RawUTF8;
begin
  csv := 'old1,old2,old3';
  writeln(csv,' 1 ',RenameInCSV('old1','new1',csv),' ',csv);
  writeln(csv,' 2 ',RenameInCSV('old2','new2',csv),' ',csv);
  writeln(csv,' 3 ',RenameInCSV('old3','new3',csv),' ',csv);
  writeln(csv,' 3 ',RenameInCSV('old3','new3',csv),' ',csv);
  writeln(csv,' 4 ',RenameInCSV('old4','new4',csv),' ',csv);
  csv := '';
  readln;
end.

The result is:

old1,old2,old3 1 FALSE old1,old2,old3
old1,old2,old3 2 TRUE old1,new2,old3
old1,new2,old3 3 TRUE old1,new2,new3
old1,new2,new3 3 FALSE old1,new2,new3
old1,new2,new3 4 FALSE old1,new2,new3

As you can see, the first item "old1" is not renamed as expected.

Edit: And if the csv list contains the same value more than once, only the first found value will be renamed.

Paul

#8 mORMot 1 » TestSQL3.exe needs more than 10 minutes to finish » 2017-12-14 11:43:00

PBa
Replies: 1

What is an average time for TestSQL3.exe to finish all tests?
I know that this will depend on several aspects like hardware used ...

Currently I have to wait more than 10 minutes until the execution of TestSQL3.exe is finished. Particularly 2.7 Test over HTTP needs 514 seconds and 2.12 Multi threaded clients test need 43 seconds to finish (see protocol for Delphi 7 below, the same is true for Delphi 10.1 Berlin and Delphi 10.2 Tokyo).
Is this a reasonable time to execute? If no what could be the problem?

Thank you very much!
Paul

2.7. Service oriented architecture:
  - Weak interfaces: 56 assertions passed  37us
  - ...
  - Client side JSONRPC: 794,733 assertions passed  883.06ms
  - Test over HTTP: 10,477 assertions passed  514.97s
  - Security: 139 assertions passed  1.63ms
  - Mocks and stubs: 30,032 assertions passed  40.95ms
  Total failed: 0 / 13,948,805  - Service oriented architecture PASSED  531.63s

2.12. DDD multi thread:
  - Delete old database: 1 assertion passed  83us
  - Start server: 1 assertion passed  46.63ms
  - Single client test: 1,002 assertions passed  9.45s
  - Multi threaded clients test: 21 assertions passed  43.19s
  Total failed: 0 / 1,025  - DDD multi thread PASSED  52.69s

Using mORMot 1.18.4080 ERTL FTS3
Running on Windows 7 64bit SP1 (6.1.7601) with code page 1252
TSQLite3LibraryStatic 3.21.0 with internal MM
Generated with: Delphi 7 compiler

Time elapsed for all tests: 670.85s
Performed 2017-12-14 12:13:56 by Paul on PC

Total assertions failed for all test suits:  0 / 33,251,531
! All tests passed successfully.

---------------

Using mORMot 1.18.4080 FTS3
Running on Windows 7 64bit SP1 (6.1.7601) with code page 1252
TSQLite3LibraryStatic 3.21.0 with internal MM
Generated with: Delphi 10.2 Tokyo compiler

Time elapsed for all tests: 818.34s
Performed 2017-12-14 11:53:06 by Paul on PC

#9 Re: mORMot 1 » Bug in TSynBackgroundTimer.WaitUntilNotProcessing » 2017-04-30 22:38:54

PBa

I just saw that you've already changed this code in commit {3639} to

  while Processing and (GetTickcount64>timeout) do 

But shouldn't it be

  while Processing and (GetTickcount64<timeout) do 

to work as expected?

Paul

#10 mORMot 1 » Bug in TSynBackgroundTimer.WaitUntilNotProcessing » 2017-04-30 22:10:58

PBa
Replies: 2

Dear ab,

IMHO there is a bug in this newly introduced function (line 62827 in SynCommons.pas in commit {3638})

procedure TSynBackgroundTimer.WaitUntilNotProcessing(timeoutsecs: integer);
var timeout: Int64;
begin
  timeout := GetTickCount64+timeoutsecs*1000;
  while not Processing and (GetTickcount64<timeout) do
    SleepHiRes(1);
end;

This function is intended to wait until no background task is processed, but currently it waits until a background task is processed.
IMHO "not" should be deleted within the while loop.

  while Processing and (GetTickcount64<timeout) do 

Best regards,
Paul

#11 Re: mORMot 1 » TestSQL3.exe JSON Encode Decode fails when decimal separator is "," » 2017-02-04 09:01:24

PBa

ab,
I've tested it with Delphi 7 and Delphi 10.1 Berlin compiler:
All tests passed successfully for both compilers, also when using German number format.

Thank you for fixing!

Paul

#12 Re: mORMot 1 » TestSQL3.exe JSON Encode Decode fails when decimal separator is "," » 2017-02-03 06:44:58

PBa

Dear ab,

yesterday you've fixed some [dvoAllowDoubleValue] issues in https://synopse.info/fossil/info/68271abc8213256f.
I've tested this commit but it does not solve my issue above, as in SynSelftests.pas you check JSON Encoding/Decoding of a double value without using [dvoAllowDoubleValue] which results in failing (at least if you use a German number format).
Please fix it, too (I've suggested some code in my posting of 21 Jan in this topic).

Thank you very much!
Paul

#13 Re: mORMot 1 » TestSQL3.exe JSON Encode Decode fails when decimal separator is "," » 2017-02-01 20:00:33

PBa

Dear ab,
this seems to be the same issue as your answer in https://synopse.info/forum/viewtopic.ph … 219#p23219

Could you please also add [dvoAllowDoubleValue] to the test case in SynSelfTests.pas as described above.

Thank you!
Paul

#14 Re: mORMot 1 » Bug with parsing JSON array of double in TDocVariantData » 2017-02-01 19:55:59

PBa

IMHO the reason for this issue is the same as for the issue described in https://synopse.info/forum/viewtopic.php?id=3739 and was most probably introduced with {3129} [aa35ac110a].

If the TDocVariantOptions does not include [dvoAllowDoubleValue], then JSON encoding/decoding will return any double value with more than 4 digits behind the decimal separator as a string value instead of a double value.

My idea was to include [dvoAllowDoubleValue] in your line

VDoc.InitJSON(VJSON_In[I],[dvoValueCopiedByReference]);

like

VDoc.InitJSON(VJSON_In[I],[dvoValueCopiedByReference, dvoAllowDoubleValue]);

but unfortunately this does not work as expected. It seems that VDoc.InitJSON does not consider an included [dvoAllowDoubleValue] option in opposite to e.g. VariantLoadJSON.

Unfortunately I didn't succeed to find out how to circumvent this issue when using VDoc.InitJSON as in your example. Perhaps somebody else in the forum may help.

Paul

#15 Re: mORMot 1 » TestSQL3.exe JSON Encode Decode fails when decimal separator is "," » 2017-01-29 18:39:21

PBa
ab wrote:

This is how variant conversion do work, I'm afraid.
We use internally only JSON number representation, with '.' as decimal separator.
Writing "Va = 0,0123456789" does not make sense, since Va contains a double value, and is displayed with a decimal separator by the IDE debugger.

Dear ab,
I'm with you that Va may be displayed with a decimal separator by your IDE debugger: I assume that your Windows system is set to a language which uses an English number format using '.' as a decimal separator. Then TestSQL3.exe JSON Encode Decode test suite does succeed.

ab wrote:

Always use explicit conversions to/from variant, to avoid such issues.

Sorry, this sentence I do not understand - I'm not talking about my own coding but about mORMot Testsuite "TestSQL3.exe" which - in my opinion exhibits a regression when using a Windows system where the system language is set to e.g. German which uses the German number format (which uses ',' as system decimal separator by default).

I've done a further review and made some screenshots to allow reproducing this issue: https://dl.dropboxusercontent.com/u/691 … eIssue.pdf

If you compile the latest Mormot self test suite 1.18.3360, set a breakpoint in line 6209 of SynSelfTests.pas

Checksame(Va,r);

and start TestSQL3.exe within your IDE you will see that Va does NOT contain the expected DOUBLE value but a STRING value. VarType(Va) returns 256 which correlates to a STRING content. Despite the fact that Va contains a STRING instead of the expected DOUBLE value and r is a DOUBLE value, Checksame(Va,r) does succeed if your Windows system is set to an English number format.
In case your Windows system is set to German number format, Checksame(Va,r) does fail.

After adding the suggested lines of code (as suggested in my post dated 2017-01-21 20:00:18) Va now does contain the expected DOUBLE value (and VarType(Va) would return 5 instead of 256).

With these changes TestSQL3.exe does succeed in any case independently of the number format settings of your Windows system.

Please check if you can reproduce and fix this issue in SynSelfTests.pas.
Thank you very much! And sorry for my English.
Paul

#16 Re: mORMot 1 » TestSQL3.exe JSON Encode Decode fails when decimal separator is "," » 2017-01-21 20:35:00

PBa

Dear ab,
Perhaps I have described my finding in a misunderstanding manner, sorry.
I'm with you that you use internally only JSON number representation with '.' as decimal separator.
But in current implementation {3343} the line

P := VariantLoadJSON(Va,P);

doesn't return Va as a double but as a string value (displayed by the IDE debugger as '0.012345') as internally the variable TryCustomVariants of function VariantLoadJSON is set to nil.
Thus

CheckSame(Va,r);

reads as
a) in case of system decimal separator is set to '.': Checksame('0.012345', 0.012345); which succeeds
b) in case of system decimal separator is set to ',': Checksame('0.012345', 0,012345); which fails
as Checksame compares a string with a double value.

After adding the suggested changes in my previous post

P := VariantLoadJSON(Va,P,nil,@VaAllowDblVal);

sets the internal variable TryCustomVariants to [dvoAllowDoubleValue] and therefore this line returns Va as a double value (displayed by the IDE debugger as 0.012345 (in case of system decimal separator is set to '.') and as 0,012345 (in case of system decimal separator is set to ',')
Thus

CheckSame(Va,r);

reads now as
a) in case of system decimal separator is set to '.': Checksame(0.012345, 0.012345); which succeeds
b) in case of system decimal separator is set to ',': Checksame(0,012345, 0,012345); which succeeds, too.
as Checksame now compares a double value with a double value.

Thank you!
Paul

#17 Re: mORMot 1 » TestSQL3.exe JSON Encode Decode fails when decimal separator is "," » 2017-01-21 19:00:18

PBa

Dear ab,

today I had time to search for the reason of this bug.
This bug was introduced with {3129} [aa35ac110a] and can be fixed as follows:

In SynSelfTests.pas (version {3343}) please add a new line 5737:

{$ifndef NOVARIANTS}
var Va, Vb: Variant;
    VaAllowDblVal: TDocVariantOptions; // <== added by PBa
    c: currency;
{$endif}

Initialize this variable e.g. in line 6165:

{$endif}
  VaAllowDblVal := [dvoAllowDoubleValue]; // <== added by PBa
  for i := 1 to 100 do begin
    a := Random(maxInt);

and change line 6209:

      Check(Va=a);
      P := VariantLoadJSON(Va,P,nil,@VaAllowDblVal); // <== ",nil,@VaAllowDblVal" added by PBa
      Check(P<>nil);
      CheckSame(Va,r);

Va is now a representation of a double value (Va = 0.0123456789 with English layout where system decimal separator is set to "." and Va = 0,0123456789 with German layout where system decimal separator is set to ",", respectively)
instead of a string representation (Va = '0.0123456789' as stated in my post 2017-01-05) where

CheckSame(Va,r);

will succeed only if decimal separator is "." but will fail if decimal separator is ",".

Please check if you can add these lines to trunk...

Thereafter TestSQL3.exe runs smoothly without any failed assertions (tested with Delphi 7 and Delphi Berlin 10.1).

Thank you very much!
Paul

#18 Re: mORMot 1 » TestSQL3.exe JSON Encode Decode fails when decimal separator is "," » 2017-01-05 13:11:55

PBa

As it seems that my account "Paul" as well as my first post prior to AB's yesterday's answer has obviously been deleted, I just want to re-add my question for completeness:

Using the actual mORMot version TestSQL3.exe fails in EncodeDecodeJSON if system decimal separator is set to "," instead of "."
...
1.2. Low level types:
...
!  - Encode decode JSON: 100 / 283,293 FAILED  4.26s
...
Using mORMot 1.18.3310 ERTL FTS3
Running on Windows 7 64bit SP1 (6.1.7601) with code page 1252
TSQLite3LibraryStatic 3.16.0 with internal MM
Generated with: Delphi 7 compiler

Time elapsed for all tests: 89.32s
Tests performed at 04.01.2017 12:48:02

Total assertions failed for all test suits:  100 / 26,703,849
! Some tests FAILED: please correct the code.

The same is true when using Delphi 10.1 Berlin compiler.

I've tracked down this issue to lines 6151 and 6194 in SysSelfTests.pas:

6151:     r := Random;
...
6194:     CheckSame(Va,r);

In case system decimal separator is set to ",": e.g. r = 0,0123456789 ("," as decimal separator) but Va = '0.0123456789' ("." as decimal separator) => line 6194 fails.
In case system decimal separator is set to ".": e.g. r = 0.0123456789 ("." as decimal separator) and Va = '0.0123456789' ("." as decimal separator) => line 6194 doesn't fail.

As the usual layout in Austria and German is using "," as decimal separator, changing the system decimal separator to "." is not an option. Thus my question was how to circumvent this failure?

Thank you very much!
Paul

Board footer

Powered by FluxBB