"invalid pointer operation" on changing SQL for 5th time

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
upscene
Posts: 306
Joined: Thu 19 Oct 2006 08:13

"invalid pointer operation" on changing SQL for 5th time

Post by upscene » Tue 28 Dec 2010 08:18

With 3.50.0.18 I get AVs as well.

I'm using a TIBCQuery that's reused during several INSERT operations, when blob columns are involved, I get an AV on the 5th time I'm changing SQL (edit, not on calling Prepare).

If I remove ANY of the INSERTs before the 5th, it works fine. If I put the last INSERT, which does not have a BLOB column on 4th place it fails too.

This is a serious problem for me.

The error is: " Invalid pointer operation "

---------------------------
Project ... raised exception class EAccessViolation with message 'Access violation at address 50006BF4 in module 'rtl120.bpl'. Read of address FFFFFFFD'.
---------------------------

Callstack:
kernerl32.RaiseException
Marshal.FreeHGlobal
TCRCommand.SetSQL + $55
TCustomDASQL.SetICommandSQL + $F7
TCustomDASQL.AssembleSQL + $1E
TCustomDASQL.ProcessSQLChanged + $CB
Last edited by upscene on Wed 29 Dec 2010 07:59, edited 1 time in total.

AndreyZ

Post by AndreyZ » Tue 28 Dec 2010 09:32

Hello,

I cannot reproduce the problem. Please try composing a small sample to demonstrate the problem and send it to andreyz*devart*com. Also please specify the following:
- the exact Firebird version you are using;
- the exact version of your IDE.

upscene
Posts: 306
Joined: Thu 19 Oct 2006 08:13

Post by upscene » Tue 28 Dec 2010 11:01

AndreyZ wrote:Hello,

I cannot reproduce the problem. Please try composing a small sample to demonstrate the problem and send it to andreyz*devart*com. Also please specify the following:
- the exact Firebird version you are using;
- the exact version of your IDE.
No offence, but what have you tried so far?

AndreyZ

Post by AndreyZ » Tue 28 Dec 2010 12:34

I've tried to execute many insert statements using one TIBCQuery component with and without blob columns. I used the Prepare method and changed the SQL code. There was no error.

upscene
Posts: 306
Joined: Thu 19 Oct 2006 08:13

Post by upscene » Tue 28 Dec 2010 12:55

What I have here, is a "datapump" tool.

It copies data from the source to the destination, different column types.

UseUnicode = True.

The data contains blobs in all 4 tables, the 5th table has no blobs.

I prepare the INSERT statement, loop over the source resultset, assign data and use parameterized LoadFromStream on a TByteStream for the blob data.

Now, even when commenting out the LoadFromStream on the blob parameter, I get the "invalid pointer operation" error, the values are not initialized (null) though.

The error happens not when calling .Prepare, but when setting SQL.Text (see the stack trace). I do not have the source, so I do not know what happens on TRCCommand.SetSQL and Marshal.FreeHGlobal.

If I remove the 4th table: still the error, removing the 1st, adding the 4th: no problem.

Now, if I remove SOME of the blob columns in the INSERT statements, the error re-appears. Each table, except for the 5th has 1 blob column, 1 table has 2 blob columns. Removing just one of that table doesn't matter.

Does this help?


Firebird 2.5
Delphi 2009

AndreyZ

Post by AndreyZ » Wed 29 Dec 2010 10:38

Unfortunately, I still canot reproduce the problem. Please try composing a small sample to demonstrate the problem and send it to andreyz*devart*com.

upscene
Posts: 306
Joined: Thu 19 Oct 2006 08:13

Post by upscene » Thu 06 Jan 2011 12:15

AndreyZ wrote:Unfortunately, I still canot reproduce the problem. Please try composing a small sample to demonstrate the problem and send it to andreyz*devart*com.
I'm trying to reproduce, but I cannot yet.

Can you post the code of the routines at this callstack:
Marshal.FreeHGlobal
TCRCommand.SetSQL + $55
TCustomDASQL.SetICommandSQL + $F7
TCustomDASQL.AssembleSQL + $1E
TCustomDASQL.ProcessSQLChanged + $CB

?

Perhaps that helps me.

AndreyZ

Post by AndreyZ » Thu 06 Jan 2011 13:28

This problem can be caused by incorrect working with memory. Please check that you correctly allocate memory for blob data and free it.

upscene
Posts: 306
Joined: Thu 19 Oct 2006 08:13

Post by upscene » Thu 06 Jan 2011 13:38

AndreyZ wrote:This problem can be caused by incorrect working with memory. Please check that you correctly allocate memory for blob data and free it.
I've commented out the BLOB transferring: still the same problem.

As I've said: when the BLOB columns are not part of the INSERT INTO statement, the error doesn't happen. When they ARE part of the statement, but no data is put into them, the error happens.

AndreyZ

Post by AndreyZ » Thu 06 Jan 2011 14:06

We will be able to help you when this error is reproducible. Only in this case we will be able to investigate it.

upscene
Posts: 306
Joined: Thu 19 Oct 2006 08:13

Post by upscene » Thu 06 Jan 2011 14:26

AndreyZ wrote:We will be able to help you when this error is reproducible. Only in this case we will be able to investigate it.
I understand, but up till now, I cannot reproduce it in a simpler application.

The application is built with packages, can you debug by using a package from Delphi?

AndreyZ

Post by AndreyZ » Mon 10 Jan 2011 12:18

I've tried to build the project with runtime packages. Still, there was no error.

upscene
Posts: 306
Joined: Thu 19 Oct 2006 08:13

Post by upscene » Mon 10 Jan 2011 12:51

As I said, I cannot reproduce it, but if I give you my application (which uses ibdac120.bpl) and the databases, can you debug it using a debug build of the package?

AndreyZ

Post by AndreyZ » Tue 11 Jan 2011 08:49

Ok, send your application and databases to andreyz*devart.com. Also specify the steps we should perform in your application to reproduce the problem.

upscene
Posts: 306
Joined: Thu 19 Oct 2006 08:13

Post by upscene » Tue 11 Jan 2011 09:28

AndreyZ wrote:Ok, send your application and databases to andreyz*devart.com. Also specify the steps we should perform in your application to reproduce the problem.
Just after I've sent you the instructions on how to do this with the full application, I was able to reproduce the problem in a sample application!

I've sent you the sample application as well. I noticed in the full application, that using .Params.Clear just before setting the SQL avoids the problem.

Please check to see where things go wrong.

Post Reply