#1 2020-07-11 11:54:59

tbo
Member
Registered: 2015-04-20
Posts: 25

Problem mORMotMVC with Delphi 10.4

Hallo!

mORMot 1.18.6085, Windows 10

I have a strange problem with mORMotMVC and Delphi 10.4. The problem can also be seen in example "30 - MVC Server". It crashes after takeoff.

Immediately after starting my server I get the following error message: Fatal exception EAccessViolation raised with message Zugriffsverletzung bei Adresse 0053B770 in Modul 'VGServer.exe'. Lesen von Adresse 001A4000.

In my program I can reproduce the following behaviour.

This function declaration works:
procedure ArticleBuy(var pmvIsUserLoggedIn: Boolean; out pmoSelectedArticle: TSQLArtikel);

The error comes when I change the function declaration as follows:
procedure ArticleBuy(pmArtikelID: TID; var pmvIsUserLoggedIn: Boolean; out pmoSelectedArticle: TSQLArtikel);

The behaviour can only be observed under Delphi 10.4. Under Delphi 10.3.3 it still works without problems.

I find following entry in log file:
000000000000DEF3  0 trace u_VGServerMain.TVGSRestServer(02f4ba50) BeginCurrentThread(THttpApiServer) root=Shop ThreadID=3f94 ThreadCount=15
000000000000DF4E  ! EXCOS EAccessViolation (c0000005) [] at 53b770  stack trace API 57d63e 40b56c 77d25224 77d12b26 6f133e 6f0508 86cd54 8867db 886ced 895117 77bd0419 77d066dd 77d066ad
000000000000DFCD  !  +    u_VGServerMain.TVGSHttpServer(027bbb10).Destroy

With best regards
Thomas

Offline

#2 2020-07-11 12:36:20

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 11,474
Website

Re: Problem mORMotMVC with Delphi 10.4

Please enable the detailed .map debugging information and check the exact stack trace with source file names and line numbers.
Or at least run it with the debugger and check the stack trace.

Sadly, I don't have Delphi 10.4 so I can't reproduce it.
As you wrote, I don't see any issue with Delphi 10.3.3 CE.

Offline

#3 2020-07-11 19:54:55

tbo
Member
Registered: 2015-04-20
Posts: 25

Re: Problem mORMotMVC with Delphi 10.4

Thanks for your help.

When I do a DEBUG build with Delphi 10.4, there is NO error! When I do a RELEASE build, I get the following error message:
000000000000C757  ! EXCOS EAccessViolation (c0000005) [] at 53b770 SynCommons.MoveX87  stack trace API 6f133a mORMot.TInterfaceFactory.Create 6f0504 mORMot.TInterfaceFactory.Get 86cd44 mORMotMVC.TMVCApplication.Start 8867c3 u_VGServerMain.TVGServerMain.Create 886d29 u_VGServerDaemon.TVGServerDaemon.Start
000000000004B051  ! EXCOS EAccessViolation (c0000005) [] at 53b770 SynCommons.MoveX87  stack trace API

Fatal exception EAccessViolation raised with message Zugriffsverletzung bei Adresse 0053B770 in Modul 'VGServer.exe'. Lesen von Adresse 001A4000

The error occurs only when I add the parameter "pmArtikelID: TID" to the function in the example. Otherwise it also works with Delphi 10.4 in RELEASE build.

With Delphi 10.3.3 it works with the DEBUG and the RELEASE build.

If I can do more, please say so.

With best regards
Thomas

Last edited by tbo (2020-07-11 19:56:00)

Offline

#4 2020-07-12 11:00:56

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 11,474
Website

Re: Problem mORMotMVC with Delphi 10.4

Isn't any line number in the stack trace?
Could you identify which line of TInterfaceFactory.Create is involved at address $6f0504 ?

Offline

#5 2020-07-12 13:58:08

tbo
Member
Registered: 2015-04-20
Posts: 25

Re: Problem mORMotMVC with Delphi 10.4

ab wrote:

Isn't any line number in the stack trace?

Unfortunately I get no line numbers displayed. I rarely use the debugger and I don't need more than F7, F8, F9. Let me try it this way.

This is the line (54217) in my version of the "mORMot.pas" unit where the problems start.

case ValueType of
  smvInteger, smvCardinal, smvInt64:
    if TJSONCustomParserRTTI.TypeNameToSimpleBinary(

And since the error only occurs with the addition of the parameter "pmArticleID: TID", it might even be a useful result.

Then I continue with F7 and F8:

> TSynAnsiConvert.AnsiBufferToRawUTF8()
> TSynTempBuffer.Init()
> TSynAnsiFixedWidth.AnsiBufferToUTF8()
  Source: 'TID'#8'¸e', SourceChars: 3, NoTrailingZero: False
> TSynTempBuffer.Done()
> SynCommons.FastSetString(), line number 21211
  --> MoveFast()

After that I cannot continue working in the IDE. It stands still. I have to abort the process.

Hope this helps. If I can help in any other way, please ask.

With best regards
Thomas

Offline

#6 2020-07-13 08:03:26

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 11,474
Website

Re: Problem mORMotMVC with Delphi 10.4

I don't know what happens...
Perhaps some Delphi 10.4 optimization issue....
Please try https://synopse.info/fossil/info/832b1be8bb

Offline

#7 2020-07-13 11:06:08

tbo
Member
Registered: 2015-04-20
Posts: 25

Re: Problem mORMotMVC with Delphi 10.4

Hallo!

Thanks for the work. Unfortunately, the problem is not solved. The error occurs both in my program and in the example "30 - MVC Server" (only in RELEASE build).

It's no problem for me. I can continue working with older Delphi versions. If other users report bugs related to Delphi 10.4, you should keep the problem in mind. From my past experience I should have known better, never trust Delphi x.0 versions. But I couldn't resist the new LSP feature.

Thanks again for the time you invest in mORMot.

With best regards
Thomas

Offline

#8 2020-07-13 14:32:42

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 11,474
Website

Re: Problem mORMotMVC with Delphi 10.4

Sorry it didn't circumvent the problem.

Any feedback is welcome!

Offline

#9 2020-07-14 13:52:00

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 409

Re: Problem mORMotMVC with Delphi 10.4

I tried to compile demo 30 both in debug mode and release mode with Delphi 10.4 and it works without error.
Also my software (based on MVC) works.
I'm not sure of framework version used but one of last build. (is there a way to know the build?)

Offline

#10 2020-07-14 14:00:15

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 11,474
Website

Re: Problem mORMotMVC with Delphi 10.4

Check SynopseCommit.inc file.

Offline

#11 2020-07-14 14:37:20

tbo
Member
Registered: 2015-04-20
Posts: 25

Re: Problem mORMotMVC with Delphi 10.4

Hallo!

array81 wrote:

I tried to compile demo 30 both in debug mode and release mode with Delphi 10.4 and it works without error.

Interesting! Did you mean compile, or compile and run? My Delphi 10.4 Professional Patch 1 only installed the Spring4D and DSharp libraries. No other tools or libraries are installed. Maybe you can better isolate the error and provide Arnaud with more information.

Thank you for your support.

PS: Sorry I forgot to mention that I create Win32 programs.

With best regards
Thomas

Last edited by tbo (2020-07-14 14:47:14)

Offline

#12 2020-07-14 16:43:21

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 409

Re: Problem mORMotMVC with Delphi 10.4

I have compiled and ran demo 30 (win32) then use browser to browser client pages.
I have only mORMot Framework e VerySimple.Lua installed.
mORMot Framework version used: 1.18.6078

Also my application is win32 and work but I tested it only in debug mode until now.

Last edited by array81 (2020-07-14 21:13:32)

Offline

#13 2020-07-15 09:50:55

sakura
Member
Registered: 2018-02-21
Posts: 66

Re: Problem mORMotMVC with Delphi 10.4

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

Offline

#14 2020-07-15 20:45:15

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 409

Re: Problem mORMotMVC with Delphi 10.4

OK. I can confirm there is a problem with demo 30 and last version of framework.

With version 1.18.6078 the demo work without problem.
With version 1.18.6089 the demo crash after run.

Test on Delphi 10.4 in release mode and win32.

Last edited by array81 (2020-07-15 20:45:31)

Offline

#15 2020-07-17 08:53:07

sakura
Member
Registered: 2018-02-21
Posts: 66

Re: Problem mORMotMVC with Delphi 10.4

@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

Offline

#16 2020-07-17 10:12:13

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 11,474
Website

Re: Problem mORMotMVC with Delphi 10.4

@array81

I don't see any difference between 1.18.6078 and 1.18.6089 which may be the reason of this crash...
Do you have any clue? Can you refine to a single commit?

Offline

#17 2020-07-17 11:53:45

sakura
Member
Registered: 2018-02-21
Posts: 66

Re: Problem mORMotMVC with Delphi 10.4

@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

Offline

#18 2020-07-17 12:52:25

tbo
Member
Registered: 2015-04-20
Posts: 25

Re: Problem mORMotMVC with Delphi 10.4

sakura wrote:

It seems to have to do with the SynCommons.MoveX87 method.

I have replaced "MoveFast := @MoveX87" by "MoveFast := @System.Move" and the error still remains.

I have tested version 1.18.5999 and there is already the error. The error depends on the constellation shown in the incoming posting.

Bis bald...
Thomas

Offline

#19 2020-07-17 13:23:28

sakura
Member
Registered: 2018-02-21
Posts: 66

Re: Problem mORMotMVC with Delphi 10.4

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 mad

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.

Offline

#20 2020-07-17 13:26:05

sakura
Member
Registered: 2018-02-21
Posts: 66

Re: Problem mORMotMVC with Delphi 10.4

P.S.: Quick Fix - but not compatible with older compilers like Delphi 7:

Exit(Dest);

Replace that line with roll

Offline

#21 2020-07-17 14:12:53

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 11,474
Website

Re: Problem mORMotMVC with Delphi 10.4

Buggy Delphi compiler... sad
Please try https://synopse.info/fossil/info/c2a35d8687

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.

Thanks a lot for the investigation!
Perhaps worth a QC report to Embarcadero.

Offline

#22 2020-07-17 17:18:10

sakura
Member
Registered: 2018-02-21
Posts: 66

Re: Problem mORMotMVC with Delphi 10.4

ab wrote:

Buggy Delphi compiler... sad

Yeah, not expected, but sh*t happens.

Will do later. :-)

ab wrote:

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.

ab wrote:

Thanks a lot for the investigation!

Helps me too. ;-)

ab wrote:

Perhaps worth a QC report to Embarcadero.

Definitely. Will try to simplify and do just that.

Have a nice weekend,
Daniel

Offline

#23 2020-07-18 10:09:01

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 11,474
Website

Re: Problem mORMotMVC with Delphi 10.4

Latest 10.4 update 2 is unlikely to solve this issue.

It seems to have introduced some new regressions: https://en.delphipraxis.net/topic/3147- … available/

Offline

#24 2020-07-19 13:33:06

sakura
Member
Registered: 2018-02-21
Posts: 66

Re: Problem mORMotMVC with Delphi 10.4

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

Offline

#25 2020-07-19 13:56:37

sakura
Member
Registered: 2018-02-21
Posts: 66

Re: Problem mORMotMVC with Delphi 10.4

So, registered at the quality portal: https://quality.embarcadero.com/browse/RSP-30088

Offline

#26 2020-07-19 20:06:00

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 11,474
Website

Re: Problem mORMotMVC with Delphi 10.4

It is an awful Delphi bug which should impact a lot of user code - not only mORMot.
I guess this is safer to wait for a fix (in patch 3) and avoid using 10.4 until stabilized.

It reminds me of https://blog.synopse.info/?post/2017/03 … C64-broken
Not sure the Quality and Testing did increase since that time...

Thanks a lot for creating a QC entry.
Hope they take it into consideration.

Offline

#27 2020-07-20 05:41:51

sakura
Member
Registered: 2018-02-21
Posts: 66

Re: Problem mORMotMVC with Delphi 10.4

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 ;-)

Last edited by sakura (2020-07-20 05:46:33)

Offline

#28 2020-07-20 07:57:55

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 11,474
Website

Re: Problem mORMotMVC with Delphi 10.4

Very nice!
Let's hope indeed that a hint is enough to identify potential misbehavior.

I tried to fix Delphi 10.4 unexpected hint with https://synopse.info/fossil/info/7572d7d83c

Thanks a lot for the feedback.

Offline

#29 2020-07-20 08:12:07

sakura
Member
Registered: 2018-02-21
Posts: 66

Re: Problem mORMotMVC with Delphi 10.4

Well, I compiled our project and I get a perfect result now, in Delphi 10.4

Hints: 0
Warnings: 0
Errors: what's that ;-)

Offline

#30 2020-07-20 08:30:13

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 11,474
Website

Re: Problem mORMotMVC with Delphi 10.4

Great!

I have written a blog article to give some feedback to users, since they are likely to use Delphi 10.4 - our survey stated that most users try to keep in synch with the latest Delphi revision.

https://blog.synopse.info/?post/2020/07 … elphi-10.4

Offline

#31 2020-07-20 08:44:04

sakura
Member
Registered: 2018-02-21
Posts: 66

Re: Problem mORMotMVC with Delphi 10.4

Perfekt and thanks for the flowers - see you in Düsseldorf in November, I hope :-)

Offline

#32 2020-07-20 09:24:32

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 11,474
Website

Re: Problem mORMotMVC with Delphi 10.4

Prost!
smile

Offline

#33 2020-07-20 18:27:45

macfly
Member
Registered: 2016-08-20
Posts: 218

Re: Problem mORMotMVC with Delphi 10.4

https://en.delphipraxis.net...
"patch release before holidays" syndrome...

@ab

I think you can cancel the twitter account creation.

After this post, Embarcadero will no longer want to sponsor the sponsorship of mORMot.

big_smile

Offline

#34 2020-07-20 20:38:18

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 11,474
Website

Re: Problem mORMotMVC with Delphi 10.4

So sad... I won't tweet... sad

big_smile

Offline

#35 2020-07-30 09:34:19

sakura
Member
Registered: 2018-02-21
Posts: 66

Re: Problem mORMotMVC with Delphi 10.4

Bug is opened, finally :-)

Offline

Board footer

Powered by FluxBB