ORA-20004 Exception when inserting shape to database using st_geometry

10014
7
09-30-2013 05:25 AM
RatiMehrotra
New Contributor
Hi ,

I am working on an application where i am inserting the shape from text in the data base using st_geometry API. The functionality works fine for smaller length of the string(19358) , but for a large length like 131072, it fails with the error below :

Error Code is -20004 ORA-20004: Error generating shape from text: Memory allocation error ( ORA-20004: Error generating shape from text: Memory allocation error (-103).
ORA-06512: at "SDE.ST_GEOMETRY_SHAPELIB_PKG", line 12
ORA-06512: at "SDE.ST_GEOMFROMTEXT", line 61

The string is like "MULTIPOLYGON ((( -97.50560300 32.29941400, -97.50562700 32.29942700, -97.50566600 32.29942000, -97.50569100 32.29943300, -97.50567500 32.29945400, -97.50535800 32.29951200, -97.50534300 32.29953200, -97.50536700 32.29954500, -97.50540700 32.29953800, -97.50543100 32.29955100, -97.50541500 32.29957200, -97.50513800 32.29962300, -97.50512300 32.29964300, -97.50514700 32.29965600, -97.50518600 32.29964900, -97.50521100 32.29966200, -97.50519500 32.29968300, -97.50515600 32.29969000, -97.50514000 32.29971000, -97.50516400 32.29972300, -97.50520300 32.29971600, -97.50522800 32.29972900, -97.50521200 32.29975000, -97.50517300 32.29975700, -97.50515700 32.29977700, -97.50518100 32.29979000, -97.50522100 32.29978300, -97.50524500 32.29979600, -97.50522900 32.29981700, -97.50515000 32.29983200, -97.50513500 32.29985200, -97.50515900 32.29986500, -97.50523800 32.29985000, -97.50526200 32.29986400, -97.50524700 32.29988400, -97.50516700 32.29989900, -97.50515200 32.29991900, -97.50517600 32.29993200, -97.50527500 32.29991300, -97.50532200 32.30009800, -97.50537000 32.30012500, -97.50535400 32.30014600, -97.50527500 32.30016000, -97.50522900 32.30022100, -97.50525300 32.30023400, -97.50528400 32.30019300, -97.50538300 32.30017500, -97.50539600 32.30022600, -97.50533400 32.30030700, -97.50535800 32.30032000, -97.50539700 32.30031300, -97.50542200 32.30032600, -97.50540600 32.30034700, -97.50471400 32.30047500, -97.50469600 32.30040700, -97.50410400 32.30051600, -97.50412100 32.30058300, -97.50384400 32.30063400, -97.50386200 32.30070100, -97.50364300 32.30074200, -97.50362800 32.30076200, -97.50365200 32.30077400, -97.50377100 32.30075300, -97.50379500 32.30076600, -97.50377900 32.30078700, -97.50366100 32.30080900, -97.50364600 32.30082900, -97.50366900 32.30084200, -97.50378800 32.30082000, -97.50381200 32.30083300, -97.50379600 32.30085400, -97.50367800 32.30087600, -97.50366200 32.30089600, -97.50368600 32.30090900, -97.50376500 32.30089400, -97.50379000 32.30090800, -97.50377400 32.30092900, -97.50369500 32.30094300, -97.50368000 32.30096300, -97.50370300 32.30097600, -97.50378200 32.30096100, -97.50380700 32.30097500, -97.50379100 32.30099600, -97.50371200 32.30101000, -97.50369700 32.30103000, -97.50372000 32.30104300, -97.50380000 32.30102900, -97.50382400 32.30104200, -97.50379300 32.30108300, -97.50384100 32.30110900, -97.50381000 32.30115000, -97.50385800 32.30117600, -97.50388800 32.30129300, -97.50400700 32.30127200, -97.50403700 32.30139000, -97.50408500 32.30141600, -97.50409800 32.30146600, -97.50694400 32.30094300, -97.50650800 32.29923100, -97.50561800 32.29939400, -97.50560300 32.29941400),( -97.50584800 32.29940400, -97.50586400 32.29938300, -97.50588800 32.29939700, -97.50587300 32.29941800, -97.50584800 32.29940400),( -97.50573000 32.29942600, -97.50574500 32.29940500, -97.50577000 32.29941900, -97.50575400 32.29944000, -97.50573000 32.29942600),( -97.50547000 32.29954400, -97.50548500 32.29952300, -97.50551000 32.29953700, -97.50549400 32.29955800, -97.50547000 32.29954400)...."
Above is just a part of a very long string.
I tried using ST_GeomFromText (as found on some forum) , but got the same error.
The above string is generated using API SE_shape_as_text().
I am using ProC to insert the value in DataBase and am  creating a temporary CLOB . The CLOB object is filled with the value returned from  SE_shape_as_text() because direct insertion of a huge string will give Oracle errors for large string.

Kindly provide your inputs.

Regards.
0 Kudos
7 Replies
VinceAngelo
Esri Esteemed Contributor
The -103 error in the ArcSDE API is "SE_INVALID_STATS_TYPE", which doesn't
make any sense in this context, so I suspect something else is generating it.
Getting Tech Support involved is probably a good idea at this point.

Have you tried using SE_shape_as_WKB in a BLOB with sde.ST_POLYFROMWKB?
The BLOBs would be 1/2-1/3 the size of the CLOBs.

I'm curious why, if you already have these objects in ArcSDE, you need to use
Pro*C to put them into ST_GEOMETRY.  SE_stream_bind_input_column with
SE_stream_insert and SE_stream_execute hasn't ever given me an ORA-20004.

- V
0 Kudos
ForrestJones
Esri Contributor
Hi Rati,

The -103 error looks like it might map to the sql type out of memory error. This sounds like something we may have fixed already in 10.2.1. However, to know for sure we'd need to investigate further.  As Vince suggests, would you please contact tech support so we can check it out?

Thanks.
0 Kudos
MatjazHabic
New Contributor III
Hi
I also encountered this bug on Linux (RedHat) and Windows  on version ArcSDE 10.1 SP1.

As temporary alternate solution (I expected patch on 10.1 ) I use library from  version 10.0 SP5.

On version 9.2 sp 5 (IBM AIX and Windows) there is no problem with very large strings (over 350000 characters).

Regards

Matjaz
0 Kudos
RobertBätschmann
New Contributor
Hello,

We've just installed the new Version 10.2.1 of ArcGis. The GeoDatabase were upgraded, and the new st_geometry.dll file was deployed on our Oracle 11G Server.

Although those 2 related Bug are marked as solved in the release notes (NIM-091111 & NIM-093203), we still have the same Problem. And honnestly, I think it is now worse, because we get this error more often than before.

2 Exceptions are thrown alternatively when executing a stored procedure with big "Line String Z" geometries :

ORA-28579: network error during callback from external procedure agent
ORA-06512: at "SDE.ST_GEOMETRY_SHAPELIB_PKG", line 12
ORA-06512: at "SDE.ST_GEOMFROMTEXT", line 61
ORA-06512: at "M_LV.GEO_TEST", line 8
ORA-06512: at line 20

and

ORA-20004: Error generating shape from text: Memory allocation error (-103).
ORA-06512: at "SDE.ST_GEOMETRY_SHAPELIB_PKG", line 12
ORA-06512: at "SDE.ST_GEOMFROMTEXT", line 61
ORA-06512: at "M_LV.GEO_TEST", line 8
ORA-06512: at line 20


The Procedure is very simple, and the problem doesn't seem to be when insterting the geometry, but when using st_geomfromtext function :
CREATE OR REPLACE PROCEDURE GEO_TEST(wkt clob)
IS
    srid integer;
    geo1 sde.st_geometry;
begin
    select sde.st_geomfromtext(wkt, 21781) into geo1 from dual;
end;
/


Those errors occur only when executing 2-3 times this procedure successively. For exemple :
BEGIN
GEO_TEST(wkt1);
GEO_TEST(wkt2);
GEO_TEST(wkt3);
END;
=> Exception

But when executing every procedure call independently, the error does not occur :
Call 1 :
BEGIN GEO_TEST(wkt1); END;
=> Works

Call 2 :
BEGIN GEO_TEST(wkt2); END;
=> Works

Call 3 :
BEGIN GEO_TEST(wkt3); END;
=> Works

A sample file is joined to this message : GEO_TEST.zip

More inputs would be really appreciated, because this is now a very big problem for us.
We just can't insert new geometries in our application.

Thanks,
Guillaume.
0 Kudos
MatjazHabic
New Contributor III
Hi
I also encountered this bug on Linux (RedHat) and Windows  on version ArcSDE 10.1 SP1.

As temporary alternate solution (I expected patch on 10.1 ) I use library from  version 10.0 SP5.

On version 9.2 sp 5 (IBM AIX and Windows) there is no problem with very large strings (over 350000 characters).

Regards

Matjaz


This workaround produce new problem.
Now sde.st_interiorringn  function produce this error,

ORA-28579: network error during callback from external procedure agent
ORA-06512: at "SDE.ST_GEOMETRY_SHAPELIB_PKG", line 325
ORA-06512: at "SDE.ST_GEOMETRY_OPERATORS", line 1914


We tried to install new library (10.2.1) but the same problem with st_interiorringn occurs.

Testcase for st_interiorringn error on library (libst_shapelib.so) version 10.0 SP5

set serveroutput on;
declare
 wkt clob := 'POLYGON  (( 7589076.32000000 4639013.97000000, 7589053.44000000 4638981.25000000, 7589036.37000000 4638960.17000000, 7589029.93000000 4638891.70000000, 7588997.08000000 4638895.02000000, 7588995.90000000 4638882.02000000, 7588980.43000000 4638851.96000000, 7588982.13000000 4638825.12000000, 7588953.53000000 4638800.16000000, 7588940.44000000 4638757.77000000, 7588922.39000000 4638773.94000000, 7588903.00000000 4638759.04000000, 7588901.46000000 4638747.12000000, 7588909.22000000 4638746.86000000, 7588918.95000000 4638703.71000000, 7588914.68000000 4638682.78000000, 7588922.18000000 4638644.07000000, 7588929.20000000 4638607.70000000, 7588935.01000000 4638595.19000000, 7588934.37000000 4638592.15000000, 7588971.30000000 4638582.34000000, 7588999.41000000 4638573.30000000, 7589008.40000000 4638567.38000000, 7589037.75000000 4638543.79000000, 7589064.70000000 4638521.16000000, 7589089.94000000 4638503.03000000, 7589102.48000000 4638495.91000000, 7589116.68000000 4638492.84000000, 7589136.88000000 4638489.28000000, 7589164.91000000 4638484.37000000, 7589215.03000000 4638460.31000000, 7589226.42000000 4638457.63000000, 7589248.26000000 4638449.10000000, 7589264.00000000 4638437.64000000, 7589277.44000000 4638422.20000000, 7589291.81000000 4638399.27000000, 7589268.88000000 4638377.52000000, 7589250.43000000 4638360.55000000, 7589257.21000000 4638338.63000000, 7589259.27000000 4638331.30000000, 7589278.38000000 4638287.11000000, 7589291.19000000 4638267.75000000, 7589301.22000000 4638248.88000000, 7589325.26000000 4638218.81000000, 7589373.09000000 4638258.92000000, 7589384.57000000 4638270.05000000, 7589405.45000000 4638241.14000000, 7589438.24000000 4638194.01000000, 7589433.03000000 4638182.31000000, 7589437.00000000 4638175.51000000, 7589452.26000000 4638196.43000000, 7589464.63000000 4638180.98000000, 7589484.09000000 4638140.65000000, 7589488.85000000 4638125.49000000, 7589492.48000000 4638115.51000000, 7589499.08000000 4638106.11000000, 7589502.05000000 4638066.76000000, 7589501.89000000 4638049.39000000, 7589499.11000000 4638033.69000000, 7589523.88000000 4638029.38000000, 7589542.03000000 4638030.12000000, 7589580.38000000 4638039.36000000, 7589618.61000000 4638050.63000000, 7589656.33000000 4638061.05000000,'||
 ' 7589666.59000000 4638065.03000000, 7589702.05000000 4638075.07000000, 7589762.58000000 4638098.22000000, 7589789.08000000 4638111.09000000, 7589803.99000000 4638120.17000000, 7589813.56000000 4638123.60000000, 7589850.45000000 4638137.14000000, 7589896.89000000 4638148.10000000, 7589900.41000000 4638158.75000000, 7589902.36000000 4638184.90000000, 7589909.90000000 4638242.35000000, 7589909.54000000 4638280.87000000, 7589908.26000000 4638311.16000000, 7589907.27000000 4638326.30000000, 7589902.94000000 4638343.29000000, 7589898.17000000 4638350.92000000, 7589893.09000000 4638345.60000000, 7589873.38000000 4638332.32000000, 7589869.97000000 4638331.79000000, 7589857.02000000 4638359.91000000, 7589842.88000000 4638354.25000000, 7589820.55000000 4638397.16000000, 7589815.26000000 4638398.74000000, 7589806.33000000 4638419.24000000, 7589792.76000000 4638445.96000000, 7589789.98000000 4638451.31000000, 7589770.51000000 4638481.64000000, 7589751.04000000 4638502.50000000, 7589744.39000000 4638497.62000000, 7589737.78000000 4638492.14000000, 7589748.40000000 4638476.42000000, 7589758.47000000 4638461.79000000, 7589767.14000000 4638445.17000000, 7589773.98000000 4638435.48000000, 7589780.25000000 4638423.92000000, 7589786.38000000 4638405.96000000, 7589795.19000000 4638384.18000000, 7589782.31000000 4638381.87000000, 7589795.86000000 4638343.41000000, 7589811.11000000 4638302.32000000, 7589830.14000000 4638253.52000000, 7589830.53000000 4638243.62000000, 7589828.87000000 4638236.22000000, 7589826.70000000 4638231.38000000, 7589823.13000000 4638223.25000000, 7589813.37000000 4638204.43000000, 7589800.28000000 4638202.11000000, 7589784.24000000 4638199.94000000, 7589782.44000000 4638201.00000000, 7589773.06000000 4638198.15000000, 7589768.48000000 4638197.53000000, 7589750.32000000 4638190.40000000, 7589746.23000000 4638225.98000000, 7589739.65000000 4638250.36000000, 7589730.86000000 4638276.84000000, 7589716.14000000 4638306.16000000, 7589698.39000000 4638335.72000000, 7589674.87000000 4638369.26000000, 7589651.24000000 4638403.48000000, 7589671.02000000 4638424.36000000, 7589699.55000000 4638402.20000000, 7589730.33000000 4638361.29000000, 7589744.21000000 4638369.42000000, 7589750.18000000 4638374.59000000,'||
 ' 7589763.47000000 4638376.85000000, 7589765.97000000 4638377.47000000, 7589759.35000000 4638401.85000000, 7589751.61000000 4638418.20000000, 7589736.64000000 4638446.70000000, 7589714.18000000 4638473.29000000, 7589678.48000000 4638500.28000000, 7589670.69000000 4638496.74000000, 7589643.24000000 4638520.82000000, 7589610.24000000 4638545.05000000, 7589570.66000000 4638571.76000000, 7589563.58000000 4638583.85000000, 7589560.40000000 4638584.13000000, 7589565.15000000 4638592.63000000, 7589552.39000000 4638581.26000000, 7589529.86000000 4638562.90000000, 7589522.57000000 4638559.29000000, 7589506.37000000 4638550.51000000, 7589494.28000000 4638565.06000000, 7589485.95000000 4638584.27000000, 7589533.64000000 4638614.64000000, 7589557.42000000 4638637.71000000, 7589570.94000000 4638623.25000000, 7589582.93000000 4638607.58000000, 7589607.46000000 4638622.27000000, 7589634.53000000 4638641.92000000, 7589627.05000000 4638653.16000000, 7589608.36000000 4638680.74000000, 7589647.38000000 4638699.24000000, 7589687.41000000 4638722.69000000, 7589660.92000000 4638755.38000000, 7589637.99000000 4638768.57000000, 7589621.16000000 4638773.54000000, 7589609.73000000 4638771.42000000, 7589608.95000000 4638784.95000000, 7589619.01000000 4638789.05000000, 7589655.37000000 4638780.51000000, 7589670.21000000 4638773.07000000, 7589684.62000000 4638762.41000000, 7589711.90000000 4638732.75000000, 7589738.35000000 4638703.21000000, 7589756.00000000 4638707.67000000, 7589764.77000000 4638711.06000000, 7589783.96000000 4638727.52000000, 7589805.35000000 4638736.50000000, 7589801.46000000 4638741.15000000, 7589769.16000000 4638776.32000000, 7589743.84000000 4638802.29000000, 7589730.79000000 4638810.15000000, 7589703.99000000 4638811.08000000, 7589686.91000000 4638808.44000000, 7589654.12000000 4638801.55000000, 7589640.58000000 4638799.92000000, 7589640.48000000 4638800.98000000, 7589621.88000000 4638798.95000000, 7589590.60000000 4638801.96000000, 7589552.93000000 4638806.13000000, 7589520.24000000 4638802.73000000, 7589495.06000000 4638801.05000000, 7589472.86000000 4638789.91000000, 7589454.29000000 4638784.71000000, 7589408.74000000 4638797.32000000, 7589368.15000000 4638808.44000000, 7589317.65000000 4638821.44000000,'||
 ' 7589284.27000000 4638827.51000000, 7589273.80000000 4638829.80000000, 7589228.57000000 4638841.69000000, 7589198.92000000 4638861.92000000, 7589158.21000000 4638897.77000000, 7589121.45000000 4638934.52000000, 7589097.74000000 4638964.37000000, 7589089.98000000 4638980.99000000, 7589080.88000000 4639003.42000000, 7589076.32000000 4639013.97000000),( 7589571.88000000 4638334.27000000, 7589590.12000000 4638358.15000000, 7589628.46000000 4638291.07000000, 7589663.80000000 4638213.62000000, 7589673.69000000 4638166.93000000, 7589653.87000000 4638162.45000000, 7589648.99000000 4638160.76000000, 7589639.50000000 4638199.20000000, 7589629.84000000 4638225.48000000, 7589606.42000000 4638273.79000000, 7589571.88000000 4638334.27000000),( 7589500.48000000 4638362.59000000, 7589505.53000000 4638382.09000000, 7589582.90000000 4638356.21000000, 7589572.23000000 4638340.20000000, 7589562.89000000 4638343.34000000, 7589500.48000000 4638362.59000000),( 7589507.61000000 4638169.42000000, 7589503.16000000 4638184.65000000, 7589498.35000000 4638194.38000000, 7589484.81000000 4638214.73000000, 7589476.18000000 4638224.82000000, 7589482.52000000 4638231.56000000, 7589502.41000000 4638210.07000000, 7589510.38000000 4638188.87000000, 7589511.74000000 4638175.26000000, 7589521.67000000 4638148.66000000, 7589527.61000000 4638115.46000000, 7589519.24000000 4638113.90000000, 7589513.90000000 4638113.67000000, 7589510.38000000 4638125.46000000, 7589508.16000000 4638136.60000000, 7589506.31000000 4638147.43000000, 7589511.37000000 4638156.40000000, 7589507.61000000 4638169.42000000),( 7589486.85000000 4638385.47000000, 7589501.75000000 4638382.78000000, 7589495.50000000 4638360.74000000, 7589482.05000000 4638362.00000000, 7589486.85000000 4638385.47000000))'; 

num_rings number;
geom1 sde.st_geometry;
begin
   select sde.st_geomfromtext(wkt, 0) into geom1 from dual;
   select sde.st_numinteriorring(sde.st_geomfromtext(wkt, 0)) into num_rings from dual;
   dbms_output.put_line(num_rings);
   select sde.st_interiorringn(sde.st_geomfromtext(wkt, 0),1) into geom1 from dual;
end;  
0 Kudos
JeffPace
MVP Regular Contributor

did you find a solution to this? we just ran into it.  Everything was fine at 10.0

At 10.2.2 we get this error on insert of st_geometry.  Tried the SR patch, no improvement

0 Kudos
JeffPace
MVP Regular Contributor

I also tried pointing back to the 10sp5 library (which worked) but that throws errors "could not retrieve error"

0 Kudos