[fdo-users] .net Wrapper quirks

Jackie C. Ng jumpinjackie at gmail.com
Sun Nov 2 02:28:53 EST 2008


Hi Traian,

This behaviour could only be observed on the OGR provider. Other providers
work fine.

- Jackie


Traian Stanev wrote:
> 
> 
> Hi Jackie,
> 
> The OGR provider has a weird implementation of the FDO refcounting. If the
> connection gets destroyed while you still hold on to certain objects that
> were owned by the connection, things go south. The refcounting in FDO has
> changed after I wrote this code, and I could probably reimplement the OGR
> connection using a safer approach as long as you are sure that it is only
> the OGR provider that fails -- does your code work for other providers?
> 
> 
> Traian
> 
> 
>> -----Original Message-----
>> From: fdo-users-bounces at lists.osgeo.org [mailto:fdo-users-
>> bounces at lists.osgeo.org] On Behalf Of Jackie C. Ng
>> Sent: Saturday, November 01, 2008 1:45 AM
>> To: fdo-users at lists.osgeo.org
>> Subject: RE: [fdo-users] .net Wrapper quirks
>>
>>
>> I'll cite a more concrete example:
>>
>> http://code.google.com/p/fdotoolbox/source/browse/sandbox/FdoToolbox.Li
>> b/Controls/GenericSpatialConnectCtl.cs#220
>>
>> This code builds the grid cells to allow you to enter the connection
>> properties. Using the latest FDO trunk, if the provider is OGR, then
>> once
>> the method has completed, the application will die (with
>> System.AccessViolation) if you switch (alt-tab) to another application
>> and
>> back in.
>>
>> With pdbs, the error message becomes:
>>
>> Unhandled exception at 0x0522f116 in FdoToolbox.exe: 0xC0000005: Access
>> violation reading location 0xfeeefefa.
>>
>> With the point of failure being at:
>> OSGeo::FDO::Connections::IConnectionPropertyDictionaryImp::ReleaseUnman
>> agedObject()
>>
>> Now if I were to disable the using block on the connection that gets
>> created
>> (ie. Don't Dispose() the connection), I no longer get this access
>> violation!
>>
>> Hence the Dispose() or no? question. I am confused.
>>
>> - Jackie
>>
>>
>> Donald Cameron wrote:
>> >
>> > I find my code throws exceptions on termination if I don't dispose of
>> any
>> > readers I have created during its execution.
>> >
>> > Don
>> >
>> > -----Original Message-----
>> > From: fdo-users-bounces at lists.osgeo.org
>> > [mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of Jackie C. Ng
>> > Sent: Friday, October 31, 2008 8:56 AM
>> > To: fdo-users at lists.osgeo.org
>> > Subject: RE: [fdo-users] .net Wrapper quirks
>> >
>> >
>> > Sorry to necro this discussion but it seems the dreaded
>> > System.AccessViolationException has reared its ugly head again in my
>> > testing
>> > of FDO Toolbox with the PostGIS and OGR providers (I'm testing on the
>> > trunk
>> > build of FDO). I guess I need clarification on the following matters:
>> >
>> > 1 - Dispose() or no? Should I just be letting the GC do its job.
>> Could I
>> > be
>> > screwing up reference counts by Disposing objects myself, thus
>> possibly
>> > causing these errors?
>> >
>> > 2 - The devguide states that method chaining is bad. Does this still
>> apply
>> > with the managed wrappers?
>> >
>> > - Jackie
>> >
>> >
>> > gregboone wrote:
>> >>
>> >> This is the primary cause of the defect as it results in an
>> excessive
>> >> number of SQLite resources being instantiated and used before enough
>> >> resources are freed by the garbage collector. As a work-around,
>> calling
>> >> Close()/Dispose() should resolve the issue. However, we will also
>> try and
>> >> make a fix in the SDF provider so that these steps are not
>> explicitly
>> >> necessary.
>> >>
>> >> One last point, you still should explicitly assign the result of
>> Execute
>> >> to a Feature Reader so that the garbage collection can happen at an
>> >> appropriate time.
>> >>
>> >> Greg
>> >>
>> >> -----Original Message-----
>> >> From: fdo-users-bounces at lists.osgeo.org
>> >> [mailto:fdo-users-bounces at lists.osgeo.org] On Behalf Of Jackie Ng
>> >> Sent: Friday, April 04, 2008 2:38 AM
>> >> To: fdo-users at lists.osgeo.org
>> >> Subject: Re: [fdo-users] .net Wrapper quirks
>> >>
>> >>
>> >> I just looked at the unit test code for the ticket, and noticed I
>> might
>> >> have
>> >> been doing something wrong.
>> >>
>> >> I forgot that IInsert::Execute() returns an IFeatureReader and so I
>> >> haven't
>> >> been closing and disposing them.
>> >>
>> >> One (of many?) possible cause(s)?
>> >>
>> >> - Jackie
>> >>
>> >>
>> >> Jackie Ng wrote:
>> >>>
>> >>> Hi All,
>> >>>
>> >>> I've been writing .net code that copies data from one FDO
>> connection to
>> >>> another (Doing a series of IInsert::Execute() calls from an
>> >>> IFeatureReader
>> >>> ). In my adventures using the FDO .net wrapper, I have encountered
>> the
>> >>> following problems at random:
>> >>>
>> >>> - System.AccessViolationExceptions ("Attempted to read or write
>> >>> protected
>> >>> memory. This is often an indication that other memory is corrupt")
>> >>> thrown
>> >>> at OSGeo.FDO.Runtime.Disposable.Finalize() (Target Site: void
>> >>> ReleaseUnmanagedObject() )
>> >>> - C++ pure virtual function call errors.
>> >>> - Memory allocation failed errors.
>> >>>
>> >>> Is there some quirks with the .net wrapper that I should be aware
>> of? As
>> >>> OSGeo.FDO.Runtime.Disposable implements IDisposable, I've been
>> wrapping
>> >>> nearly every FDO object used inside using() blocks. Could this be a
>> >>> cause?
>> >>>
>> >>> I am using .net wrappers for FDO 3.3.0
>> >>>
>> >>> - Jackie
>> >>>
>> >>>
>> >>>
>> >>
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/.net-Wrapper-quirks-
>> tp16318694s18162p16485877.html
>> >> Sent from the fdo-users mailing list archive at Nabble.com.
>> >>
>> >> _______________________________________________
>> >> fdo-users mailing list
>> >> fdo-users at lists.osgeo.org
>> >> http://lists.osgeo.org/mailman/listinfo/fdo-users
>> >> _______________________________________________
>> >> fdo-users mailing list
>> >> fdo-users at lists.osgeo.org
>> >> http://lists.osgeo.org/mailman/listinfo/fdo-users
>> >>
>> >>
>> >
>> >
>> > -----
>> > http://themapguyde.blogspot.com
>> >
>> > http://www.linkedin.com/in/jackieng
>> > --
>> > View this message in context:
>> > http://www.nabble.com/.net-Wrapper-quirks-tp16318694p20265376.html
>> > Sent from the FDO Users mailing list archive at Nabble.com.
>> >
>> > _______________________________________________
>> > fdo-users mailing list
>> > fdo-users at lists.osgeo.org
>> > http://lists.osgeo.org/mailman/listinfo/fdo-users
>> > _______________________________________________
>> > fdo-users mailing list
>> > fdo-users at lists.osgeo.org
>> > http://lists.osgeo.org/mailman/listinfo/fdo-users
>> >
>> >
>>
>>
>> -----
>> http://themapguyde.blogspot.com
>>
>> http://www.linkedin.com/in/jackieng
>> --
>> View this message in context: http://www.nabble.com/.net-Wrapper-
>> quirks-tp16318694p20277762.html
>> Sent from the FDO Users mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> fdo-users mailing list
>> fdo-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/fdo-users
> _______________________________________________
> fdo-users mailing list
> fdo-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/fdo-users
> 
> 


-----
http://themapguyde.blogspot.com

http://www.linkedin.com/in/jackieng
-- 
View this message in context: http://www.nabble.com/.net-Wrapper-quirks-tp16318694p20287614.html
Sent from the FDO Users mailing list archive at Nabble.com.



More information about the fdo-users mailing list