prDirect Access violations

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
FredS
Posts: 272
Joined: Mon 10 Nov 2014 17:52

prDirect Access violations

Post by FredS » Thu 25 Nov 2021 22:26

First one right after connecting and a call to AppendRecord was made on a Dataset with LocalUpdate=True.
Thought maybe the feature doesn't work with prDirect but even after commenting out I receive that continually.

The Server is SQL Express 2008 local so no TCP/IP issues.. UniDAC 9.0.1.1. I've checked help and there appear to be no restrictions..

Code: Select all

exception class    : EAccessViolation
exception message  : Access violation at address 0000000002AB14A7 in module 'PA.exe'. Read of address 0000000000000000.
02ab14a7 +017 PA.exe TdsClassesUni        740  +1 TTDSCommand.OQCCOCCCQ0
02ab3c00 +020 PA.exe TdsClassesUni       1322  +2 TTDSRecordSet.DoAfterFetch
029ed04c +0cc PA.exe CRAccess            5332 +18 TCRRecordSet.Fetch

exception message  : Access violation at address 0000000002AB14A7 in module 'PA.exe'. Read of address 0000000000000000.
02ab14a7 +017 PA.exe TdsClassesUni              740   +1 TTDSCommand.OQCCOCCCQ0
02ab3c00 +020 PA.exe TdsClassesUni             1322   +2 TTDSRecordSet.DoAfterFetch
029ed04c +0cc PA.exe CRAccess                  5332  +18 TCRRecordSet.Fetch
Should add it does the same when attempting to use a Docker 2017 image..
ClientVersion=7.3

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: prDirect Access violations

Post by Stellar » Fri 03 Dec 2021 09:35

HI,
Thanks for your request.

To investigate this behavior of UniDAC, please compose a small sample demonstrating the issue and send it to us, including database objects creating scripts.
You can send the sample using the contact form at our site: devart.com/company/contactform.html

Best regards,
Sergey,

FredS
Posts: 272
Joined: Mon 10 Nov 2014 17:52

Re: prDirect Access violations

Post by FredS » Fri 03 Dec 2021 15:08

To investigate this behavior of UniDAC, please compose a small sample demonstrating the issue and send it to us,
You're joking right?

Are you telling me that I should simply be able to switch to prDirect and all should work?
Although your documentation suggests that my research on your forums shows that this hasn't been the case in the past..

Plus one would have to ask what are you guys testing against when you send out an Enum error like the overnight v9.0.1 (19-Nov-2021)..

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: prDirect Access violations

Post by Stellar » Tue 14 Dec 2021 14:35

Hi Fred!

I am sorry, but the information you provided is insufficient for us to reproduce and investigate the issue properly.

Unfortunately, we cannot rely solely on the issue description. To investigate it carefully, we need a stable sample, including scripts for creating database objects.

Please, provide the needed, so that we could continue the process!

Best regards,
Sergey

FredS
Posts: 272
Joined: Mon 10 Nov 2014 17:52

Re: prDirect Access violations

Post by FredS » Tue 14 Dec 2021 19:57

I did get this to work for me by commenting out stuff till it finally worked.

It came down to three lookups that are opened in individual threads since they can take a while to load.
It is simple enough to bypass this for prDirect.. not sure if its worth my time to try and solve this..

They each have these options set and Error when a record is added (DataSet.AppendRecord):

Code: Select all

    SpecificOptions.Values['FetchAll']  := True.ToString; // do not localize
    Connection.Options.AllowImplicitConnect := True;
    Connection.Options.DisconnectedMode := True;
    Connection.DefaultTransaction.ReadOnly := True;
    CachedUpdates := True;
    LocalUpdate := True;   
With an Access Violation here:

Code: Select all

procedure TTDSCommand.OQCCOCCCQ0;
begin
TTDSConnector(FConnection.GetConnector).ReleaseConnectionSwap;
end; 

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: prDirect Access violations

Post by Stellar » Fri 24 Dec 2021 13:12

Hi there!

Please clarify, do you use your own TUniConnection connection object in each thread or you are passing the TUniConnection object from the main thread to each of the threads?

Best regards,
Sergey

FredS
Posts: 272
Joined: Mon 10 Nov 2014 17:52

Re: prDirect Access violations

Post by FredS » Fri 24 Dec 2021 18:25

TUniConnections are cloned for each thread.

Mainly a new one is created and the connectstring is assigned.
In a few the Macros are also assigned for Unified SQL..

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: prDirect Access violations

Post by Stellar » Thu 10 Mar 2022 09:02

Hi!

Ok, please specify how do you clone the connection (give an example code)?

Best regards,
Sergey

FredS
Posts: 272
Joined: Mon 10 Nov 2014 17:52

Re: prDirect Access violations

Post by FredS » Sat 12 Mar 2022 15:18

The Clone is created in the Main Thread then passed to the Worker Thread:

Code: Select all

function TUniConnectionHelper.CloneConnection(AOwner: TComponent; const AOptions: TCloneOptions): TUniConnection;
begin
  Result := TUniConnection.Create(AOwner);
  Result.ConnectString := ConnectString;
  Result.Options.DefaultSortType := Options.DefaultSortType;
  if cdMacros in AOptions then Result.Macros.Assign(Macros);
  if (cdLocalFailover in AOptions) then Result.Options.LocalFailover := Options.LocalFailover;
  {- Add Connection Specific Information }
  case DbProvider of
    dbSQLServer: Result.SpecificOptions.Values['SQL Server.ConnectionTimeout'] := SpecificOptions.Values['SQL Server.ConnectionTimeout'];
  end;
end;

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

Re: prDirect Access violations

Post by Stellar » Fri 18 Mar 2022 13:06

Hey,
Thanks.

Please clarify if the datasets are associated with visual components that use connections performed in separate threads.

Best regards,
Sergey

FredS
Posts: 272
Joined: Mon 10 Nov 2014 17:52

Re: prDirect Access violations

Post by FredS » Sun 20 Mar 2022 20:19

> clarify if the datasets are associated with visual components

Now this gets complicated because this is from November and I'm no longer working on this project.

None are associated with a visual component at the time of the crash.. a TDatasource does get assigned but not until after.

- connection if cloned
- a dataset on a data module is assigned to the connection
- the event of the crash is manually triggered from the thread
- the data module is however created in the main thread yet not accessed by visual controls at least not at the time of the crash

Post Reply