🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
4 messages
4 total messages Started by Xavier Roche Thu, 09 Dec 2004 07:54
[INN] Bus error with 'ovmethod: ovdb' after a complete makehistory -O
#70420
Author: Xavier Roche
Date: Thu, 09 Dec 2004 07:54
48 lines
2946 bytes
Hi folks,

Does anyone experienced troubles using ovdb with "large" spools (ie. 
around 150 GB of text) while rebuilding the overview/history ?

With INN 2.4.1, and Berkeley DB 3.3.11 (running HP/alpha OSF1), a 
complete rebuild always lead to a crash (see below), probably at the end 
of the build (considering the number of lines in history)

$ bin/rc.news stop
$ rm -rf db/history*
$ rm -rf spool/overview/*
$ ovdb_init
..

$ time makehistory -O -s 146000000
makehistory: dbzstore duplicate message-id 
/usr/local/news/db/history:[659A1688BC8E5DDB18A9FB717FB37F8A]@4396390139 
Message too long
Bus error (core dumped)

real    2461m50.700s
user    331m9.091s
sys     1310m53.792s

[Note: The "Message too long" appeared long before the crash and does 
not seems to be related to it]

$ ls -l core
-rw-------   1 news     news     3374333952 Dec  8 03:32 core

$ file core
core:   core dump, generated from 'makehistory'

The machine has plenty of ram/swap (40GB) and nothing strange (apart 
from the crash) happened. I issued a second complete rebuild, with 
exactly the same result (and *exactly* same core sizes)

I know that ovdb is still a bit young ("Note that ovdb has not been as 
widely tested as the other overview mechanisms and should be considered 
experimental."), but were similar problems reported before ?

[ In the meantime, and following hints from a previous thread 
(<http://groups.google.com/groups?hl=fr&lr=&threadm=clks49%24k1m%241%40news.httrack.net&rnum=1&prev=/groups%3Fas_umsgid%3D%253Cclks49%2524k1m%25241%40news.httrack.net%253E%26lr%3D%26hl%3Dfr>), 
I started to rebuild a new overview using the tradindexed method to see 
if this problem is related to a specific storage issue or a more general 
problem. ]
Re: [INN] Bus error with 'ovmethod: ovdb' after a complete makehistory -O
#70421
Author: Jeffrey M. Vinocur
Date: Thu, 09 Dec 2004 09:39
22 lines
1606 bytes
In article <cp90co$69d$1@news.httrack.net>,
Xavier Roche  <xroche@free.fr.NOSPAM.invalid> wrote:
>
>$ ls -l core
>-rw-------   1 news     news     3374333952 Dec  8 03:32 core
>
>$ file core
>core:   core dump, generated from 'makehistory'

Huh, that seems a touch large, doesn't it.

I don't have much to suggest, except to run

    gdb ~news/bin/makehistory core
    
issue "backtrace" and see if it can give you any details about
the crash.


-- 
Jeffrey M. Vinocur
jeff@litech.org
Re: [INN] Bus error with timecaf_next() ?
#70422
Author: Xavier Roche
Date: Thu, 09 Dec 2004 10:25
180 lines
8008 bytes
Jeffrey M. Vinocur wrote:
> issue "backtrace" and see if it can give you any details about
> the crash.

It seems that something went wrong in the timecaf_next()/OpenArticle() 
function (BUS signal) but I can't yet find out what (the mmap'ed regions 
are not available after process dies - but the address seems okay 
AFAIKS). I am re-running another job, this time monitored by debugger 
and I will see exactly what happends (but this will take few days).
The ovdb code doesn't seems to be concerned -- I'll see it the crash 
happends again with tradindexed.


For information, the complete stack trace:

 >0  0x3ff8057d728 in __nxm_thread_kill(...) in /usr/shlib/libpthread.so
#1  0x3ff80576560 in pthread_kill(...) in /usr/shlib/libpthread.so
#2  0x3ff80581ae8 in UnknownProcedure2FromFile99(...) in 
/usr/shlib/libpthread.so
#3  0x3ff807e3aa0 in UnknownProcedure16FromFile0(...) in 
/usr/shlib/libexc.so
#4  0x3ff807e3e90 in exc_raise_signal_exception(...) in /usr/shlib/libexc.so
#5  0x3ff80578040 in UnknownProcedure282FromFile0(...) in 
/usr/shlib/libpthread.so
#6  0x3ff800d5170 in __sigtramp(...) in /usr/shlib/libc.so
#7  0x3ff800ebf8c in memchr(...) in /usr/shlib/libc.so
#8  0x1200437c0 in wire_findbody(article=0xc6e800=(null), length=16256) 
"wire.c":40
#9  0x12001fb20 in 
OpenArticle(path=0x140023d60="/usr/local/news/spool/articles/timecaf-00/a9/41d9.CF", 
artnum=23
, amount=RETR_HEAD) "timecaf/timecaf.c":500
#10 0x120020b70 in timecaf_next(article=0x140067440, amount=RETR_HEAD) 
"timecaf/timecaf.c":792
#11 0x1200147b8 in SMnext(article=0x140067440, amount=RETR_HEAD) 
"interface.c":764
#12 0x12000dcb0 in main(argc=0, argv=0x11fffc038) "makehistory.c":879
#13 0x12000ae18 in __start(...) in /udir/news/bin/makehistory

In inn-2.4.1/lib/wire.c:40 :

char *
wire_findbody(const char *article, size_t length)
{
..
         p = memchr(p, '\r', end - p - 3);
..

(ladebug) dump
 >8  0x1200437c0 in wire_findbody(article=0xc6e800=(null), length=16256) 
"wire.c":40
article=0xc6e800=(null)
end=0xc72780=(null)
length=16256
p=0xc6e800=(null)

The "article" argument points to a mmap'ed region which seems OK AFAIKS 
(no value, mmap'ed region is no more available as the process died):

(ladebug) p article
0xc6e800=(null)
(ladebug) p length
16256

And upper, in inn-2.4.1/storage/timecaf/timecaf.c:500 :

static ARTHANDLE *OpenArticle(const char *path, ARTNUM artnum, const 
RETRTYPE amount) {
..
     if ((p = wire_findbody(private->artdata, private->artlen)) == NULL) {

(ladebug) dump
 >9  0x12001fb20 in 
OpenArticle(path=0x140023d60="/usr/local/news/spool/articles/timecaf-00/a9/41d9.CF", 
artnum=23, amount=RETR_HEAD) "timecaf/timecaf.c":500
amount=RETR_HEAD
art=0x140067440
artnum=23
fd=51
len=16256
p=0x1=(null)
pagesize=8192
path=0x140023d60="/usr/local/news/spool/articles/timecaf-00/a9/41d9.CF"
private=0x140067500

(ladebug) p *private
struct {
   artdata = 0xc6e800=(null);
   mmapbase = 0xc6e000=(null);
   artlen = 16256;
   mmaplen = 18304;
   top = 0x0;
   sec = 0x0;
   ter = 0x0;
   topde = 0x0;
   secde = 0x0;
   terde = 0x0;
   curtoc = 0x0;
   curartnum = 0;
   curheader = struct _CAFHEADER {
     Magic = "CRMT";
     Low = 1;
     NumSlots = 262144;
     High = 33;
     Free = 2048;
     StartDataBlock = 8028672;
     BlockSize = 512;
     FreeZoneTabSize = 1737128;
     FreeZoneIndexSize = 424;
     LastCleaned = 536849136;
     spare = [0] = 0,[1] = 0,[2] = 0;
   };
}

The "artdata" is good AFAIKS, BUT memchr() crashed in the very begining 
of the function: (the * line)

(ladebug) memchr/100i
<opaque> memchr(...): DebugInformationStrippedFromFile156
  [0x3ff800ebf80]        and     r17, 0xff, r17
  [0x3ff800ebf84]        beq     r18, 0x3ff800ec078
  [0x3ff800ebf88]        sll     r17, 0x8, r3
*[0x3ff800ebf8c]        ldq_u   r1, 0(r16)
  [0x3ff800ebf90]        bis     r17, r3, r17
  [0x3ff800ebf94]        sll     r17, 0x10, r3
  [0x3ff800ebf98]        bis     r17, r3, r17
  [0x3ff800ebf9c]        sll     r17, 0x20, r3
  [0x3ff800ebfa0]        subq    r31, r16, r2
  [0x3ff800ebfa4]        and     r2, 0x7, r2
  [0x3ff800ebfa8]        bis     r17, r3, r17
  [0x3ff800ebfac]        bne     r2, 0x3ff800ec028
  [0x3ff800ebfb0]        subq    r18, 0x1, r4
  [0x3ff800ebfb4]        bic     r4, 0x7, r4
  [0x3ff800ebfb8]        subq    r18, r4, r18
  [0x3ff800ebfbc]        beq     r4, 0x3ff800ebfe0
  [0x3ff800ebfc0]        xor     r17, r1, r1
  [0x3ff800ebfc4]        subq    r4, 0x8, r4
  [0x3ff800ebfc8]        cmpbge  r31, r1, r1

As the r16 register points to 13035520 (== 0xC6E800 == article == 
private->artdata)

(ladebug) printregs
$r0  [$v0]  = 0                         $r1  [$t0]  = 0
$r2  [$t1]  = 0                         $r3  [$t2]  = 3328
$r4  [$t3]  = 16256                     $r5  [$t4]  = 0
$r6  [$t5]  = 1                         $r7  [$t6]  = 16256
$r8  [$t7]  = 0                         $r9  [$s0]  = 13051776
$r10 [$s1]  = 13035520                  $r11 [$s2]  = 5369132288
$r12 [$s3]  = 51                        $r13 [$s4]  = 1
$r14 [$s5]  = 2048                      $r15 [$s6]  = 0
$r16 [$a0]  = 13035520                  $r17 [$a1]  = 13
$r18 [$a2]  = 16253                     $r19 [$a3]  = 0
$r20 [$a4]  = 0                         $r21 [$a5]  = 8077312
$r22 [$t8]  = 0                         $r23 [$t9]  = 0
$r24 [$t10] = 0                         $r25 [$t11] = 0
$r26 [$ra]  = 4832114628                $r27 [$t12] = 4395899993984
$r28 [$at]  = 0                         $r29 [$gp]  = 5368794240
$r30 [$sp]  = 4831821232                $r31 [$zero]= 0
$f0         = 9.8813129168249309e-323   $f1         = 4099
$f2         = 0                         $f3         = 0
$f4         = 0                         $f5         = 0
$f6         = 0                         $f7         = 0
$f8         = 0                         $f9         = 0
$f10        = 100                       $f11        = 
9.8813129168249309e-323
$f12        = 3.4584595208887258e-323   $f13        = 100
$f14        = 3.4584595208887258e-323   $f15        = 100
$f16        = 0                         $f17        = 100
$f18        = 0                         $f19        = 100
$f20        = 50                        $f21        = 100
$f22        = 9.8813129168249309e-323   $f23        = 100
$f24        = 0                         $f25        = 50
$f26        = 0                         $f27        = 0
$f28        = 0                         $f29        = 0
$f30        = 0                         $f31        = 0
$pc         = 0x3ff800ebf8c             $ps         = 0x8
$fpcr       = 0x8900000000000000        $uniq       = 0x15087100
$vfp        = 0x11fffbdb0
Re: [INN] Found: OpenArticle/CAFOpenArtRead() lseek problem
#70427
Author: Xavier Roche
Date: Mon, 13 Dec 2004 13:26
30 lines
2516 bytes
Okay, I probably found the bug.

Scenario:
- inn.conf with 'articlemmap: true'
- a truncated .CF file somewhere

In OpenArticle()
timecaf.c:432 ->
	CAFOpenArtRead()
caf.c:592 ->
	lseek(fd, tocent.Offset, SEEK_SET)
	[ with an out-of-bound tocent.Offset (truncated file) ]
timecaf.c:463 ->
	mmap(NULL, private->mmaplen, PROT_READ, MAP_SHARED, fd, tmpoff)
	[ with an ot-of-bound file position ]

Unfortunately,
- lseek() successfully sets the pointer beyond the end of file (POSIX: 
"The lseek() function shall allow the file offset to be set beyond the 
end of the existing data in the file." - see 
<http://www.opengroup.org/onlinepubs/009695399/functions/lseek.html>)
- mmap returns a non-NULL pointer with an invalid mapped area, raising 
SIGBUS upon read inside the zone (POSIX: "References within the address 
range starting at pa and continuing for len bytes to whole pages 
following the end of an object shall result in delivery of a SIGBUS 
signal" - 
<http://www.opengroup.org/onlinepubs/009695399/functions/mmap.html>)

Hence, using 'articlemmap: true' is probably currently dangerous if you 
are recovering a damaged database with something like makehistory -O
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads