#1 2025-08-15 12:18:01

koraycayiroglu
Member
Registered: 2017-02-03
Posts: 68

Timestamp raises an EXCEPTION_ACCESS_VIOLATION when release build.

Hi everyone,

I just upgraded my services to mORMot2. Actually there isn't any problem with my services when i build them with DEBUG compiler directive. But when i make a release build, timestamp raises an EXCEPTION_ACCESS_VIOLATION inside TRestRouter.Lookup.


access_violation_restrouter_lookup.png


Any ideas?

Offline

#2 2025-08-15 14:29:25

koraycayiroglu
Member
Registered: 2017-02-03
Posts: 68

Re: Timestamp raises an EXCEPTION_ACCESS_VIOLATION when release build.

Ok, this happens with DEBUG build too. It works on my computer (surprise lol) which is win11, it raises same error with our server win2019 Server. I will test it with an empty sample and notify you. If anything comes up your mind, please share. Thanks.

Offline

#3 2025-08-16 12:53:01

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,148
Website

Re: Timestamp raises an EXCEPTION_ACCESS_VIOLATION when release build.

1) Try with a TOrmModel.Root of more than 1 char (e.g. 'aa').

2) Which compiler are you using?

Offline

#4 2025-08-18 07:29:13

koraycayiroglu
Member
Registered: 2017-02-03
Posts: 68

Re: Timestamp raises an EXCEPTION_ACCESS_VIOLATION when release build.

Hi ab,

I tried setting root as 'app' but it's still the same. I am using Delphi 12.3, Version 29.0.55362.2017 and MongoDB 8 for database.

Offline

#5 2025-08-18 07:43:38

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,148
Website

Re: Timestamp raises an EXCEPTION_ACCESS_VIOLATION when release build.

I am not able to reproduce it here, sorry.

Did you try with the latest mORMot 2 source from trunk?

Offline

#6 2025-08-18 08:01:01

koraycayiroglu
Member
Registered: 2017-02-03
Posts: 68

Re: Timestamp raises an EXCEPTION_ACCESS_VIOLATION when release build.

I found the source of the problem. This occurs when i register my interface-based api. This is how i register my interfaces:


var i, j : Integer;
  SFS: TServiceFactoryServer;
begin
  SFS := TServiceFactoryServer(ServiceDefine(TAdmin, IAdmin, sicPerSession, SERVICE_CONTRACT_NONE_EXPECTED));
  SFS.ResultAsJSONObjectWithoutResult := True;
  SFS.SetOptions([], [optErrorOnMissingParam]);
end;

Offline

#7 2025-08-18 08:06:50

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,148
Website

Re: Timestamp raises an EXCEPTION_ACCESS_VIOLATION when release build.

It does not make much sense, because /timestamp is a method-based service which has nothing to do with interface-based services.

The regression tests are checking /timestamp together with interface based services.

Offline

#8 2025-08-18 08:16:04

flydev
Member
From: France
Registered: 2020-11-27
Posts: 111
Website

Re: Timestamp raises an EXCEPTION_ACCESS_VIOLATION when release build.

FYI you can make code simpler with

with ServiceDefine(TAdmin, [IAdmin], sicPerSession, SERVICE_CONTRACT_NONE_EXPECTED) do
begin
  ResultAsJSONObjectWithoutResult := True;
  SetOptions([], [optErrorOnMissingParam])
end;

Offline

#9 2025-08-18 08:56:55

koraycayiroglu
Member
Registered: 2017-02-03
Posts: 68

Re: Timestamp raises an EXCEPTION_ACCESS_VIOLATION when release build.

I know, there is nothing wrong with mORMot2, and tests passed successfully. Either way, at least i know where to look know and keep you guys informed. Thanks to you both..

Offline

#10 2025-08-18 09:21:41

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,148
Website

Re: Timestamp raises an EXCEPTION_ACCESS_VIOLATION when release build.

Put a breakpoint in TRestServer.Uri and try to look and debug what is happening.

There may be some unexpected bug in mORMot 2 anyway, in some conditions - but they need to be identified.

Offline

#11 2025-08-18 10:42:47

koraycayiroglu
Member
Registered: 2017-02-03
Posts: 68

Re: Timestamp raises an EXCEPTION_ACCESS_VIOLATION when release build.

New info, it seems it's related to windows version and/or regional settings.

Windows 11, Delphi 12.3, working.

win11_timestamp.png


Windows Server 2019 standard, Delphi 12.3, raises an error.

winsrv2019_timestamp.png

Offline

#12 2025-08-18 11:33:59

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,148
Website

Re: Timestamp raises an EXCEPTION_ACCESS_VIOLATION when release build.

Your expression in the debug window seems wrong.

You need to write fOwner.fPublishedMethod or TRestServer(fOwner).fPublishedMethod.

Writing TRestServer(@fOwner) is plain wrong because fOwner is already a pointer.

Offline

#13 2025-08-18 12:04:28

koraycayiroglu
Member
Registered: 2017-02-03
Posts: 68

Re: Timestamp raises an EXCEPTION_ACCESS_VIOLATION when release build.

When you write TRestServer(fOwner).fPublishedMethod, debug window return "Inaccessible value", that's why i use pointer to show you the difference between 2 computers.

Offline

#14 2025-08-18 12:22:22

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,148
Website

Re: Timestamp raises an EXCEPTION_ACCESS_VIOLATION when release build.

TRestServer(@fOwner) is always wrong: in both cases, the output values are just garbage.

Offline

#15 2025-08-18 13:05:02

koraycayiroglu
Member
Registered: 2017-02-03
Posts: 68

Re: Timestamp raises an EXCEPTION_ACCESS_VIOLATION when release build.

I know, anyway still believe this error belongs to my previous implementation. with a sample project, it works fine. I will implement my business login step by step and see where the issue is. will inform you when i found something useful.

Offline

#16 Yesterday 12:09:35

koraycayiroglu
Member
Registered: 2017-02-03
Posts: 68

Re: Timestamp raises an EXCEPTION_ACCESS_VIOLATION when release build.

Alright, funny enough it fixed itself tongue

Updated mORMot2 to today's commit, getting last 3 or 4 days of commits from repo.
Updated static libraries again to be sure.
Put "{$I mormot.defines.inc}" to every pas file.

I don't know which one is responsible, but for people who may encounter this error please try these steps first.

Thanks for your patience and support.

Offline

Board footer

Powered by FluxBB