INN 2.5, inn-CURRENT-20090103 Issues

Julien ÉLIE julien at trigofacile.com
Sun Jan 18 13:46:50 UTC 2009


Hi William,

> Interesting, I just got another assertion failure BUT this time at a different line.  The one's I was getting before were at line 
> 1171 and I haven't seen anymore of those since Julien created the patch.  Now for the first time I got one at line 842.

It is *again* triggered by the same function:  hostSendArticle().
Well, let's check whether the connexion is null before calling
other functions.


> Jan 18 02:13:47 gondor innfeed[17396]: assertion -- cxn != NULL -- 
> failed in file connection.c line 842
>
> So In Host.c: $Id: host.c 8243 2008-12-21 11:50:47Z iulius $

The assertion is in connection.c, not host.c.
However, the corresponding function is called by host.c.


> This assertion seems like a rare occurrence so testing any patches might take some time.

No problem.
As far as I see in the rest of the code, connections is a NULL-terminated
array.  Therefore, host->connections[idx] can be NULL and it is never
checked here.  Strange...  I hope I am not missing something.

Anyway, here is a patch:

Index: host.c
===================================================================
--- host.c      (révision 8292)
+++ host.c      (copie de travail)
@@ -1717,7 +1717,7 @@
         unsigned int x_queue = host->params->maxChecks + 1 ;

         for (idx = 0 ; x_queue > 0 && idx < host->maxConnections ; idx++)
-          if ((cxn = host->connections[idx]) != host->notThisCxn) {
+          if ((cxn = host->connections[idx]) != host->notThisCxn && cxn != NULL) {
             if (!host->cxnActive [idx]) {
               if (!host->cxnSleeping [idx]) {
                 if (cxnTakeArticle (cxn, extraRef)) {
@@ -1752,7 +1752,7 @@
           {
             if (host->cxnActive [idx] &&
                 (cxn = host->connections[idx]) != host->notThisCxn &&
-                cxnTakeArticle (cxn, extraRef)) {
+                cxn != NULL && cxnTakeArticle (cxn, extraRef)) {
               unsigned int queue = host->params->maxChecks - cxnQueueSpace (cxn) - 1;
               if (queue == 0) host->gNoQueue++ ;
               else            host->gCxnQueue += queue ;
@@ -1763,7 +1763,7 @@
         /* Wasn't taken so try to give it to one of the waiting connections. */
         for (idx = 0 ; idx < host->maxConnections ; idx++)
           if (!host->cxnActive [idx] && !host->cxnSleeping [idx] &&
-              (cxn = host->connections[idx]) != host->notThisCxn)
+              (cxn = host->connections[idx]) != host->notThisCxn && cxn != NULL)
             {
               if (cxnTakeArticle (cxn, extraRef)) {
                 unsigned int queue = host->params->maxChecks - cxnQueueSpace (cxn) - 1;


-- 
Julien ÉLIE

« -- Du potage : c'est tout ce que le cuisinier a pu faire !
  -- Ce blocus devient très horripilant !
  -- Blocus, c'est ton cuisinier ? » (Astérix)




More information about the inn-workers mailing list