ArcSDE C-API SE_stream_calculate_table_statistics() crash with Oracle

261
18
04-16-2014 07:38 AM
StephenBrockwell
New Contributor
I'm maintaing an ArcSDE client application which apparently was working with ArcSDE 9.1

Current configuration: ArcSDE 10.1 with Oracle 10.1, Win 7 x32/x64

Symptoms when calling SE_stream_calculate_table_statistics() with SE_DISTINCT_STATS as mask on a STRING property:

   1. crashes with SE_NET_FAILURE (-10)
   2. memory violation when using direct connect in sdeora11gsrvr101.dll
   3. Works fine with numerial properties (integer/double)
   4. Works fine with SqlServer with any property type (integer/double/string)

Note: 2) and 3) prove the code is correct.

Any information greatly appreciated. Thanks in advance.
0 Kudos
18 Replies
VinceAngelo
Esri Esteemed Contributor
Oracle 10gR1 is not supported with ArcGIS 10.1.  The library you mention only
works with Oracle 11g.  Can you please prove the exact Oracle release in
A.B.C.D.E notation?

Have you applied SP1 to 10.1, and applied the QIP on top of that?

- V
0 Kudos
StephenBrockwell
New Contributor
Thank you Vince for your fast response.

I double checked and the Oracle server is in fact 'Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production'.

This means there is no compatibility issue. As a matter of fact the application works very well except for this particular function. Is there an known bug? I have been looking around in vain for other users experiencing the same.

Thanks.
0 Kudos
VinceAngelo
Esri Esteemed Contributor
Have you applied SP1 to 10.1, and applied the QIP on top of that?

Not many folks use the 'C' API, and with Direct Connect, there is no
performance advantage to using SE_stream_calculate_table_statistics()
over a local query that does the same (though you'd have to write your
own distinct value generator from a stream with order_by set).

- V
0 Kudos
StephenBrockwell
New Contributor
I have applied SDE101sp1-CApiSDK.msp. No difference. What is a QIP?

Reimplementing this query is not an easy decision to make, unless I have an official answer this is an ArcSDE bug and there is no chance to be fixed soon.

Thanks.
0 Kudos
MarcoBoeringa
MVP Regular Contributor
I have applied SDE101sp1-CApiSDK.msp. No difference. What is a QIP?


Look here, it is a larger patch up on top of SP1, kind of like a mini "service pack":
ArcGIS 10.1 SP1 for (Desktop, Engine, Server) Quality Improvement Patch
0 Kudos
VinceAngelo
Esri Esteemed Contributor
Are you using wide strings (SE_WCHAR) or ANSI strings (CHAR)?  I'm trying
to reproduce your issue.

- V
0 Kudos
StephenBrockwell
New Contributor
Are you using wide strings (SE_WCHAR) or ANSI strings (CHAR)?  I'm trying
to reproduce your issue.

- V


The SE column type doesn't matter here since SE_stream_calculate_table_statistics() doesn't use it. Please see: 

http://edndoc.esri.com/arcsde/9.1/capi_functions/stream_query/se_strm_calculate_table_stats.htm

Based on the connection and the name of the property it allocates and populates the stats structure. Internally it gets the column type in order to allocate the appropriate amount of memory.

Thanks.
0 Kudos
VinceAngelo
Esri Esteemed Contributor
There are two ways to compile the 'C' API, one of which redefines all functions which take
string parameters to use ACHAR (char) and one which redefines all functions to use SE_WCHAR
(unsigned short) parameters.  There are different SE_stream_calculate_table_statistics
functions based on how you compile, and they return different structures (SE_DISTINCT vs
SE_DISTINCTW) with different member types (SE_VALUE vs SE_VALUEW).

Do you compile with SDE_UNICODE enabled (SE_WCHAR parameters) or not?

- V
0 Kudos
VinceAngelo
Esri Esteemed Contributor
At least the server code is consistent -- SE_DISTINCT_STATS computation on an
SE_NSTRING_TYPE column crashes both SE_stream_calculate_table_statistics
and SE_stream_calculate_table_statisticsW with 10.1 SP1 (no QIP).

It doesn't crash on 10.2.0, but it doesn't produce correct output either.

That leaves you with two options -- Using SE_STRING_TYPE columns (with
AL32UTF8 character set for international characters) or coding your own
distinct function for SE_NSTRING_TYPE cols. 

You should certainly contact Tech Support (and have them contact me for
sample code to demonstrate the problem).

- V
0 Kudos