Opened 20 years ago

Closed 18 years ago

#767 closed defect (fixed)

SDE improperly frees shared streams and connections

Reported by: hobu Owned by: hobu
Priority: high Milestone: 4.2 release
Component: MapServer C Library Version: 4.3
Severity: major Keywords:
Cc:

Description

In a long running Python MapScript process that I have, msSDELayerClose
sometimes causes a segfault when freeing up streams.  It appears to me to be
related to the shared connections. 

SE_stream objects must contain a pointer to their parent object.  If you try to
free a stream that has already had its connection object blasted away (because
it was a shared connection in another layer), you'll get a segfault.  

The semantics of this sharing method kind of sucks, because you have copies of
the layerinfo object floating around with references to their connections.  What
was happening is that one layer was freeing its connection, and then another
layer was coming along and trying to free an invalid connection.  There was a
trap to test whether or not the connection was NULL, which it never was, but it
was invalid and this caused the segfault.

I was able to provoke the SDE C API to check for an invalid connection handle by
asking it to free all of its locks (since we're only querying, we'll never have
any locks created).  If it is invalid, we don't attempt to free anything.  This
will still cause SDE streams to leak, I think.

I can't think of a better way to do the connection sharing than is currently
done.  One thing I think we'll need is a way for the shared layers to know about
each other and the state of the shared resources.

Change History (9)

comment:1 by hobu, 20 years ago

Resolution: fixed
Status: newclosed

comment:2 by hobu, 20 years ago

Milestone: 4.4 release

comment:3 by hobu, 20 years ago

blocked: 779

comment:4 by dmorissette, 20 years ago

Cc: steve.lime@… added
Howard, could you please indicate in which version this was fixed?  4.3 and/or 4.2? 

And if this was done only in 4.3 then is this bug important enough to backport
it to 4.2 before Steve does the 4.2.2 release?

comment:5 by dmorissette, 20 years ago

Cc: dmorissette@… added

comment:6 by hobu, 20 years ago

This bug was fixed in 4.3 (CVS).  It was a small fix that doesn't change any
functionality, and it would be a good candidate to be backported to 4.2.2.

comment:7 by hobu, 20 years ago

Milestone: 4.4 release4.2 release

comment:8 by hobu, 20 years ago

Resolution: fixed
Status: closedreopened

comment:9 by hobu, 18 years ago

Resolution: fixed
Status: reopenedclosed
This issue is completely gone now (I hope).
Note: See TracTickets for help on using tickets.