SDE improperly frees shared streams and connections
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)
Resolution: |
→ fixed
|
Status: |
new → closed
|
Milestone: |
4.4 release → 4.2 release
|
Resolution: |
fixed
|
Status: |
closed → reopened
|
Resolution: |
→ fixed
|
Status: |
reopened → closed
|