Direct mode crashes

Discussion of open issues, suggestions and bugs regarding LiteDAC (SQLite Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
LHSoft
Posts: 130
Joined: Sat 18 Aug 2012 08:33

Direct mode crashes

Post by LHSoft » Mon 28 Jan 2019 06:04

Hello,
since Version 3.4.10 there is a application crash on using direct mode.
The exception is in data.db

Code: Select all

procedure TDataSet.DoAfterOpen;
begin
  if Assigned(FAfterOpen) then FAfterOpen(Self); <-- here is the exception
  if not IsEmpty then DoAfterScroll;
end;
using no direct mode, there is no exception in 3.4.10
Going back to 3.4.9 there is no exception in direct mode.

I can not locate the exception within my Code.

Please have a look and help me.

best regards
hans

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Direct mode crashes

Post by MaximG » Mon 28 Jan 2019 08:06

Please to investigate the issue, compose and send us using via the e-support form (https://www.devart.com/company/contactform.html) a small sample, which implements the described access to SQLite DB. Additionally, we will need the data.db file with SQLite DB itself, used in this sample,
which there will be no confidential data.

LHSoft
Posts: 130
Joined: Sat 18 Aug 2012 08:33

Re: Direct mode crashes

Post by LHSoft » Mon 28 Jan 2019 22:04

hello,
this was very hard to do because this is a very huge Project.
First I thought do not get a demo from it where the error is still there, but now I think it's possible. This requires you to install Fastreport 6 on your Delphi (my Version is 10.2.3). But maybe this is not necessary any more.
Following insights I got today:
1. removing Fastreport in this Project had no effect
2. removing your Fastreport LiteDAC Components had no effect.
But when restarting Delphi 10.3.2 Errors were suddenly gone.
So I investigated, that placing a frxReport on any form has no effect: no error
But if placing your frxLiteDACComponents on any form, the error is back again: It is triggered, if afterconnect or afteropen of a LiteDAC component is assigned.
It is not enough to remove this frxLiteDACComponents and Clearing the uses list of the form, the error remains until Delphi 10.3.2 is restarted again. Closing Project and reopen is not enough.

So please tell me if this helps.
best regards
hans

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Direct mode crashes

Post by MaximG » Wed 30 Jan 2019 10:55

We have carried out a thorough check of the work of our components when used in the Fastreport LiteDAC Component project. We failed to reproduce the described issue in our test environment according to your description. We understand all the complexity of the project you are developing, but to start investigating the issue, we need a fairly simple example during the execution of which the issue is reproduced. Thus, we are expecting such an example from your side.

LHSoft
Posts: 130
Joined: Sat 18 Aug 2012 08:33

Re: Direct mode crashes

Post by LHSoft » Wed 30 Jan 2019 11:16

OK, I'll compose and be back if Ready.
I assume you can have FR6 installed on your System, so I leave FR6 components on sample.

LHSoft
Posts: 130
Joined: Sat 18 Aug 2012 08:33

Re: Direct mode crashes

Post by LHSoft » Thu 31 Jan 2019 22:48

Hello,
I've been disassembling source code piece by piece.
What is left this Moment is, that your new Version 3.4.10 gets along badly with TMS's AdvColumnGrid (AdvCGrid). I did not contact support there yet, because they did not change anything, which has problems with your version 3.4.9 so I do not know what to ask there.
Do you have Access to AdvCGrid? Can you advise me where to search in your Sourcecode for conflicts? What has been changed from Version 3.4.9 to 3.4.10 that can result in such a conflict?
The Facts: if there is a Form in Project, that has AdvCGrid in top uses list (Position seems to be not relevant), project crashes. For crash this form is not necessary to be created, not necesarry to be linked in second or first uses lists of any other form and not nesessary to have a Component TAdvColumnGrid on Form, just the link to AdvCGrid is enough.
If removing your frxLiteDACComponents takes effect that mostly Project does not crash on starting, but a few minutes later, same when ADDING your LiteDACRTTI

best regards
Hans

LHSoft
Posts: 130
Joined: Sat 18 Aug 2012 08:33

Re: Direct mode crashes

Post by LHSoft » Fri 01 Feb 2019 16:48

so that was a crazy ralley, but now I have the error stable. Just removing a TLabel at on place or adding a groupbox at another lets the error appear or disappear (this are all not db related components). Never have seen this before.

So the error is raised in your LiteStatic line 1316:

Code: Select all

repeat
if O0OC0QCOQ0=1 then
OQOC0QCOQ0:=byte(OOOC0QCOQ0^)=byte(OC0C0QCOQ0)  //<-- here error is raised
else if O0OC0QCOQ0=2 then
OQOC0QCOQ0:=Word(OOOC0QCOQ0^)=word(OC0C0QCOQ0)
else
OQOC0QCOQ0:=integer(OOOC0QCOQ0^)=OC0C0QCOQ0;
if OQOC0QCOQ0 then begin
Result:=OOOC0QCOQ0;
Exit;
end;
OOOC0QCOQ0:=PtrOffset(OOOC0QCOQ0,O0OC0QCOQ0);
until OOOC0QCOQ0=OQ0C0QCOQ0;
I have a look over Weekend what else I can remove with error remaining and then send the source.

Hans

LHSoft
Posts: 130
Joined: Sat 18 Aug 2012 08:33

Re: Direct mode crashes

Post by LHSoft » Sun 03 Feb 2019 01:30

Ready, I've sent Demo as zip file. Please have a look to the description in this support request and let me know your results.
Best regards
hans

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Direct mode crashes

Post by MaximG » Tue 05 Feb 2019 12:50

We received your example but couldn't start analyzing it because of the use of the third-party components. We will be expecting the simplest example from you that reproduces the issue and does not utilize those components.

LHSoft
Posts: 130
Joined: Sat 18 Aug 2012 08:33

Re: Direct mode crashes

Post by LHSoft » Tue 05 Feb 2019 17:49

Hello,
this is the uses section of Project:

Code: Select all

Winapi.Windows, Winapi.Messages, System.SysUtils, System.Types, System.Variants, System.Classes,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Themes, ActiveX,
  JvComponentBase, JvExControls, JvLED,	//<-- JediLED
  Vcl.ComCtrls, Vcl.StdCtrls, DateUtils, Vcl.ButtonGroup, Vcl.WinXCtrls, Vcl.Mask, Vcl.Grids,
  Vcl.Menus, Vcl.ExtCtrls, System.ImageList, Vcl.ImgList,
  Vcl.Graphics,
  Vcl.DBCtrls, Vcl.DBGrids, DBLHGrid,
  frxClass, frxExportPDF, frxDesgn, frxExportBaseDialog, frxBarcode, //<-- Fastreport
  Data.DB, DBAccess, LiteAccess, LiteConsts, MemDS, MemData,
  DASQLMonitor, LiteSQLMonitor;
As you see, there are 2 Third-Party Components installed: FastReport and Jedi (JvLED)

If I remove the both Jedi LEDs the error does not occure, but if I remove the both TImageList on Form, the error does not occure too.
Same with unit DBLHGrid: if removing this from uses, error does not occure, exactly as if removing TImageList. DBLHGrid is not used in reduced sample and has not to be installed, just has to be there.
I just see, that DBLHGrid uses 2 not DB related TMS Components TAdvGlowbutton and TAdvOfficeStylers.
I will look for a solution for that, so that you can compile.
To have your DASQLMonitor and LiteSQLMonitor installed, FastReport is needed

I suppose, FastReport and Jedi are no Problems for you

you asked me, if I use the same LiteDAC version in RAD Studio 10.2.3, Tokio and RAD Studio 10.3?. Of Course I do, because your actual version is the only one which causes Problems.

I'll investigate a solution for TMS and be back again.
Or do you have the possibility to install TMS AdvComponent Pack DEMO? Because the error is very very fragil, as the example with TImageList Shows.

Best regards

LHSoft
Posts: 130
Joined: Sat 18 Aug 2012 08:33

Re: Direct mode crashes

Post by LHSoft » Tue 05 Feb 2019 18:06

I have deactivated all TMS Stuff in DBLHGrid, but this Moment, without AdvToolBarStylers in uses the error does not occure.
But this is without TImageList too, so I doubt if this realy is the reason.
anyway, I'll contact TMS Support now too.

For error, AdvToolBarStylers need not be installed because it is not used in Demo but has to be present only, so you can test it without installing a component, only some pas or dcu files must be present.

Unit DBLHGrid is now not necessary any more to produce the error, it is the unit AdvToolBarStylers.

So you get a new demo from me, same as TMSSupport.

LHSoft
Posts: 130
Joined: Sat 18 Aug 2012 08:33

Re: Direct mode crashes

Post by LHSoft » Tue 05 Feb 2019 22:35

I can now say that the latest end with TMS Components, the error occurs, is AdvMenus. This has Advantage, that AdvMenus only use Delphi stuff wth the exception of AdvGDIP. This AdvGDIP uses only Delphi stuff and including AdvGDIP error is not raised.
So error is raised with having AdvMenus in uses list and TImageList and JvLED on Form.

I'm preparing a Demo you can compile and send it to you. I suppose, you have jedi and Fastreport installed.

Edit:
After testing, til now I can say, the error during start program I recognized not in 10.3 but only in 10.2.3 (and in XE5 sometimes).
If starting compiled with 10.2.3, only in about 1 of 20 attempts there is no error during starting.
In 10.3 the error occurs later on working (connecting and disconnecting) with database and tables, so as with other Delphis too if I handle the error on Start.

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Direct mode crashes

Post by MaximG » Wed 06 Feb 2019 15:23

Thank you for the provided example. We have successfully compiled it. Unfortunately, after the run of the result application, we could not reproduce the issue you described. This behavior may depend on the third-party components that are used in your project. Thus, to find out the reasons leading to the error, we need to make sure that the use of any third-party components has no effect on this behavior. So we kindly ask you to make up and send an example that reproduces the issue without using the Jedi library to us.

LHSoft
Posts: 130
Joined: Sat 18 Aug 2012 08:33

Re: Direct mode crashes

Post by LHSoft » Thu 07 Feb 2019 10:44

Hello,
I would ask you to install jedi for this test.
I did not get the error yet without the jediLED, but I did not get the error without TImageList too, and this is a VCL Component. If I remove any component which is on form on last testproject, the error is gone. I have told you this several times in forum

And the error only occurs with your actual Version, with all previous versions there is no error at all and had never been. So it should be your interest too to have a look whats on.

So your component is not a stand alone component. I investigated one week time in giving you a testproject as small as possible. And jedi is a component set most have installed and its free.

I hope you can help me here so I do not have to stay on old versions forever.

best regards
Hans

Edit:
all Errors are still raised in LiteStatic as told above

RobWeigel
Posts: 1
Joined: Thu 07 Feb 2019 17:38

Re: Direct mode crashes

Post by RobWeigel » Thu 07 Feb 2019 17:48

The reason for this error is a bug in litestatic.pas, function strrchr(), line no 1325:

OOOC0QCOQ0:=PtrOffset(OOOC0QCOQ0,O0OC0QCOQ0);

It should look like this (include the minus sign):

OOOC0QCOQ0:=PtrOffset(OOOC0QCOQ0,-O0OC0QCOQ0);

Post Reply