[erlang-bugs] Floating point exception (core dumped) in beam

Maximillian Dornseif md@REDACTED
Sun Dec 9 21:39:37 CET 2007




Mikael Pettersson-3 wrote:
> 
> Which system is this? R11B-5? And the version of FreeBSD is what?
> And the CPU is what?
> 

FreeBSD airvent.XXX 5.4-RELEASE FreeBSD 5.4-RELEASE #1: Sat Aug 13 11:11:43
CEST 2005     root@REDACTED:/usr/src/sys/i386/compile/AIRVENT  i386

CPU: Intel(R) Xeon(TM) CPU 2.80GHz (2793.20-MHz 686-class CPU)
  Origin = "GenuineIntel"  Id = 0xf41  Stepping = 1

Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
  Hyperthreading: 2 logical CPUs
real memory  = 3220963328 (3071 MB)
avail memory = 3154833408 (3008 MB)
ACPI APIC Table: <DELL   PE BKC  >
FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
 cpu0 (BSP): APIC ID:  0
 cpu1 (AP): APIC ID:  1
 cpu2 (AP): APIC ID:  6
 cpu3 (AP): APIC ID:  7

Erlang is compiled from "ports", labeled by FreeBSD as "erlang-r11b5,1". The
tarball was named "otp_src_R11B-5"

Configure says:
checking for unreliable floating point execptions... reliable


Mikael Pettersson-3 wrote:
> 
> Beam should never crash due to an FP exception.
> 
> The first step is to run gdb on the core dump and display the
> current context (stack trace and registers).
> If you don't have a core dump, you can attach gdb to the beam
> process before the error, and then trigger the error.
> 

root@REDACTED:/usr/local/kernelE $ gdb
/usr/local/lib/erlang/erts-5.5.5/bin/beam -c beam.core 
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...(no debugging symbols
found)...
Core was generated by `beam'.
Program terminated with signal 8, Arithmetic exception.
Reading symbols from /lib/libutil.so.4...(no debugging symbols
found)...done.
Loaded symbols for /lib/libutil.so.4
Reading symbols from /lib/libm.so.3...(no debugging symbols found)...done.
Loaded symbols for /lib/libm.so.3
Reading symbols from /usr/lib/libpthread.so.1...(no debugging symbols
found)...done.
Loaded symbols for /usr/lib/libpthread.so.1
Reading symbols from /lib/libncurses.so.5...(no debugging symbols
found)...done.
Loaded symbols for /lib/libncurses.so.5
Reading symbols from /lib/libc.so.5...(no debugging symbols found)...done.
Loaded symbols for /lib/libc.so.5
Reading symbols from /libexec/ld-elf.so.1...(no debugging symbols
found)...done.
Loaded symbols for /libexec/ld-elf.so.1
#0  0x281a731b in pthread_testcancel () from /usr/lib/libpthread.so.1

(gdb) where              
#0  0x281a731b in pthread_testcancel () from /usr/lib/libpthread.so.1
#1  0x2819f902 in pthread_mutexattr_init () from /usr/lib/libpthread.so.1
#2  0x00000000 in ?? ()

(gdb) thread apply all bt     
Thread 4 (LWP 101555):
#0  0x281a72fb in pthread_testcancel () from /usr/lib/libpthread.so.1
#1  0x2819f902 in pthread_mutexattr_init () from /usr/lib/libpthread.so.1
#2  0x00000000 in ?? ()

Thread 3 (Thread 3 (runnable)):
#0  0x0812320f in ethr_sigwait ()
#1  0x08124398 in erts_printf_double ()
#2  0x0809f423 in null_func ()
#3  0x0809f3a0 in null_func ()
#4  0x0809f2a4 in null_func ()
#5  0x0809f3a0 in null_func ()
#6  0x0809f7ed in erts_printf_term ()
#7  0x08123ffb in erts_printf_format ()
#8  0x08124697 in erts_printf ()
#9  0x080973d4 in display_1 ()
#10 0x080dc618 in process_main ()
#11 0x0807aa9d in erl_start ()
#12 0x08069047 in main ()

Thread 2 (Thread 2 (LWP 101265)):
#0  0x281a72fb in pthread_testcancel () from /usr/lib/libpthread.so.1
#1  0x2819f902 in pthread_mutexattr_init () from /usr/lib/libpthread.so.1
#2  0x00000000 in ?? ()

Thread 1 (Thread 1 (LWP 101210)):
#0  0x281a72fb in pthread_testcancel () from /usr/lib/libpthread.so.1
#1  0x2819f7fb in pthread_mutexattr_init () from /usr/lib/libpthread.so.1
#2  0x2819f1ca in pthread_mutexattr_init () from /usr/lib/libpthread.so.1
#3  0x2819f169 in pthread_mutexattr_init () from /usr/lib/libpthread.so.1
#4  0x281a4bc9 in _pthread_cond_wait () from /usr/lib/libpthread.so.1
#5  0x281a4dee in pthread_cond_wait () from /usr/lib/libpthread.so.1
#6  0x081226a1 in ethr_cond_wait ()
#7  0x080f9e9a in erts_check_io_debug ()
#8  0x08122052 in ethr_install_exit_handler ()
#9  0x2819f902 in pthread_mutexattr_init () from /usr/lib/libpthread.so.1
#10 0x00000000 in ?? ()
#0  0x281a72fb in pthread_testcancel () from /usr/lib/libpthread.so.1

(gdb) info all-registers
eax            0x17e 382
ecx            0x7 7
edx            0x0 0
ebx            0x281aa4bc 672834748
esp            0x88dff90 0x88dff90
ebp            0x88dffbc 0x88dffbc
esi            0x81a8000 135954432
edi            0x8 8
eip            0x281a731b 0x281a731b
eflags         0x206 518
cs             0x1f 31
ss             0x2f 47
ds             0x2f 47
es             0x2f 47
fs             0x2f 47
gs             0xaf 175
st0            0 (raw 0x00000000000000000000)
st1            0 (raw 0x00000000000000000000)
st2            0.920218317769467830657958984375 (raw 0x3ffeeb936d7c00000000)
st3            17.484148037619888782501220703125 (raw
0x40038bdf8901a0000000)
st4            0 (raw 0x00000000000000000000)
st5            1 (raw 0x3fff8000000000000000)
st6            2 (raw 0x40008000000000000000)
st7            16.5 (raw 0x40038400000000000000)
fctrl          0x1272 4722
fstat          0x4020 16416
ftag           0x0 0
fiseg          0x1f 31
fioff          0x81133c6 135345094
foseg          0x2f 47
fooff          0x81a8d0c 135957772
fop            0x1c9 457
xmm0           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0},
v16_int8 = {
    0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0}, v4_int32 = {0x0, 0x0, 0x0, 
---Type <return> to continue, or q <return> to quit---
    0x0}, v2_int64 = {0x0, 0x0}, uint128 =
0x00000000000000000000000000000000}
xmm1           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0},
v16_int8 = {
    0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0}, v4_int32 = {0x0, 0x0, 0x0, 
    0x0}, v2_int64 = {0x0, 0x0}, uint128 =
0x00000000000000000000000000000000}
xmm2           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0},
v16_int8 = {
    0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0}, v4_int32 = {0x0, 0x0, 0x0, 
    0x0}, v2_int64 = {0x0, 0x0}, uint128 =
0x00000000000000000000000000000000}
xmm3           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0},
v16_int8 = {
    0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0}, v4_int32 = {0x0, 0x0, 0x0, 
    0x0}, v2_int64 = {0x0, 0x0}, uint128 =
0x00000000000000000000000000000000}
xmm4           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0},
v16_int8 = {
    0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0}, v4_int32 = {0x0, 0x0, 0x0, 
    0x0}, v2_int64 = {0x0, 0x0}, uint128 =
0x00000000000000000000000000000000}
xmm5           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0},
v16_int8 = {
    0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0}, v4_int32 = {0x0, 0x0, 0x0, 
    0x0}, v2_int64 = {0x0, 0x0}, uint128 =
0x00000000000000000000000000000000}
xmm6           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0},
v16_int8 = {
    0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0}, v4_int32 = {0x0, 0x0, 0x0, 
    0x0}, v2_int64 = {0x0, 0x0}, uint128 =
0x00000000000000000000000000000000}
xmm7           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0},
v16_int8 = {
    0x0 <repeats 16 times>}, v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0}, v4_int32 = {0x0, 0x0, 0x0, 
    0x0}, v2_int64 = {0x0, 0x0}, uint128 =
0x00000000000000000000000000000000}
mxcsr          0x0 0
mm0            {uint64 = 0x0, v2_int32 = {0x0, 0x0}, v4_int16 = {0x0, 0x0,
0x0, 0x0}, v8_int8 = {0x0, 0x0, 
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}
mm1            {uint64 = 0x0, v2_int32 = {0x0, 0x0}, v4_int16 = {0x0, 0x0,
0x0, 0x0}, v8_int8 = {0x0, 0x0, 
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}
mm2            {uint64 = 0xeb936d7c00000000, v2_int32 = {0x0, 0xeb936d7c},
v4_int16 = {0x0, 0x0, 0x6d7c, 
    0xeb93}, v8_int8 = {0x0, 0x0, 0x0, 0x0, 0x7c, 0x6d, 0x93, 0xeb}}
mm3            {uint64 = 0x8bdf8901a0000000, v2_int32 = {0xa0000000,
0x8bdf8901}, v4_int16 = {0x0, 0xa000, 
    0x8901, 0x8bdf}, v8_int8 = {0x0, 0x0, 0x0, 0xa0, 0x1, 0x89, 0xdf, 0x8b}}
mm4            {uint64 = 0x0, v2_int32 = {0x0, 0x0}, v4_int16 = {0x0, 0x0,
0x0, 0x0}, v8_int8 = {0x0, 0x0, 
    0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}
mm5            {uint64 = 0x8000000000000000, v2_int32 = {0x0, 0x80000000},
v4_int16 = {0x0, 0x0, 0x0, 
---Type <return> to continue, or q <return> to quit---
    0x8000}, v8_int8 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80}}
mm6            {uint64 = 0x8000000000000000, v2_int32 = {0x0, 0x80000000},
v4_int16 = {0x0, 0x0, 0x0, 
    0x8000}, v8_int8 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x80}}
mm7            {uint64 = 0x8400000000000000, v2_int32 = {0x0, 0x84000000},
v4_int16 = {0x0, 0x0, 0x0, 
    0x8400}, v8_int8 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x84}}

(gdb) info float
  R7: Valid   0x40038400000000000000 +16.5                      
  R6: Valid   0x40008000000000000000 +2                         
  R5: Valid   0x3fff8000000000000000 +1                         
  R4: Valid   0x00000000000000000000 +0                         
  R3: Valid   0x40038bdf8901a0000000 +17.48414803761988878      
  R2: Valid   0x3ffeeb936d7c00000000 +0.9202183177694678307     
  R1: Valid   0x00000000000000000000 +0                         
=>R0: Valid   0x00000000000000000000 +0                         

Status Word:         0x4020                  PE                      C3
                       TOP: 0
Control Word:        0x1272      DM       UM PM
                       PC: Double Precision (53-bits)
                       RC: Round to nearest
Tag Word:            0x0000
Instruction Pointer: 0x1f:0x081133c6
Operand Pointer:     0x2f:0x081a8d0c
Opcode:              0xd9c9



Mikael Pettersson-3 wrote:
> 
> It would also be helpful if you can provide a small self-contained
> erlang module that triggers the bug.
> 

Tthis happened on a production machine and fortunately the error occurred
only during maintenance. So far I was unable to get a sufficiently small
code and dataset to demonstrate it. 

The function which triggered the crash was this:

update_pipeline({versandtermin, CId, Versandtermin}) ->
    Fun = fun() ->
        [PPEntry] = mnesia:read({provpipeline, CId}),
        NewAttributes = [{kernel_updated_at, calendar:universal_time()}|
                         proplists:delete(versandtermin,
PPEntry#provpipeline.attributes)],
        mnesia:write(PPEntry#provpipeline{attributes=[{versandtermin,
Versandtermin}|NewAttributes]}),
        erlang:display({CId, mnesia:read({provpipeline, CId})})
    end,
    mypl_db_util:transaction(Fun),
    ok.

provpipeline is defined like this:

% orders to be provisioned
-record(provpipeline,
            {id,
             priority,          % the higher the number the higher the
priority
             orderlines,
             weigth,
             volume,
             status,            % new, processing, provisioned
             tries,             % how often we tried to find a match for
that pick
             provisioninglists, % retrievallists and picklists
             attributes         % propertylist
            }).

volume usually contains floating point values.

Interestingly I can use erlang:display/1 to trigger the issue:

(mypl_produktion@REDACTED)2> mnesia:dirty_read({provpipeline, "931631"}).
[{provpipeline,"931631",
               5,
               [{191,"71575",[["gewicht",0],["auftragsposition",1]]}],
               0,
               0.00000e+0,
               new,
               8,
               [],
               [{kernel_customer,"28000"},
                {kernel_enqueued_at,{{2007,12,6},{20,51,18}}},
                {auftragsnummer,"649496"},
                {liefertermin,"2007-12-10"}]}]
(mypl_produktion@REDACTED)3> erlang:display(mnesia:dirty_read({provpipeline,
"931631"})).
Floating point exception (core dumped)

Regards

Maximillian
-- 
View this message in context: http://www.nabble.com/Floating-point-exception-%28core-dumped%29-in-beam-tp14208305p14243025.html
Sent from the Erlang Bugs mailing list archive at Nabble.com.




More information about the erlang-bugs mailing list