NNTPC: One 'memory currupt' fixed + caching question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'm running 1.0.1 on a FreeBSD 2.2-BETA box. I had a lot of the 'No
child processes: Memory currupt' error messages, and I think I've
found the cause. Look at the stack backtrace from bad_mmalloc():

(gdb) where
#0  bad_mmalloc () at nntpcache.c:451
#1  0x15970 in checkhdr (mdp=0x23000, hdr=0x2cc80) at mmcheck.c:65
#2  0x159a1 in mfree_check (md=0x0, ptr=0x2cc88) at mmcheck.c:78
#3  0x1536c in mfree (md=0x0, ptr=0x2cc88) at mfree.c:227
#4  0x15399 in free (ptr=0x2cc88) at mfree.c:246
#5  0xe37f in hisGetDbz (msgid=0xefbfa609 "5cljh5$ldb@ifi.uio.no")
    at history.c:130
#6  0xfbec in DoIPC (fd=14) at ipc.c:166
#7  0x5201 in main (argc=2, argv=0xefbfd88c) at nntpcache.c:934

Looking at the DoIPC() routine, we see that it free()s the val
pointer returned from hisGetDbz(). But the pointer is a static in
hisGetDbz(), and is also free()d there at line 130 if non-NULL.

I made the following simple change:

*** ipc.c.orig	Sun Sep 15 12:29:02 1996
--- ipc.c	Thu Jan 30 12:27:01 1997
***************
*** 169,179 ****
  				*reply = IPC_KEY;
  				strcpy (reply + 1, val);
  				if ((cc = write (fd, reply, 1 + strlen (reply + 1) + 1)) <1)
- 				{
- 					free (val);
  					return FALSE;
- 				}
- 				free(val);
  			} else
  			{
  				*reply = IPC_GET_KEY_FAILED;
--- 169,175 ----

And after this change, it seems to run very nice and stable, without
the 'Memory currupt' problems.

Now for a question. If I access an article by article number within a
group, it is read from the upstream feed the first time, and returned
from the cache if I access the same article number again. On the other
hand, if I access the same article by message ID, it is read from the
upstream feed every time:

Jan 30 12:31:03 newscache ./nntpcached[4504]: sockets.c:366: <- article <rzq680fh1n1.fsf@djlvig.dl.ac.uk>
Jan 30 12:31:03 newscache ./nntpcached[4504]: sockets.c:402: => [doffen.uninett.no] article <rzq680fh1n1.fsf@djlvig.dl.ac.uk>
Jan 30 12:31:04 newscache ./nntpcached[4504]: article.c:187:File exists: unlinking pre-existing article comp/unix/bsd/freebsd/misc/38047
Jan 30 12:31:04 newscache ./nntpcached[4504]: article.c:247: adding <rzq680fh1n1.fsf@djlvig.dl.ac.uk>:doffen.uninett.no/comp/unix/bsd/freebsd/misc/3804 to cache.history (suceeded)
Jan 30 12:31:04 newscache ./nntpcached[4504]: article.c:264:File exists: unlinking pre-existing article link gnu/gcc/help/21095
Jan 30 12:31:04 newscache ./nntpcached[4504]: article.c:273: linked comp/unix/bsd/freebsd/misc/38047 -> gnu/gcc/help/21095

Jan 30 12:31:36 newscache ./nntpcached[4504]: sockets.c:366: <- article <rzq680fh1n1.fsf@djlvig.dl.ac.uk>
Jan 30 12:31:36 newscache ./nntpcached[4504]: sockets.c:402: => [doffen.uninett.no] article <rzq680fh1n1.fsf@djlvig.dl.ac.uk>
Jan 30 12:31:38 newscache ./nntpcached[4504]: article.c:187:File exists: unlinking pre-existing article comp/unix/bsd/freebsd/misc/38047
Jan 30 12:31:38 newscache ./nntpcached[4504]: article.c:247: adding <rzq680fh1n1.fsf@djlvig.dl.ac.uk>:doffen.uninett.no/comp/unix/bsd/freebsd/misc/3804 to cache.history (suceeded)
Jan 30 12:31:38 newscache ./nntpcached[4504]: article.c:264:File exists: unlinking pre-existing article link gnu/gcc/help/21095
Jan 30 12:31:38 newscache ./nntpcached[4504]: article.c:273: linked comp/unix/bsd/freebsd/misc/38047 -> gnu/gcc/help/21095

This shouldn't be happening, should it?

Steinar Haug, Nethelp consulting, sthaug@nethelp.no


[Index of Archives]     [Yosemite]     [Yosemite Campsites]     [Bugtraq]     [Linux]     [Trn]

Powered by Linux