Mike Wade writes... >Aug 5 16:35:20 news1 nntpcache-client[28770]: sockets.c:446: <- ARTICLE >1740260Aug 5 16:35:20 news1 nntpcache-client[28770]: sockets.c:482: => >[library.airnews.net.] ARTICLE 1740260 >Aug 5 16:35:20 news1 nntpcache-client[28817]: sockets.c:345 failed >assertion: scfg >Aug 5 16:35:20 news1 nntpcache-client[28817]: nntpcache.c:281: SIGSEGV! > >Any ideas? Oh, this one was a hoary bitch. The key of course was the "impossible" null scfg (in the context of Cfget, it's always CurrentScfg (which is really Task->ti_CurrentScfg)). What was happening was the Task structure was getting reused by another process, because it had been erroneously freed by the master process. The other process starts scribbling on your Task variables, and blammo! This includes... A repeat of my article.c patches, in case there was some uh, 'ambiguity' about their value. According to my logs, you really want these. :) A patch to "assert" so that a failed assertion dies right away instead of later when you try to dereference whatever was supposed to be asserted as non-null. (optional, I just think it nicer to the databases) A couple places in ihave and group that were throwing the occasional SIGSEGV as well when attachserver failed. The actual fix to nntpcache.c. The first isn't what was causing the problem, but it's obviously wrong. The second is what was causing it, but I'm not so sure if something else needs to go in there (I added some addition debugging code to find out, and it appears the task_info_free does get called at the apropriate time in addition to the ifdef'd out call). So I'm about 80% sure this solution is OK. Please lemme know if this helps, OK? -a diff -c nntpcache-2.3.3b2/src/article.c nntpcache-2.3.3b2-local/src/article.c *** nntpcache-2.3.3b2/src/article.c Mon Aug 03 10:49:19 1998 --- nntpcache-2.3.3b2-local/src/article.c Wed Aug 05 14:08:27 1998 *************** *** 617,629 **** else sprintf (args, "body %d", artno); } ! Cemitrn (args); ! Cflush (); } } else /* not cached */ { ! Cemitrn (args); ! Cflush (); } if (fd<0) /* cache off or request not in cache */ { --- 623,645 ---- else sprintf (args, "body %d", artno); } ! if (Cemitrn (args) <= 0 || Cflush () != 0) { ! logd (("couldn't send command to host (down?)")); ! if (art_stack) ! strStackFree (art_stack); ! emitrn (NNTP_SERVERTEMPDOWN); ! return FALSE; ! } } } else /* not cached */ { ! if (Cemitrn (args) <= 0 || Cflush () != 0) { ! logd (("couldn't send command to host (down?)")); ! if (art_stack) ! strStackFree (art_stack); ! emitrn (NNTP_SERVERTEMPDOWN); ! return FALSE; ! } } if (fd<0) /* cache off or request not in cache */ { diff -c nntpcache-2.3.3b2/src/assert.h nntpcache-2.3.3b2-local/src/assert.h *** nntpcache-2.3.3b2/src/assert.h Wed Jul 29 08:14:29 1998 --- nntpcache-2.3.3b2-local/src/assert.h Thu Aug 06 20:01:02 1998 *************** *** 8,15 **** #define assert(x) \ do\ {\ ! if (!(x))\ syslog(LOG_ERR, "%s:%d failed assertion: %s\n", __FILE__, __LINE__, #x);\ } while (0) #endif /* ASSERT_H */ --- 8,17 ---- #define assert(x) \ do\ {\ ! if (!(x)){\ syslog(LOG_ERR, "%s:%d failed assertion: %s\n", __FILE__, __LINE__, #x);\ + ncExit(-1);\ + }\ } while (0) #endif /* ASSERT_H */ diff -c nntpcache-2.3.3b2/src/group.c nntpcache-2.3.3b2-local/src/group.c *** nntpcache-2.3.3b2/src/group.c Sun Aug 02 13:35:00 1998 --- nntpcache-2.3.3b2-local/src/group.c Thu Aug 06 12:17:03 1998 *************** *** 580,586 **** n->read_locks--; #endif } ! if (!(scfg=attachServer(scfg))) { scfg->share->listgroup_fail++; emitrn (NNTP_SERVERTEMPDOWN); --- 593,599 ---- n->read_locks--; #endif } ! if (!attachServer(scfg)) { scfg->share->listgroup_fail++; emitrn (NNTP_SERVERTEMPDOWN); diff -c nntpcache-2.3.3b2/src/ihave.c nntpcache-2.3.3b2-local/src/ihave.c *** nntpcache-2.3.3b2/src/ihave.c Sun Aug 02 13:35:00 1998 --- nntpcache-2.3.3b2-local/src/ihave.c Thu Aug 06 12:14:44 1998 *************** *** 38,44 **** logen (("bad IHAVE server '%s', check 'ihaveServers' configuration variable", sl->data)); continue; } ! if (!(scfg = attachServer(scfg))) { bad: scfg->share->ihave_fail++; --- 38,44 ---- logen (("bad IHAVE server '%s', check 'ihaveServers' configuration variable", sl->data)); continue; } ! if (!attachServer(scfg)) { bad: scfg->share->ihave_fail++; diff -c nntpcache-2.3.3b2/src/nntpcache.c nntpcache-2.3.3b2-local/src/nntpcache.c *** nntpcache-2.3.3b2/src/nntpcache.c Mon Aug 03 10:53:28 1998 --- nntpcache-2.3.3b2-local/src/nntpcache.c Fri Aug 07 03:08:57 1998 *************** *** 490,496 **** if (pid == -1) { loge (("couldn't fork()")); ! task_info_free(i[0]); if (client>=0) close (client); close (i[1]); --- 493,499 ---- if (pid == -1) { loge (("couldn't fork()")); ! task_info_free(task->ti_idx); /* -an */ if (client>=0) close (client); close (i[1]); *************** *** 1334,1340 **** --- 1372,1380 ---- close (n); if (n == high_fd) high_fd--; + #ifdef 0 task_info_free (n); + #endif } } }