summaryrefslogtreecommitdiff
path: root/src/include/connection.h
diff options
context:
space:
mode:
authorDon Anderson <dda@ddanderson.com>2013-11-18 13:29:15 -0500
committerDon Anderson <dda@ddanderson.com>2013-11-18 13:29:15 -0500
commit29aaec0c9f0af74ec28a06bc451d0958013e173f (patch)
tree3e77b84ef44a4f4812afda4d5ec566143e9fd637 /src/include/connection.h
parentb87a9ef10490756f8384f2c42cc3b604abd83678 (diff)
downloadmongo-29aaec0c9f0af74ec28a06bc451d0958013e173f.tar.gz
Null out closed handles in Java, and detect nulled handles on use. refs #485.
As reported in #485, when a conn/session is closed, any subordinate open cursors and sessions have dangling handles that refer to freed memory. But also, if a conn/session/cursor handle is closed, that handle may still be referenced in Java though it references freed memory. This commit uses the event handler for close calls to capture the first case, and makes explicit calls at the close site for the second case. For each case, a close will set the Java side 'swigCPtr' for each associated object being closed to 0. For detection, typemaps effectively check an arg's swigCPtr to see if the object has been previously closed. Special cases, like when a NULL handle is permitted in the API, are accounted for. Some details: - WT_HANDLE_NULLABLE() and WT_HANDLE_CLOSED() mark points in the API (wiredtiger.in) where handles may be used as null and where handles are closed. This are not exposed to doxygen. - lang_private fields have been added to WT_CONNECTION_IMPL, WT_SESSION_IMPL and WT_CURSOR to keep a handle to the associated java object, needed at the time of the close().
Diffstat (limited to 'src/include/connection.h')
-rw-r--r--src/include/connection.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/include/connection.h b/src/include/connection.h
index ecb366f41a4..1adf04bea44 100644
--- a/src/include/connection.h
+++ b/src/include/connection.h
@@ -211,6 +211,8 @@ struct __wt_connection_impl {
/* Locked: data source list */
TAILQ_HEAD(__wt_dsrc_qh, __wt_named_data_source) dsrcqh;
+ void *lang_private; /* Language specific private storage */
+
/* If non-zero, all buffers used for I/O will be aligned to this. */
size_t buffer_alignment;