roxen.lists.pike.general

Subject Author Date
Re: Wow, Trace++ (Re: Identifier reference index 36 out of range 0..29) Stephen R. van den Berg <srb[at]cuci[dot]nl> 23-06-2009
Henrik Grubbstr?m wrote:
>On Mon, 22 Jun 2009, Stephen R. van den Berg wrote:
>>That's what I thought, though a casual inspection of the ALLOW() macros
>>in mysql.c doesn't reveal anything significant so far.

>My main suspect is pike_threadlib.h:SWAP_IN_THREAD_IF_REQUIRED(). Try 
>redefining it to:

>#define SWAP_IN_THREAD_IF_REQUIRED() ASSERT_THREAD_SWAPPED_IN()

>And see if anything bites.

>>Identifier reference index 36 out of range 0..29

I tried (to seemingly no avail, same error, same place):

diff --git a/src/modules/Mysql/mysql.c b/src/modules/Mysql/mysql.c
index 2a5ea2b..b8f7e03 100644
--- a/src/modules/Mysql/mysql.c
+++ b/src/modules/Mysql/mysql.c
@@ -902,7 +902,12 @@ static void low_query(INT32 args, char *name, int flags)
   if (mysql && tmp) {
     /* Check if we need to reconnect. */
 #if defined(CR_SERVER_GONE_ERROR) && defined(CR_UNKNOWN_ERROR)
-    int eno = mysql_errno(mysql);
+    int eno;
+
+    MYSQL_ALLOW();
+    eno = mysql_errno(mysql);
+    MYSQL_DISALLOW();
+
     if ((eno == CR_SERVER_GONE_ERROR) ||
        (eno == CR_UNKNOWN_ERROR)) {
       mysql = NULL;
diff --git a/src/pike_threadlib.h b/src/pike_threadlib.h
index 14e333b..45e51f6 100644
--- a/src/pike_threadlib.h
+++ b/src/pike_threadlib.h
@@ -937,6 +937,8 @@ PMOD_EXPORT extern int Pike_in_gc;
   HIDE_GLOBAL_VARIABLES();                                     \
   THREADS_DISALLOW()

+#define SWAP_IN_THREAD_IF_REQUIRED() ASSERT_THREAD_SWAPPED_IN()  /* yes */
+
 #endif /* !CONFIGURE_TEST */

 #endif /* PIKE_THREADS */

Yes, I verified that it reaches said codepath in redefining
SWAP_IN_THREAD_IF_REQUIRED.
-- 
Sincerely,
           Stephen R. van den Berg.
"There are 10 types of people in the world.
 Those who understand binary and those who do not."