Page 1 of 1

Concurrent Access to xml field

Posted: Mon 03 Nov 2008 18:51
by lbenini82
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.

Posted: Tue 04 Nov 2008 08:31
by Plash
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.

Posted: Tue 04 Nov 2008 10:00
by lbenini82
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.

Posted: Thu 06 Nov 2008 10:18
by Plash
This problem is caused by an Oracle bug. So we cannot resolve it in ODAC.

What is the oracle bug

Posted: Wed 14 Oct 2009 11:12
by malikkhayat
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

Posted: Wed 21 Oct 2009 08:23
by Plash
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.

Re: Concurrent Access to xml field

Posted: Thu 05 Nov 2015 08:58
by dimon_adv
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.

Re: Concurrent Access to xml field

Posted: Thu 05 Nov 2015 12:02
by AlexP
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).

Re: Concurrent Access to xml field

Posted: Thu 05 Nov 2015 12:40
by dimon_adv
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.

Re: Concurrent Access to xml field

Posted: Thu 05 Nov 2015 16:29
by AlexP
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.

Re: Concurrent Access to xml field

Posted: Fri 06 Nov 2015 07:49
by dimon_adv
It is difficult to model, there are the conditions for the occurrence of threading, I will try to simulate an autonomous working example.

Re: Concurrent Access to xml field

Posted: Mon 09 Nov 2015 10:00
by AlexP
As soon as you manage to compose a sample reproducing the described situation, please send it to us - we will continue the investigation.