Concurrent Access to xml field

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
lbenini82
Posts: 2
Joined: Mon 03 Nov 2008 18:14

Concurrent Access to xml field

Post by lbenini82 » Mon 03 Nov 2008 18:51

Hi,
our team has encountered the following problem:
- Given a simple table with a single numerical id on Oracle 10g.
- Given two thread each owning his TOraSession and TOraQuery the following sql text (our resultset row count doesn't exceed 100 rows):

Code: Select all

 SELECT XMLFOREST(IJ.SIMPLE_ID)  XML_FIELD   
  FROM TEST_TABLE IJ ;
 
sometimes

Code: Select all

Next
invocation raise one of the following error:

- kgepop: no error frame to pop to for error 21500
- External exception EBAD53FC
- EAccessViolation in ... oraclient10.dll
- EAccessViolation in ... orageneric10.dll
The first of which is a blocking error and the message was visible only if "Generate console application" is checked.

A possible but not acceptable workaround consist in setting "FetchAll" to true in TOraquery and protect query Open with a global critical section.
Besides the obviuos problem coming from a "global critical section" this workaround reduce but *doesn't resolve* the problem.

Our Environment:
Odac Version 6.50.0.39
Oci Version 10
Oracle 10g
Delphi 2007

Some useful snippet to reproduce the bug

Thread Body

Code: Select all

procedure TTryThread.Execute;
var
  Fields: TFields;
  PacketOut: TMemoryStream;
  buf, zbuf: TMemoryStream;
begin
  inherited;
  while not terminated do
  begin
     OraQuery.Open;
    try
      PacketOut := TMemoryStream.Create;
      try
        if not OraQuery.Eof then
        begin
          Fields := OraQuery.Fields;
          buf := TMemoryStream.Create;
          zbuf := TMemoryStream.Create;
          try
            while not OraQuery.Eof do
            begin
              XmlSaveClob(OraQuery, 'xml_field', PacketOut, buf);
              OraQuery.Next;
              end;
          finally
            buf.Free;
            zbuf.Free;
          end;
        end;
        PacketOut.position := 0;
        PacketOut.size := 0;
      finally
        PacketOut.Free;
      end;
    finally
        OraQuery.Close;
    end;
  end;
end;
XmlSaveClob:

Code: Select all

procedure XmlSaveClob(aResultSet: TObject; aFieldName: string; aDst, aBuf: TMemoryStream);
var
  sz: cardinal;
  ws: WideString;
begin
  aBuf.Position := 0;
  aBuf.Size := 0;
  ws := TOraXMLField(TOraDataSet(aResultSet).FieldByName(aFieldName)).AsXML.asString;
  aBuf.WriteBuffer(ws[1], length(ws) * 2);
  sz := aBuf.Size + 22 {tag widestring};
  aDst.WriteBuffer(sz, 4);
  ws := widestring('');
  aDst.WriteBuffer(ws[1], length(ws) * 2);
  aBuf.Position := 0;
  adst.CopyFrom(aBuf, aBuf.size);
  ws := widestring('');
  aDst.WriteBuffer(ws[1], length(ws) * 2);
end;
Thanks all.

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

Post by Plash » Tue 04 Nov 2008 08:31

We could not reproduce the problem. Please send to odac*devart*com a complete small sample that demonstrates the problem, including the script for creating database objects.

lbenini82
Posts: 2
Joined: Mon 03 Nov 2008 18:14

Post by lbenini82 » Tue 04 Nov 2008 10:00

You can find a complete demo project for delphi 2007 at
http://rapidshare.com/files/160522169/OdacTest.zip.html
Inside beside complete source code there's a file dbscript.sql containing:
DDL for creating demo table
a pl/sql script for demo data generation.
Thanks.

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

Post by Plash » Thu 06 Nov 2008 10:18

This problem is caused by an Oracle bug. So we cannot resolve it in ODAC.

malikkhayat
Posts: 1
Joined: Wed 14 Oct 2009 11:05

What is the oracle bug

Post by malikkhayat » Wed 14 Oct 2009 11:12

Hi
We seem to be having the same issue. our log looks something like this

Code: Select all

% 000F70 11:54:44.156 ODS 10/14/2009 11:54:44 AM Client generated error External exception EBAD53FC - EExternalException [77E4BEF7]
- 001678 11:54:44.172 exit 00000001
! 001604 11:54:45.406 except event 0EEDFADE
can you please tell , what specific oracle bug is this, and what patch / version is required to fix this. is this bug in oracle client

any help will be highly appreciated

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

Post by Plash » Wed 21 Oct 2009 08:23

I think this bug exists in all versions of Oracle client. Try to read and write XMLTYPE values as CLOBs. Use the GETCLOBVAL method of XMLTYPE to read it as CLOB, and XMLTYPE constructor to write it as CLOB.

dimon_adv
Posts: 27
Joined: Mon 01 Feb 2010 09:36

Re: Concurrent Access to xml field

Post by dimon_adv » Thu 05 Nov 2015 08:58

Faced with a similar situation in the version of the 11R2 (ODAC 9.6.20, Delphi 2010, multithreaded app).
The error codes are the same, only the names of the DLL from the 11 version.
Which is a bug in the client oracle is the error ?
We have technical support from Oracle (and ODAC too) and we want to solve with its help, but it is necessary to refer to a specific error ID.
If this error Oracle, please specify its number, or a link to its description.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Concurrent Access to xml field

Post by AlexP » Thu 05 Nov 2015 12:02

Please send your sample to alexp*devart*com, we will check this behavior and inform you the result (whether it is a bug in ODAC or Oracle).

dimon_adv
Posts: 27
Joined: Mon 01 Feb 2010 09:36

Re: Concurrent Access to xml field

Post by dimon_adv » Thu 05 Nov 2015 12:40

In our application server this error raised very randomly but now i dont have 100% code reproducing bug.
In previouse posts user "lbenini82 » Вт 04 ноя 2008 10:00" already send example to your company, and
user "Plash » Чт 06 ноя 2008 10:18" says problem reproduced (may be him recorded in your bugtracking system example from user lbenini82) and addressed to Oracle bug. What number ???
Our application have some message at end production system, but ora dll from 11r2.
"External exception EBAD53FC" this text identical.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Concurrent Access to xml field

Post by AlexP » Thu 05 Nov 2015 16:29

Plash wrote on 06.11.2008 that the problem is not in ODAC, and since it occurred long ago and was not related to our products, there is no information about this issue remained. Therefore, in order for us to investigate the issue again, we need a sample.

dimon_adv
Posts: 27
Joined: Mon 01 Feb 2010 09:36

Re: Concurrent Access to xml field

Post by dimon_adv » Fri 06 Nov 2015 07:49

It is difficult to model, there are the conditions for the occurrence of threading, I will try to simulate an autonomous working example.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Concurrent Access to xml field

Post by AlexP » Mon 09 Nov 2015 10:00

As soon as you manage to compose a sample reproducing the described situation, please send it to us - we will continue the investigation.

Post Reply