Occasional AV or assert error related to XMLType

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
MarkF
Posts: 211
Joined: Thu 02 Mar 2006 14:55

Occasional AV or assert error related to XMLType

Post by MarkF » Sat 11 Jul 2009 19:40

I've been having an issue that only seems to happen with datasets containing XMLType data. The assert shows up as:

TFreedObject.Free RefCount = -2139062144 (C:\D7\Added\Odac\Lib\MemData.pas, line 7813)

It may only happen when the TOraQuery is in disconnected mode and is later freed. I'm using 6.80.0.48 with D2009, OCIUnicode on.

Is that enough to go on? I've been trying to create a repeatable test case, but haven't managed to yet.

Thanks for any suggestion!

-Mark

MarkF
Posts: 211
Joined: Thu 02 Mar 2006 14:55

Post by MarkF » Mon 13 Jul 2009 20:01

Here's an example of the problem using a static xmltype field. I also get the same error with SDO_Geometry (which also doesn't appear to work at all with disconnected mode so you need to free the query before reading the data again after disconnecting.) Basically if you just run a query, disconnect, and then free the query you should see the assert error.

Any comments greatly appreciated!

Code: Select all

procedure TForm1.FullTestButtonClick(Sender: TObject);
var
  OraSession: TOraSession;
  OraQuery: TOraQuery;
  sql: string;
  x: string;
  i: Integer;
begin
  Memo1.Lines.Clear;
  Screen.Cursor := crHourglass;

  OraCall.OCIUnicode := True;
  OraSession := TOraSession.Create(nil);
  OraSession.ConnectPrompt := False;
  OraSession.AutoCommit := False;
  OraSession.ThreadSafety := True;
  OraSession.Options.DisconnectedMode := False;
  OraSession.Options.UseUnicode := True;

  OraQuery := TOraQuery.Create(nil);
  OraQuery.Session := OraSession;
  OraQuery.Disconnected := True;

  OraSession.Username := 'scott';
  OraSession.Password := 'tiger';
  OraSession.Server := 'mfms3';
  OraSession.Connect;

  sql := 'select xmlelement("node", ''data'') "Test" from dual';
  Memo1.Lines.Add(sql);
  Memo1.Lines.Add('');

  OraQuery.SQL.Text := sql;
  OraQuery.Execute;
  Memo1.Lines.Add('First run through all records');
  while not OraQuery.eof do
  begin
    for i := 0 to OraQuery.FieldCount - 1 do
    begin
      x := OraQuery.Fields[i].AsString;
      Memo1.Lines.Add(x);
    end;
    OraQuery.Next;
  end;
  Memo1.Lines.Add('');

  OraSession.Disconnect;
  Memo1.Lines.Add('Disconnected');
  Memo1.Lines.Add('');

  OraQuery.First;
  Memo1.Lines.Add('Second run through all records after disconnect to see it it works.');
  while not OraQuery.eof do
  begin
    for i := 0 to OraQuery.FieldCount - 1 do
    begin
      x := OraQuery.Fields[i].AsString;
      Memo1.Lines.Add(x);
    end;
    OraQuery.Next;
  end;
  Memo1.Lines.Add('');

  // Will error on free with any XMLType query.
  OraQuery.Free;
  OraSession.Free;

  Screen.Cursor := crDefault;
end;

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Wed 15 Jul 2009 09:33

Currently the Disconnected property of TOraDataSet does not support OBJECT, TABLE, ARRAY, and XMLTYPE.

You can use the DisconnectedMode property of TOraSession to work with these types.

MarkF
Posts: 211
Joined: Thu 02 Mar 2006 14:55

Post by MarkF » Wed 15 Jul 2009 09:55

Unfortunately I can't use the TOraSession DisconnectedMode property as it is not threadsafe (http://www.devart.com/forums/viewtopic.php?t=14723).

Are there any plans to either make the TOraSession disconnected option threadsafe, or alternately to support all types in the dataset disconnected mode?

-Mark

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Thu 16 Jul 2009 08:29

We'll consider the possibility of supporting object types for the Disconnected property of dataset.

MarkF
Posts: 211
Joined: Thu 02 Mar 2006 14:55

Post by MarkF » Thu 16 Jul 2009 12:09

Thanks for considering that. Any efforts along those lines will be appreciated. I'll be happy to beta test. Perhaps this could be combined with a 'cacheall' option similar to the cacheblobs option.

-Mark

Post Reply