[ruby-oci8-commit] [432] trunk/ruby-oci8/ext/oci8: * NEWS: add changes between 2.0.5 and 2.0.6 .

nobody at rubyforge.org nobody at rubyforge.org
Tue Jun 14 07:42:39 EDT 2011


Revision: 432
Author:   kubo
Date:     2011-06-14 07:42:38 -0400 (Tue, 14 Jun 2011)

Log Message:
-----------
* NEWS: add changes between 2.0.5 and 2.0.6.
* ext/oci8/apiwrap.yml, ext/oci8/lob.c: fix SEGV when freeing a temporary
    LOB during GC on rubinius 1.2.3.
* ext/oci8/oci8lib.c: revert the exception type from RuntimeError to
    OCIException when a closed OCI handle's method is called.
    It was chaned in 2.0.5 by mistake.

Modified Paths:
--------------
    branches/ruby-oci8-2.0/ChangeLog
    branches/ruby-oci8-2.0/NEWS
    branches/ruby-oci8-2.0/VERSION
    branches/ruby-oci8-2.0/ext/oci8/apiwrap.yml
    branches/ruby-oci8-2.0/ext/oci8/lob.c
    branches/ruby-oci8-2.0/ext/oci8/oci8lib.c
    trunk/ruby-oci8/ChangeLog
    trunk/ruby-oci8/NEWS
    trunk/ruby-oci8/ext/oci8/apiwrap.yml
    trunk/ruby-oci8/ext/oci8/lob.c
    trunk/ruby-oci8/ext/oci8/oci8lib.c

Modified: branches/ruby-oci8-2.0/ChangeLog
===================================================================
--- branches/ruby-oci8-2.0/ChangeLog	2011-06-12 13:14:51 UTC (rev 431)
+++ branches/ruby-oci8-2.0/ChangeLog	2011-06-14 11:42:38 UTC (rev 432)
@@ -1,3 +1,12 @@
+2011-06-14  KUBO Takehiro  <kubo at jiubao.org>
+	* NEWS: add changes between 2.0.5 and 2.0.6.
+	* VERSION: change the version to 2.0.6.
+	* ext/oci8/apiwrap.yml, ext/oci8/lob.c: fix SEGV when freeing a temporary
+	    LOB during GC on rubinius 1.2.3.
+	* ext/oci8/oci8lib.c: revert the exception type from RuntimeError to
+	    OCIException when a closed OCI handle's method is called.
+	    It was chaned in 2.0.5 by mistake.
+
 2011-06-12  KUBO Takehiro  <kubo at jiubao.org>
 	* NEWS: add changes between 2.0.4 and 2.0.5.
 	* VERSION: change the version to 2.0.5.

Modified: branches/ruby-oci8-2.0/NEWS
===================================================================
--- branches/ruby-oci8-2.0/NEWS	2011-06-12 13:14:51 UTC (rev 431)
+++ branches/ruby-oci8-2.0/NEWS	2011-06-14 11:42:38 UTC (rev 432)
@@ -1,3 +1,13 @@
+2.0.6:
+
+* Fixed issues
+
+  - fix SEGV when freeing a temporary LOB during GC on rubinius 1.2.3.
+
+  - revert the exception type from RuntimeError to OCIException when
+    a closed OCI handle's method is called. It was chaned in 2.0.5
+    by mistake.
+
 2.0.5:
 
 * New Features

Modified: branches/ruby-oci8-2.0/VERSION
===================================================================
--- branches/ruby-oci8-2.0/VERSION	2011-06-12 13:14:51 UTC (rev 431)
+++ branches/ruby-oci8-2.0/VERSION	2011-06-14 11:42:38 UTC (rev 432)
@@ -1 +1 @@
-2.0.5
+2.0.6

Modified: branches/ruby-oci8-2.0/ext/oci8/apiwrap.yml
===================================================================
--- branches/ruby-oci8-2.0/ext/oci8/apiwrap.yml	2011-06-12 13:14:51 UTC (rev 431)
+++ branches/ruby-oci8-2.0/ext/oci8/apiwrap.yml	2011-06-14 11:42:38 UTC (rev 432)
@@ -1019,7 +1019,7 @@
             - OCIDuration duration
 
 # round trip: 1
-OCILobFreeTemporary_nb:
+OCILobFreeTemporary:
   :version: 810
   :args:
             - OCISvcCtx *svchp

Modified: branches/ruby-oci8-2.0/ext/oci8/lob.c
===================================================================
--- branches/ruby-oci8-2.0/ext/oci8/lob.c	2011-06-12 13:14:51 UTC (rev 431)
+++ branches/ruby-oci8-2.0/ext/oci8/lob.c	2011-06-14 11:42:38 UTC (rev 432)
@@ -23,6 +23,7 @@
 typedef struct {
     oci8_base_t base;
     VALUE svc;
+    OCISvcCtx *svchp;
     ub4 pos;
     int char_width;
     ub1 csfrm;
@@ -96,28 +97,20 @@
     rb_gc_mark(lob->svc);
 }
 
-static VALUE free_temp_lob(oci8_lob_t *lob)
-{
-    oci8_svcctx_t *svcctx = oci8_get_svcctx(lob->svc);
-
-    OCILobFreeTemporary_nb(svcctx, svcctx->base.hp.svc, oci8_errhp, lob->base.hp.lob);
-    return Qnil;
-}
-
 static void oci8_lob_free(oci8_base_t *base)
 {
     oci8_lob_t *lob = (oci8_lob_t *)base;
     boolean is_temporary;
 
-    if (have_OCILobIsTemporary
+    if (have_OCILobIsTemporary && lob->svchp != NULL
         && OCILobIsTemporary(oci8_envhp, oci8_errhp, lob->base.hp.lob, &is_temporary) == OCI_SUCCESS
         && is_temporary) {
-        /* Exceptions in free_temp_lob() are ignored.
-         * oci8_lob_free() is called in GC. It must not raise an exception.
-         */
-        rb_rescue(free_temp_lob, (VALUE)base, NULL, 0);
+
+        /* FIXME: This may stall the GC. */
+        OCILobFreeTemporary(lob->svchp, oci8_errhp, lob->base.hp.lob);
     }
     lob->svc = Qnil;
+    lob->svchp = NULL;
 }
 
 static oci8_base_class_t oci8_lob_class = {
@@ -191,6 +184,7 @@
         oci8_env_raise(oci8_envhp, rv);
     lob->base.type = OCI_DTYPE_LOB;
     lob->svc = svc;
+    lob->svchp = NULL;
     lob->pos = 0;
     lob->char_width = 1;
     lob->csfrm = csfrm;
@@ -202,6 +196,7 @@
             oci8_svcctx_t *svcctx = oci8_get_svcctx(svc);
             OCI8StringValue(val);
             oci_lc(OCILobCreateTemporary_nb(svcctx, svcctx->base.hp.svc, oci8_errhp, lob->base.hp.lob, 0, csfrm, lobtype, TRUE, OCI_DURATION_SESSION));
+            lob->svchp = oci8_get_oci_svcctx(svc);
             oci8_lob_write(self, val);
         } else {
             rb_raise(rb_eRuntimeError, "creating a temporary lob is not supported on this Oracle version");

Modified: branches/ruby-oci8-2.0/ext/oci8/oci8lib.c
===================================================================
--- branches/ruby-oci8-2.0/ext/oci8/oci8lib.c	2011-06-12 13:14:51 UTC (rev 431)
+++ branches/ruby-oci8-2.0/ext/oci8/oci8lib.c	2011-06-14 11:42:38 UTC (rev 432)
@@ -498,7 +498,7 @@
     }
     Data_Get_Struct(obj, oci8_base_t, hp);
     if (hp->type == 0) {
-        rb_raise(rb_eRuntimeError, "%s was already closed.",
+        rb_raise(eOCIException, "%s was already closed.",
                  rb_obj_classname(obj));
     }
     return hp;

Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog	2011-06-12 13:14:51 UTC (rev 431)
+++ trunk/ruby-oci8/ChangeLog	2011-06-14 11:42:38 UTC (rev 432)
@@ -1,3 +1,11 @@
+2011-06-14  KUBO Takehiro  <kubo at jiubao.org>
+	* NEWS: add changes between 2.0.5 and 2.0.6.
+	* ext/oci8/apiwrap.yml, ext/oci8/lob.c: fix SEGV when freeing a temporary
+	    LOB during GC on rubinius 1.2.3.
+	* ext/oci8/oci8lib.c: revert the exception type from RuntimeError to
+	    OCIException when a closed OCI handle's method is called.
+	    It was chaned in 2.0.5 by mistake.
+
 2011-06-12  KUBO Takehiro  <kubo at jiubao.org>
 	* NEWS: add changes between 2.0.4 and 2.0.5.
 

Modified: trunk/ruby-oci8/NEWS
===================================================================
--- trunk/ruby-oci8/NEWS	2011-06-12 13:14:51 UTC (rev 431)
+++ trunk/ruby-oci8/NEWS	2011-06-14 11:42:38 UTC (rev 432)
@@ -1,3 +1,13 @@
+2.0.6:
+
+* Fixed issues
+
+  - fix SEGV when freeing a temporary LOB during GC on rubinius 1.2.3.
+
+  - revert the exception type from RuntimeError to OCIException when
+    a closed OCI handle's method is called. It was chaned in 2.0.5
+    by mistake.
+
 2.0.5:
 
 * New Features

Modified: trunk/ruby-oci8/ext/oci8/apiwrap.yml
===================================================================
--- trunk/ruby-oci8/ext/oci8/apiwrap.yml	2011-06-12 13:14:51 UTC (rev 431)
+++ trunk/ruby-oci8/ext/oci8/apiwrap.yml	2011-06-14 11:42:38 UTC (rev 432)
@@ -1019,7 +1019,7 @@
             - OCIDuration duration
 
 # round trip: 1
-OCILobFreeTemporary_nb:
+OCILobFreeTemporary:
   :version: 810
   :args:
             - OCISvcCtx *svchp

Modified: trunk/ruby-oci8/ext/oci8/lob.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/lob.c	2011-06-12 13:14:51 UTC (rev 431)
+++ trunk/ruby-oci8/ext/oci8/lob.c	2011-06-14 11:42:38 UTC (rev 432)
@@ -23,6 +23,7 @@
 typedef struct {
     oci8_base_t base;
     VALUE svc;
+    OCISvcCtx *svchp;
     ub4 pos;
     int char_width;
     ub1 csfrm;
@@ -96,28 +97,20 @@
     rb_gc_mark(lob->svc);
 }
 
-static VALUE free_temp_lob(oci8_lob_t *lob)
-{
-    oci8_svcctx_t *svcctx = oci8_get_svcctx(lob->svc);
-
-    OCILobFreeTemporary_nb(svcctx, svcctx->base.hp.svc, oci8_errhp, lob->base.hp.lob);
-    return Qnil;
-}
-
 static void oci8_lob_free(oci8_base_t *base)
 {
     oci8_lob_t *lob = (oci8_lob_t *)base;
     boolean is_temporary;
 
-    if (have_OCILobIsTemporary
+    if (have_OCILobIsTemporary && lob->svchp != NULL
         && OCILobIsTemporary(oci8_envhp, oci8_errhp, lob->base.hp.lob, &is_temporary) == OCI_SUCCESS
         && is_temporary) {
-        /* Exceptions in free_temp_lob() are ignored.
-         * oci8_lob_free() is called in GC. It must not raise an exception.
-         */
-        rb_rescue(free_temp_lob, (VALUE)base, NULL, 0);
+
+        /* FIXME: This may stall the GC. */
+        OCILobFreeTemporary(lob->svchp, oci8_errhp, lob->base.hp.lob);
     }
     lob->svc = Qnil;
+    lob->svchp = NULL;
 }
 
 static oci8_base_class_t oci8_lob_class = {
@@ -191,6 +184,7 @@
         oci8_env_raise(oci8_envhp, rv);
     lob->base.type = OCI_DTYPE_LOB;
     lob->svc = svc;
+    lob->svchp = NULL;
     lob->pos = 0;
     lob->char_width = 1;
     lob->csfrm = csfrm;
@@ -202,6 +196,7 @@
             oci8_svcctx_t *svcctx = oci8_get_svcctx(svc);
             OCI8StringValue(val);
             oci_lc(OCILobCreateTemporary_nb(svcctx, svcctx->base.hp.svc, oci8_errhp, lob->base.hp.lob, 0, csfrm, lobtype, TRUE, OCI_DURATION_SESSION));
+            lob->svchp = oci8_get_oci_svcctx(svc);
             oci8_lob_write(self, val);
         } else {
             rb_raise(rb_eRuntimeError, "creating a temporary lob is not supported on this Oracle version");

Modified: trunk/ruby-oci8/ext/oci8/oci8lib.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/oci8lib.c	2011-06-12 13:14:51 UTC (rev 431)
+++ trunk/ruby-oci8/ext/oci8/oci8lib.c	2011-06-14 11:42:38 UTC (rev 432)
@@ -502,7 +502,7 @@
     }
     Data_Get_Struct(obj, oci8_base_t, hp);
     if (hp->type == 0) {
-        rb_raise(rb_eRuntimeError, "%s was already closed.",
+        rb_raise(eOCIException, "%s was already closed.",
                  rb_obj_classname(obj));
     }
     return hp;




More information about the ruby-oci8-commit mailing list