Page 1 of 2
"invalid pointer operation" on changing SQL for 5th time
Posted: Tue 28 Dec 2010 08:18
by upscene
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
Posted: Tue 28 Dec 2010 09:32
by AndreyZ
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.
Posted: Tue 28 Dec 2010 11:01
by upscene
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?
Posted: Tue 28 Dec 2010 12:34
by AndreyZ
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.
Posted: Tue 28 Dec 2010 12:55
by upscene
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
Posted: Wed 29 Dec 2010 10:38
by AndreyZ
Unfortunately, I still canot reproduce the problem. Please try composing a small sample to demonstrate the problem and send it to andreyz*devart*com.
Posted: Thu 06 Jan 2011 12:15
by upscene
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.
Posted: Thu 06 Jan 2011 13:28
by AndreyZ
This problem can be caused by incorrect working with memory. Please check that you correctly allocate memory for blob data and free it.
Posted: Thu 06 Jan 2011 13:38
by upscene
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.
Posted: Thu 06 Jan 2011 14:06
by AndreyZ
We will be able to help you when this error is reproducible. Only in this case we will be able to investigate it.
Posted: Thu 06 Jan 2011 14:26
by upscene
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?
Posted: Mon 10 Jan 2011 12:18
by AndreyZ
I've tried to build the project with runtime packages. Still, there was no error.
Posted: Mon 10 Jan 2011 12:51
by upscene
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?
Posted: Tue 11 Jan 2011 08:49
by AndreyZ
Ok, send your application and databases to andreyz*devart.com. Also specify the steps we should perform in your application to reproduce the problem.
Posted: Tue 11 Jan 2011 09:28
by upscene
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.