Opened 16 years ago

Closed 12 years ago

#744 closed defect (fixed)

ERROR: Please try your operation later as the resource was busy

Reported by: ssalari Owned by:
Priority: medium Milestone:
Component: Feature Service Version: 2.0.2
Severity: trivial Keywords: FeatureSource, resource was busy
Cc: brucedechant External ID:

Description

Hi,

I use the following code at first step:

private void rollSelectedVertex(boolean forward, int fromIndex) throws MgException{
        int roll = (forward)?1:-1;
        String selectionXML =null;
       
        int count = -1;
        int rolledIndex = fromIndex+roll;
        MgSelection selection = new MgSelection();
       

        boolean isCyclicElement = false;
        MgFeatureReader getShapeVertexReader = featureService.SelectFeatures(showShapeIdentifier, showShapeIdentifier.GetName(), new MgFeatureQueryOptions());
        if(getShapeVertexReader.ReadNext()){
            String wkt = (String)valueStrategy.getPropertyValueFromReader(getShapeVertexReader,VertexManagerConfig.ShowShapeProperty.GEOM.GetName());
            isCyclicElement = (wkt.indexOf("POLYGON")!=-1);
        }
        SupportGWOS.ReleaseReader(getShapeVertexReader);
       
       
        MgFeatureReader moveSelectionVertexReaderCount = featureService.SelectFeatures (vertexIdentifier, layerBase.GetFeatureClassName(), new MgFeatureQueryOptions());
        while(moveSelectionVertexReaderCount.ReadNext()){
            count++;
        }
        SupportGWOS.ReleaseReader(moveSelectionVertexReaderCount);
       
       
       
        if((fromIndex+roll)>count){
            rolledIndex=0;
        } else if((fromIndex+roll)==count && isCyclicElement){
            rolledIndex = (forward)?1:count-1;
        } else if((fromIndex+roll)<0){
            rolledIndex = (isCyclicElement)?count-1:count;
        }
------------------------MAY BE CAUSE OF ERROR ------------------------------------     
        MgFeatureQueryOptions queryOptions = new MgFeatureQueryOptions();
        queryOptions.SetFilter(VertexManagerConfig.VertexProperty.ORDER_INDEX.GetName()+" = "+rolledIndex);
        MgFeatureReader moveSelectionVertexReaderNextTry = featureService.SelectFeatures (vertexIdentifier, layerBase.GetFeatureClassName(), queryOptions);
        SupportGWOS.ReleaseReader(moveSelectionVertexReaderNextTry);
    //CAUSE OF 'Please try your operation later as the resource was busy' selection.AddFeatures
        selection.AddFeatures(layerBase, moveSelectionVertexReaderNextTry, 0);
    
        selectionXML = selection.ToXml();
-----------------------END-OF MAY BE CAUSE OF ERROR --------------------------------
       
        vertexManagerForm.formConfig.saveMap();
        vertexManagerForm.setSelectionXML(selectionXML);
    }

then at the next request I execute the following function with the same arguments of previus request.

ClearDataSource(featureService, vertexIdentifier, vertexIdentifier.GetName());

public static void ClearDataSource(MgFeatureService featureSrvc, MgResourceIdentifier dataSourceId, String featureName)  throws MgException
    {
        MgDeleteFeatures deleteCmd = new MgDeleteFeatures(featureName, "ID >= 0");
        MgFeatureCommandCollection commands = new MgFeatureCommandCollection();
        commands.Add(deleteCmd);
        featureSrvc.UpdateFeatures(dataSourceId, commands, false);
    }

and obtain the following error:

Please try your operation later as the resource was busy: Session:18630e58-0000-1000-8000-00c09f25bfe0_en_C0A800C60AFC0AFB0AFA//VertexPropertyFeature.FeatureSource
org.osgeo.mapguide.MgResourceBusyException: Please try your operation later as the resource was busy: Session:18630e58-0000-1000-8000-00c09f25bfe0_en_C0A800C60AFC0AFB0AFA//VertexPropertyFeature.FeatureSource
    at org.osgeo.mapguide.MapGuideJavaApiJNI.MgFeatureService_UpdateFeatures(Native Method)
    at org.osgeo.mapguide.MgFeatureService.UpdateFeatures(MgFeatureService.java:98)
    at it.escsolution.gwos.util.SupportGWOS.ClearDataSource(SupportGWOS.java:153)
    at it.escsolution.gwos.struts.action.VertexManagerAction.clearVertexes(VertexManagerAction.java:69)

How can I close the feature reader without obtain the error on next request?

Thanks.

Change History (3)

comment:1 by tomfukushima, 16 years ago

Cc: brucedechant added
Milestone: 2.1

I've seen this too. I've been told that it is a timing issue. I could produce it by requesting the attributes on a feature via a feature reader and then deleting it right after that.

comment:2 by jbirch, 15 years ago

Please re-test against 2.1 and let us know if this is still an issue (or close if has been fixed). Will close this ticket if no response by next ticket cleanup cycle.

comment:3 by jng, 12 years ago

Resolution: fixed
Status: newclosed

I'm gonna go with the assumption here that it's due to the hardcore memory leaks present before the 2.4 release that would've meant things that could lock feature sources like feature readers we're being deleted on garbage collection (hence not properly closed, causing resource busy errors).

Note: See TracTickets for help on using tickets.