stuck spinlock while initdb - Mailing list pgsql-bugs

From Super-User
Subject stuck spinlock while initdb
Date
Msg-id b041ee4d8005d5a756c21dd046ec6a55
Whole thread Raw
List pgsql-bugs
If PostgreSQL failed to compile on your computer or you found a bug that
is likely to be specific to one platform then please fill out this form
and e-mail it to pgsql-ports@postgresql.org.

To report any other bug, fill out the form below and e-mail it to
pgsql-bugs@postgresql.org.

If you not only found the problem but solved it and generated a patch
then e-mail it to pgsql-patches@postgresql.org instead.  Please use the
command "diff -c" to generate the patch.

You may also enter a bug report at http://www.postgresql.org/ instead of
e-mail-ing this form.

============================================================================
                        POSTGRESQL BUG REPORT TEMPLATE
============================================================================


Your name        : Helmut Lichtenberg
Your email address    : heli@tzv.fal.de


System Configuration
- ---------------------
  Architecture (example: Intel Pentium)      : 433 MHz Alpha PC164

  Operating System (example: Linux 2.0.26 ELF)     : Linux 2.0.36 RedHat 5.2 Alpha

  PostgreSQL version (example: PostgreSQL-6.4)  :   PostgreSQL-6.4

  Compiler used (example:  gcc 2.8.0)        : gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)


Please enter a FULL description of your problem:
- ------------------------------------------------

==============================================================================
postgres(forssa,pgsql): initdb

We are initializing the database system with username postgres (uid=411).
This user will own all the files and must also own the server process.

Creating template database in /usr/local/pgsql/data/base/template1

FATAL: s_lock(202bb6f0) at spin.c:114, stuck spinlock. Aborting.

FATAL: s_lock(202bb6f0) at spin.c:114, stuck spinlock. Aborting.
initdb: could not create template database
initdb: cleaning up by wiping out /usr/local/pgsql/data/base/template1
==============================================================================


Please describe a way to repeat the problem.   Please try to provide a
concise reproducible example, if at all possible:
- ----------------------------------------------------------------------

I compiled the sources (after applying the features patch) on this
platform. The error always appears while running initdb.

When I run 'make s_lock_test' in postgresql-v6.4/src/backend/storage/buffer
I get the following:

==============================================================================
root(forssa,buffer)# make s_lock_test
gcc -I../../../include -I../../../backend   -O2 -mieee  -Wall -Wmissing-prototypes -I../.. -DS_LOCK_TEST=1 s_lock.c -o
s_lock_test
s_lock.c: In function `s_lock_stuck':
s_lock.c:47: warning: cast from pointer to integer of different size
s_lock.c:50: warning: cast from pointer to integer of different size
s_lock.c: At top level:
s_lock.c:203: warning: return type of `main' is not `int'
./s_lock_test
S_LOCK_TEST: this will hang for a few minutes and then abort
             with a 'stuck spinlock' message if S_LOCK()
             and TAS() are working.

FATAL: s_lock(20101038) at s_lock.c:223, stuck spinlock. Aborting.

FATAL: s_lock(20101038) at s_lock.c:223, stuck spinlock. Aborting.
make: *** [s_lock_test] Aborted
make: *** Deleting file `s_lock_test'
==============================================================================

This takes about 40 seconds,

When I add the -S flag to target s_lock_test in the Makefile I get the
following results:
(Note: This does not make any sense to me but I read it in a mail from D.
Gould in the hackers mailing list when I searched for spinlock. :^)
==============================================================================
root(forssa,buffer)# !mak
make s_lock_test
gcc -I../../../include -I../../../backend   -O2 -mieee  -Wall -Wmissing-prototypes -I../.. -S -DS_LOCK_TEST=1 s_lock.c
-os_lock_test 
s_lock.c: In function `s_lock_stuck':
s_lock.c:47: warning: cast from pointer to integer of different size
s_lock.c:50: warning: cast from pointer to integer of different size
s_lock.c: At top level:
s_lock.c:203: warning: return type of `main' is not `int'
./s_lock_test
make: execvp: ./s_lock_test: Permission denied
make: *** [s_lock_test] Error 127

root(forssa,buffer)# cat s_lock_test
    .file    1 "s_lock.c"
    .set noat
    .set noreorder
    .globl s_spincycle
.data
    .align 2
    .type     s_spincycle,@object
    .size     s_spincycle,80
s_spincycle:
    .long 0
    .long 0
    .long 0
    .long 0
    .long 10000
    .long 0
    .long 0
    .long 0
    .long 10000
    .long 0
    .long 0
    .long 10000
    .long 0
    .long 0
    .long 10000
    .long 0
    .long 10000
    .long 0
    .long 10000
    .long 10000
.section    .rodata
$LC0:
    .ascii "\12FATAL: s_lock(%08x) at %s:%d, stuck spinlock. Abor"
    .ascii "ting.\12\0"
.text
    .align 5
    .ent s_lock_stuck
s_lock_stuck:
    .eflag 48
    .frame $30,48,$26,0
    .mask 0x4001e00,-48
    ldgp $29,0($27)
$s_lock_stuck..ng:
    subq $30,48,$30
    stq $10,16($30)
    stq $11,24($30)
    lda $10,$LC0
    addl $16,$31,$11
    stq $9,8($30)
    stq $12,32($30)
    bis $18,$18,$9
    bis $17,$17,$12
    lda $16,_IO_stderr_
    bis $10,$10,$17
    stq $26,0($30)
    .prologue 1
    bis $11,$11,$18
    bis $12,$12,$19
    bis $9,$9,$20
    jsr $26,fprintf
    ldgp $29,0($26)
    lda $16,_IO_stdout_
    bis $10,$10,$17
    bis $11,$11,$18
    bis $12,$12,$19
    bis $9,$9,$20
    jsr $26,fprintf
    ldgp $29,0($26)
    jsr $26,abort
    ldgp $29,0($26)
    .end s_lock_stuck
    .align 5
    .globl s_lock
    .ent s_lock
s_lock:
    .eflag 48
    .frame $30,80,$26,0
    .mask 0x4007e00,-80
    ldgp $29,0($27)
$s_lock..ng:
    subq $30,80,$30
    stq $14,48($30)
    lda $14,s_spincycle
    stq $9,8($30)
    stq $10,16($30)
    bis $31,$31,$9
    stq $11,24($30)
    bis $16,$16,$10
    stq $12,32($30)
    bis $18,$18,$11
    stq $13,40($30)
    bis $17,$17,$12
    stq $26,0($30)
    .prologue 1
    lda $13,10000
    br $31,$L19
    .align 4
$L21:
    lds $f10,0($1)
    stl $31,64($30)
    sts $f10,68($30)
    jsr $26,select
    ldgp $29,0($26)
    bis $10,$10,$16
    bis $12,$12,$17
    bis $11,$11,$18
    cmple $9,$13,$1
    bne $1,$L19
    bsr $26,$s_lock_stuck..ng
$L19:
    bis $9,$9,$3
        ldq   $0, 0($10)
                 bne   $0, 3f
                 ldq_l $0, 0($10)
                 bne   $0, 3f
                 or    $31, 1, $0
                 stq_c $0, 0($10)
                 beq   $0, 2f
                 bis   $31, $31, $5
                 mb
                 jmp   $31, 4f
              2: or    $31, 1, $0
              3: bis   $0, $0, $5
              4: nop
    s4addq $3,$3,$2
    s8addq $2,$3,$2
    s4addq $2,$2,$2
    s4subq $2,$3,$2
    s4addq $2,$3,$2
    sll $2,14,$1
    sra $3,31,$4
    subq $1,$2,$1
    s4addq $1,$3,$1
    s8subq $1,$3,$1
    sra $1,35,$1
    bis $31,$31,$16
    subq $1,$4,$1
    s4addl $1,$1,$1
    s4addq $1,0,$1
    subl $9,$1,$1
    s4addq $1,$14,$1
    bis $31,$31,$17
    bis $31,$31,$18
    bis $31,$31,$19
    addq $30,64,$20
    addl $9,1,$9
    addl $5,$31,$5
    bne $5,$L21
    ldq $26,0($30)
    ldq $9,8($30)
    ldq $10,16($30)
    ldq $11,24($30)
    ldq $12,32($30)
    ldq $13,40($30)
    ldq $14,48($30)
    addq $30,80,$30
    ret $31,($26),1
    .end s_lock
.section    .rodata
$LC1:
    .ascii "S_LOCK_TEST: failed, lock not initialized.\12\0"
$LC2:
    .ascii "s_lock.c\0"
$LC3:
    .ascii "S_LOCK_TEST: failed, lock not locked\12\0"
$LC4:
    .ascii "S_LOCK_TEST: this will hang for a few minutes and t"
    .ascii "hen abort\12\0"
$LC5:
    .ascii "             with a 'stuck spinlock' message if S_L"
    .ascii "OCK()\12\0"
$LC6:
    .ascii "             and TAS() are working.\12\0"
$LC7:
    .ascii "S_LOCK_TEST: failed, lock not locked~\12\0"
.text
    .align 5
    .globl main
    .ent main
main:
    .eflag 48
    .frame $30,16,$26,0
    .mask 0x4000200,-16
    ldgp $29,0($27)
$main..ng:
    subq $30,16,$30
    stq $26,0($30)
    stq $9,8($30)
    .prologue 1
    mb
    lda $9,test_lock
    stq $31,0($9)
    ldq $1,0($9)
    beq $1,$L26
    lda $16,$LC1
    jsr $26,printf
    ldgp $29,0($26)
    bis $31,1,$16
    jsr $26,exit
    ldgp $29,0($26)
$L26:
        ldq   $0, 0($9)
                 bne   $0, 3f
                 ldq_l $0, 0($9)
                 bne   $0, 3f
                 or    $31, 1, $0
                 stq_c $0, 0($9)
                 beq   $0, 2f
                 bis   $31, $31, $1
                 mb
                 jmp   $31, 4f
              2: or    $31, 1, $0
              3: bis   $0, $0, $1
              4: nop
    addl $1,$31,$1
    beq $1,$L28
    lda $17,$LC2
    bis $9,$9,$16
    bis $31,212,$18
    bsr $26,$s_lock..ng
    .align 4
$L28:
    ldq $1,0($9)
    bne $1,$L34
    lda $16,$LC3
    jsr $26,printf
    ldgp $29,0($26)
    bis $31,2,$16
    jsr $26,exit
    ldgp $29,0($26)
$L34:
    lda $16,$LC4
    jsr $26,printf
    ldgp $29,0($26)
    lda $16,$LC5
    jsr $26,printf
    ldgp $29,0($26)
    lda $16,$LC6
    jsr $26,printf
    ldgp $29,0($26)
    lda $17,$LC2
    bis $9,$9,$16
    bis $31,223,$18
    bsr $26,$s_lock..ng
    lda $16,$LC7
    jsr $26,printf
    ldgp $29,0($26)
    bis $31,3,$16
    jsr $26,exit
    ldgp $29,0($26)
    .end main
    .comm    test_lock,8,8
    .ident    "GCC: (GNU) egcs-2.91.60 19981201 (egcs-1.1.1 release)"
==============================================================================



If you know how this problem might be fixed, list the solution below:
- ---------------------------------------------------------------------

Sorry, I've no idea.
Maybe it is an Alpha-specific question as we run PostgreSQL 6.4 also on
Linux Intel.

TIA
Helmut

pgsql-bugs by date:

Previous
From: jwieck@debis.com (Jan Wieck)
Date:
Subject: Re: [HACKERS] Bug report: PL/pgSQL and mixed case table/field names.
Next
From: Jan Iven
Date:
Subject: Backend crash while accessing pg_user :-(