You are not logged in.
Hi Arnaud,
the compiler throws a warning [dcc32 Warning] mormot.core.json.pas(4883): W1014 String constant truncated to fit STRING[8]
at TJsonSaveContext.AddDateTime when using
W.AddShorter('T00:00:00Z') // the same pattern for date and dateTimeRegards,
Daniel
Tested on similar settings, using !0.4.2 though, and all ran through, however, 1 test failed
! - Mustache renderer: 1 / 157 FAILED 2.05sFinal:
Generated with: Delphi 10.4 Sydney 32 bit compiler
Time elapsed for all tests: 1m42
Performed 2021-04-15 06:16:01 by Daniel Wischnewski on DANIEL-VM
Total assertions failed for all test suits: 1 / 41,661,926
! Some tests FAILED: please correct the code.Thanks, perfect :-)
Would you like such changes as pull request, or do you prefer to do them yourself?
Hi,
I'm kind of irritated already, that TRestServerUriContext decides to change my returned content as per default, when I have an error code, however, it really bugs me, that when using ReturnsJson, that there is no option, to suppress that behavior. Why would that be. We have established a pretty specific communication protocol within our system, to send data, states, etc.
Yes, we can convert to JSON every time manually and use Returns with HandleErrorAsRegularResult set to true, but why is it designed to force one to do it that way? Shouldn't the lib, as per standard, treat content returned as-is, rather than changing it in some circumstances?
Would it at least make sense, having an overloaded version of ReturnsJson with the HandleErrorAsRegularResult parameter available?
Regards,
Daniel
Thx, I know, I was just not thinking about it, when the tests came up.
Darn, I did read that topic, but did not connect the dots in my head :-D
Thanks, just ensuring it's on purpose :-D
Hi folks,
rather than just testing services included, I would love to test published MVC methods as well, ensuring correct parameter mapping, and so on.
Considering following minimized MVC app (see https://pastebin.com/xHEUK2vV ), how would my test case look? How would a pass a valid context object?
As much, as I love going through the mORMot tests, I did not find an answer to that :-(
Thanks,
Daniel
Hi Arnaud,
running the tests on the curent state, it asked to download the latest release from https://github.com/synopse/mORMot2/rele … ite.3.35.0, however, only up to 3.34.1 is available at this moment.
Thanks,
Daniel
Hi Arnaud,
another small one,
[dcc32 Hint] mormot.core.zip.pas(1189): H2077 Value assigned to 'age' never usedRegards,
Daniel
Hi Arnaud,
in D10.4.2/Win32 I get following warnings:
[dcc32 Warning] mormot.core.zip.pas(1059): W1073 Combining signed type and unsigned 64-bit type - treated as an unsigned type
[dcc32 Warning] mormot.core.zip.pas(1331): W1073 Combining signed type and unsigned 64-bit type - treated as an unsigned type
I guess a simple cast like
h64.offset := QWord(fDest.Position) - fAppendOffset;
...
lh64.headerOffset := QWord(fDest.Position) - fAppendOffset;would fix that.
Regards.
Daniel
You can use a local variable, I guess.
Or... split the string, it's just a compiler limit
TTextWriter.RegisterCustomJSONSerializerFromText(
TypeInfo(TMyClass),
'field1, field2, ' + 'field3 RawUTF8'
).Options := [soReadIgnoreUnknownFields];1. You need to download the latest static from https://github.com/synopse/mORMot2/rele … ite.3.34.1
I thought, I did :-o Only unpacked, but forgot to move...
2. TExecutable is not serializable for sure.
It was never meant to.
There is an embedded class field - TFileVersion - which prevents JSON Serialization.
My bad, but would have been cool to use directly for mustache ;-)
Thanks,
Daniel
What is Executable?
From mormot.core.os, aka ExeVersion (mORMot 1).
Do the regression tests pass on your computer?
They, currently, do not even compile (Sorry, forgot to write that in the original post)
[dcc32 Error] mormot.db.raw.sqlite3.static.pas(1089): E2065 Unsatisfied forward or external declaration: 'sqlite3_progress_handler'
[dcc32 Error] mormot.db.raw.sqlite3.static.pas(1094): E2065 Unsatisfied forward or external declaration: 'sqlite3_stmt_scanstatus'
[dcc32 Error] mormot.db.raw.sqlite3.static.pas(1095): E2065 Unsatisfied forward or external declaration: 'sqlite3_stmt_scanstatus_reset'
......
[dcc32 Fatal Error] mormot2tests.dpr(709): F2063 Could not compile used unit 'mormot.db.raw.sqlite3.static.pas'Regards,
Daniel
Hi,
can anyone confirm, that a simple console app, only containing
Writeln(RecordSaveJson(Executable, TypeInfo(TExecutable)));will raise an AV...
Zugriffsverletzung bei Adresse 00000000 in Modul 'IT.exe'. Lesen von Adresse 00000000( AV at 000000 in module ''. reading address 00000)
mORMot2, current version (GitHub)
Delphi 10.4.2, Win32
Regards,
Daniel
... but we had to let it win on one algo at least
For how long? :-D
Since we don't use "Asynch" as a stand-alone word, it won't break as a potential keyword...
In Delphi it might break, a unit name like mORMot.Core.Const would not work.
Just sayin' ;-)
I would leave it at asynch - while you are right - async may just become a keyword at some point, as it is in other languages already, and thus may break compiling, when used in/as unit names ;-)
Thanks @ab, everything works with the current repo on Delphi 10.4 (Win32/Win64) as expected. Millions of perfectly passed tests and zip failed ones. I am impressed, have always been, and likely will always be, with your work and dedication.
So far, looking great. I am using mORMot2 for internal production code (however, basically just the JSON-part), and it is working smoothly. The code created by that is working standalone, as we have to work on XML data, so, no fear of a pre-production version going into production code themselves.
The tests on Delphi 10.4 look promising.
Win32, Release:
Time elapsed for all tests: 56.27s
Total assertions failed for all test suits: 0 / 41,982,561
! All tests passed successfully.
Win64, Release:
Time elapsed for all tests: 45.14s
Total assertions failed for all test suits: 0 / 41,955,145
! All tests passed successfully.
However, when starting, I get a little popup warning:
Static SQLite3 library as included within mormot2tests is outdated!
Linked version is 3.31.0 whereas the current/expected is 3.34.0.
Please download latest SQLite3 3.34.0 revision from
https://github.com/synopse/mORMot2/releases/download/pre1/mormot2static.7zAnd I have, just before, updated to the latest version.
Regards,
Daniel
P.S.: Du to user error, I've tested a three day old version, however, the current version performs similar, with the same popup ;-)
Little update about mORMot 2 status.
Can't wait :-)
I just pushed the mormot.orm.core.pas unit, which has the root ORM features.
Cool
It is uncoupled from TSQLRest, thanks to interfaces use, and should have a better SOLID design.
Sounds great!
Stay tuned!
I will!
Thanks again!
Your problem is, that ODBC simply does not support multiple statements in a single command/query. However, if you use MySQL, there is an option, that will enable that special feature.
More on that: https://stackoverflow.com/questions/414 … 6#15440056
Regards,
Daniel
I know, but I thought I might use the JSON already. No production system, but simply exploring it as needed. ;-)
P.S.: And getting used to the namespaces was my target here. :-D I have a compiler switch set to go back and forth. So, as soon as that works, I would be happy to explore more :-P
Hi,
I wanted to start working on mORMot2, but got stumped on the first task already. Load JSON into a TDocVariantData record.
var FileContent := StringFromFile(aFileName);
// FRoot := TDocVariantData(JSONToVariant(FileContent));
FRoot.InitJSON(FileContent);Either way of loading the JSON file (uri: http://fhir.de/StructureDefinition/patient-de-basis/0.2 - there is a JSON representation and at the right/top of the page is a download link for the file) fails without(!) error.
However, the VName and VValue arrays are sized correctly, but contain only empty strings/Unassigned values throughout.
Same lines in mORMot 1.8 work perfectly fine.
Using Delphi 10.4.1, can anyone reproduce on other Delphi versions and/or FPC?
Regards,
Daniel
P.S.: Direct link to JSON file: https://simplifier.net/basisprofilde/pa … ormat=json
Don't use Delphi 10.4 but the 10.4.1 branch.
I'd say wait for 10.5 (or 10.5.1?) - Anyways, 10.4.1 is way better than 10.4, but as far as I had time to play around, I'd still wait. 10.4 changed so many things - usually for the better - but they all still need to learn to play nicely with each other.
There are a branch mORMot2 in Github.
I suppose you've heard my forehead bump onto the table... :-D
Thx
Is there an "early" access to it?
Hi,
are there plans for the SynCrypt module to support GCM (Galois/Counter Mode) encryption, like AES-GCM) at some point?
Thanks for any information,
Daniel
Bug is opened, finally :-)
Perfekt and thanks for the flowers - see you in Düsseldorf in November, I hope :-)
Well, I compiled our project and I get a perfect result now, in Delphi 10.4
Hints: 0
Warnings: 0
Errors: what's that ;-)
I have opened up that bug for discussion at the Delphi-PRAXiS as well, hoping to get some traction: https://en.delphipraxis.net/topic/3155- … elphi-104/
As for your question, whether any hints are left, yes one, at first glance looking alike, but this time, I believe it to be correct.
In mORMotService.pas, method function TService.GetControlHandler: TServiceControlHandler; (line 1143)
It says
[dcc32 Hint] mORMotService.pas(1170): H2077 Value assigned to 'TService.GetControlHandler' never used
However, you have a non-conditional EXIT in line 1154, so the code after that shall never be reached.
Please review ;-)
P.S.: Last, but not least, with the latest changes to mORMot, it works fine under Delphi 10.4 :-) As we are currently just developing, with a release years ahead, I feel okay continuing to use 10.4 ;-)
So, registered at the quality portal: https://quality.embarcadero.com/browse/RSP-30088
Nope, problem still exists. However, a nicer fix for your particular problem exists as well.
Replace the very first else with a semicolon --->
if (self=nil) or (Dest=nil) then begin
Result := nil;
Exit;
end else
if (Source<>nil) and (SourceChars>0) then begin
...change to
if (self=nil) or (Dest=nil) then begin
Result := nil;
Exit;
end;
if (Source<>nil) and (SourceChars>0) then begin
...And the problem is gone as well. I am trying to minimize the problem and will submit that to the team on Monday.
Regards,
Daniel
Buggy Delphi compiler...
Yeah, not expected, but sh*t happens.
Please try https://synopse.info/fossil/info/c2a35d8687
Will do later. :-)
No other compiler hint reported? There are several other identical patterns in the code. Perhaps the "goto" in this method made the compiler especially unhappy.
Will check, don't think so. A few came from the sample itself.
Thanks a lot for the investigation!
Helps me too. ;-)
Perhaps worth a QC report to Embarcadero.
Definitely. Will try to simplify and do just that.
Have a nice weekend,
Daniel
P.S.: Quick Fix - but not compatible with older compilers like Delphi 7:
Exit(Dest);Replace that line with ![]()
I have located the problem, and it seems to be a compiler/linker problem of Delphi.
When compiling all, we get a hint:
[dcc32 Hint] SynCommons.pas(17526): H2077 Value assigned to 'TSynAnsiFixedWidth.AnsiBufferToUTF8' never used
Which is the line
Result := Dest; and it get's removed by compiler/linker output ![]()
I will try - at a later point this weekend or Monday- to get the compiler to simply love the line. That should resolve the problem.
@ab - I cannot confirm 1.18.6078 working.
I have tried back to version 1.18.5749 and the problem persists. It seems to have to do with the SynCommons.MoveX87 method.
Log from the revision: https://pastebin.com/hWC7d3Lc
@ab - any idea what we could try to solve this problem? Would you like remote access to a 10.4 instance?
Regards,
Daniel
P.S.: Personally, I can wait to see you @EKON24 in November :-D
So, I had the time to at least get logging into the MVC demo with 10.4
After building a RELEASE version of it and starting it, it crashes on TInterfaceFactory.Create.
The log can be found at https://pastebin.com/ZxtCTe7m
Currently, I am a bit flabbergasted as to why that happens though.
@Arnaud, as written in the Email, you may get remote access to a VM with Delphi 10.4 and that demo to fiddle arround.
Regards,
Daniel
Have you updated https://synopse.info/files/sqlite3obj.7z yet, as the file stamps are from January and the compiled app complains, that versions do not match (Delphi 10.4).
...I can confirm urhen comment make sense, total bullshit supporting 20 years old product...
While not my choice of words, it matches my sentiments ;-)
Just one more option, if the model will not be shared, you leave the TSQLRestServerDB as Owner, so when destroying the TSQLRestServerDB, the Model is also destroyed.
As written before, this was a sample, boiled down to minimal code. Interestingly, the same mistake happened in the sample, as in the real app. However, in the sample it was way more obvious.
Ouch, should have seen that myself. Thanks!!!!!
Hi,
last post was a side effect of my actual problem. I have a memory leak (Delphi 10.3.3), and finally, I have reproduced it with minimal code.
program mORMot.bug;
{$APPTYPE CONSOLE}
{$R *.res}
uses
// FastMM4,
System.SysUtils,
mORMot,
mORMotDDD,
mORMotSQLite3,
SynCommons,
SynSQLite3,
SynSQLite3Static;
type
TSQLTest = class(TSQLRecord)
private
FPassword: RawUTF8;
FLogin: RawUTF8;
FSalt: RawUTF8;
published
property Login: RawUTF8 read FLogin write FLogin;
property Password: RawUTF8 read FPassword write FPassword;
property Salt: RawUTF8 read FSalt write FSalt;
end;
var
Model: TSQLModel;
DB: TSQLDatabase;
Rest: TSQLRestServerDB;
Test: TSQLTest;
Success: Boolean;
begin
ReportMemoryLeaksOnShutdown := True;
try
Model := TSQLModel.Create([TSQLTest]);
DB := TSQLDatabase.Create('2.db');
Rest := TSQLRestServerDB.Create(Model, DB);
Rest.CreateMissingTables;
Test := TSQLTest.Create();
try
Success := Rest.Retrieve('Login = ?', [], ['youOrMe'], Test);
Writeln('Success: ', Success);
finally
Test.Free;
end;
DB.Free;
Rest.Free;
Model.Free;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
Write('Done ');
Readln;
end.Adding FastMM to the uses, further reproduces the problem from my other current topic.
Memory Leak Report
Unexpected Memory Leak
An unexpected memory leak has occurred. The unexpected small block leaks are:
13 - 20 bytes: Unknown x 31
21 - 28 bytes: Unknown x 90
29 - 36 bytes: Unknown x 1
37 - 44 bytes: Unknown x 15
45 - 52 bytes: Unknown x 2
53 - 60 bytes: Unknown x 28
61 - 68 bytes: Unknown x 12
69 - 76 bytes: Unknown x 4
77 - 84 bytes: Unknown x 2
85 - 92 bytes: Unknown x 6
125 - 132 bytes: Unknown x 1
157 - 172 bytes: Unknown x 5
477 - 524 bytes: Unknown x 1
621 - 668 bytes: Unknown x 2
957 - 1052 bytes: Unknown x 1
The sizes of unexpected leaked medium and large blocks are: 85292, 48172, 4140Regards,
Daniel
Actually, even simpler, is enough to get FastMM4 to blow up:
program mORMot.bug;
{$APPTYPE CONSOLE}
{$R *.res}
uses
FastMM4,
System.SysUtils,
mORMot,
mORMotDDD,
mORMotSQLite3,
SynCommons,
SynSQLite3Static;
var
Model: TSQLModel;
Rest: TSQLRestServerDB;
begin
ReportMemoryLeaksOnShutdown := True;
try
Model := TSQLModel.Create([]);
Rest := TSQLRestServerDB.Create(Model, '1.db');
Rest.Free;
Model.Free;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
Write('Done ');
Readln;
end.Hi,
not sure how easy it is to reproduce, but with the current release (GitHub), following code will, when run in the debugger, produce an error, shown by FastMM4, at the end of the process.
Delphi 10.3.3
program mORMot.bug;
{$APPTYPE CONSOLE}
{$R *.res}
uses
FastMM4,
System.SysUtils,
mORMot,
mORMotDDD,
mORMotSQLite3,
SynCommons,
SynSQLite3Static;
type
TSQLTest = class(TSQLRecord)
private
FPassword: RawUTF8;
FLogin: RawUTF8;
FSalt: RawUTF8;
published
property Login: RawUTF8 read FLogin write FLogin;
property Password: RawUTF8 read FPassword write FPassword;
property Salt: RawUTF8 read FSalt write FSalt;
end;
var
Model: TSQLModel;
Rest: TSQLRestServerDB;
Test: TSQLTest;
Success: Boolean;
begin
ReportMemoryLeaksOnShutdown := True;
try
Model := TSQLModel.Create([TSQLTest]);
Rest := TSQLRestServerDB.Create(Model, 'test.db');
Rest.CreateMissingTables;
Test := TSQLTest.Create();
try
Success := Rest.Retrieve('Login = ?', [], ['youOrMe'], Test);
Writeln('Success: ', Success);
finally
Test.Free;
end;
Rest.Free;
Model.Free;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
Write('Done ');
Readln;
end.---------------------------
Debugger Exception Notification
---------------------------
Project mORMot.bug.exe raised exception class $C0000005 with message 'access violation at 0x01539099: read of address 0x767d75db'.
---------------------------
Break Continue Help
---------------------------Regards,
Daniel
Thanks, first tests look very promising. Tried about 20 times, all worked just perfectly fine :-)
destructor THttpApiServer.Destroy;
{$ifdef LVCL}
var i: integer;
{$endif}
begin
{$ifdef LVCL}
Terminate; // for Execute to be notified about end of process
{$endif}
try
if (fClones<>nil) and (Http.Module<>0) then // fClones=nil for clone threads
----------- fClones<>nil needed? removing that, it seems to work...
DestroyMainThread;
{$ifdef LVCL}
for i := 1 to 500 do
if fExecuteFinished then
break else
SleepHiRes(10);
{$endif}
finally
inherited Destroy;
end;
end;See comment above. I have not seen - in my demo case - where fClones is accessed within DestroyMainThread, so, it being NIL wouldn't be a problem. But in other cases it might...