[R] Irreproducible exception in R extension

2012-12-28 Thread Simon Zehnder
Dear R-Users,

I am having some trouble running an R extension on our cluster (linux). I call 
C++ code in which I use a) the Scythe Statistical Library and b) OpenMP. Most 
of the jobs run without a problem, but some arbitrary jobs throw an exception 
of the kind printed below while running in a parallel loop. The behavior is to 
me not reproducible, although at every run of 729 Jobs it at least happens 
once. I already tried to enforce the error by using the Intel Compiler instead 
of the GCC 4.7.2 and using the Options '-checkinit' for possibly uninitialized 
values and '-ftrapuv' for initialization of stack variables to unusual values 
to aid error detection. But I cannot enforce the exception, which makes it 
impossible to debug. I already googled this error,  but there only 2-3 small 
forum discussions about it, and so I hope I find some suggestions here. 

1. What do you think this error comes from? 
2. What do you advice me to do to detect the error?

I am excited for your answers.

Simon




*** glibc detected *** /home/simo_109//opt/R/lib64/R/bin/exec/R: double free or 
corruption (!prev): 0x01355610 ***
=== Backtrace: =
/lib64/libc.so.6[0x3845a75916]
/lib64/libc.so.6[0x3845a78443]
/rwthfs/rz/cluster/home/simo_109/opt/R/lib64/R/library/MCpkg/libs/MCpkg.so(_ZN6scythe9DataBlockIdE10deallocateEv+0x7b)[0x7f4645d5d6db]
/rwthfs/rz/cluster/home/simo_109/opt/R/lib64/R/library/MCpkg/libs/MCpkg.so(_ZN6scythe9DataBlockIdED1Ev+0x47)[0x7f4645d5d5bb]
/rwthfs/rz/cluster/home/simo_109/opt/R/lib64/R/library/MCpkg/libs/MCpkg.so(_ZN6scythe18DataBlockReferenceIdE17withdrawReferenceEv+0xaa)[0x7f4645d83442]
/rwthfs/rz/cluster/home/simo_109/opt/R/lib64/R/library/MCpkg/libs/MCpkg.so(_ZN6scythe18DataBlockReferenceIdED1Ev+0x94)[0x7f4645d82cc8]
/rwthfs/rz/cluster/home/simo_109/opt/R/lib64/R/library/MCpkg/libs/MCpkg.so(_ZN6scythe18DataBlockReferenceIdED2Ev+0x47)[0x7f4645d82d9f]
/rwthfs/rz/cluster/home/simo_109/opt/R/lib64/R/library/MCpkg/libs/MCpkg.so(_ZN6scythe6MatrixIdLNS_12matrix_orderE0ELNS_12matrix_styleE1EED1Ev+0x5d)[0x7f4645d8b26d]
/rwthfs/rz/cluster/home/simo_109/opt/R/lib64/R/library/MCpkg/libs/MCpkg.so(_Z11MCgmmS_implIN6scythe8mersenneEEvRNS0_3rngIT_EERP7SEXPRECS8_jjRNS0_6MatrixIdLNS0_12matrix_orderE0ELNS0_12matrix_styleE0EEERKSC_jS8_S8_+0x478f)[0x7f4645d6d6af]
/opt/intel/Compiler/12.1/6.361/rwthlnk/compiler/lib/intel64/libiomp5.so(__kmp_invoke_microtask+0x93)[0x7f4645aabee3]
=== Memory map: 
0040-00401000 r-xp  00:21 32550383   
/rwthfs/rz/cluster/home/simo_109/opt/R/lib64/R/bin/exec/R
0060-00601000 rw-p  00:21 32550383   
/rwthfs/rz/cluster/home/simo_109/opt/R/lib64/R/bin/exec/R
00601000-029cc000 rw-p  00:00 0  [heap]
369ac0-369ac3a000 r-xp  08:01 263771 
/lib64/libreadline.so.6.0
369ac3a000-369ae3a000 ---p 0003a000 08:01 263771 
/lib64/libreadline.so.6.0
369ae3a000-369ae42000 rw-p 0003a000 08:01 263771 
/lib64/libreadline.so.6.0
369ae42000-369ae43000 rw-p  00:00 0 
369bc0-369bc16000 r-xp  08:01 263757 
/lib64/libgcc_s-4.4.6-20120305.so.1
369bc16000-369be15000 ---p 00016000 08:01 263757 
/lib64/libgcc_s-4.4.6-20120305.so.1
369be15000-369be16000 rw-p 00015000 08:01 263757 
/lib64/libgcc_s-4.4.6-20120305.so.1
369c00-369c0e8000 r-xp  08:01 656025 
/usr/lib64/libstdc++.so.6.0.13
369c0e8000-369c2e8000 ---p 000e8000 08:01 656025 
/usr/lib64/libstdc++.so.6.0.13
369c2e8000-369c2ef000 r--p 000e8000 08:01 656025 
/usr/lib64/libstdc++.so.6.0.13
369c2ef000-369c2f1000 rw-p 000ef000 08:01 656025 
/usr/lib64/libstdc++.so.6.0.13
369c2f1000-369c306000 rw-p  00:00 0 
369d00-369d00d000 r-xp  08:01 671072 
/usr/lib64/libgomp.so.1.0.0
369d00d000-369d20c000 ---p d000 08:01 671072 
/usr/lib64/libgomp.so.1.0.0
369d20c000-369d20d000 rw-p c000 08:01 671072 
/usr/lib64/libgomp.so.1.0.0
369fa0-369faf r-xp  08:01 660772 
/usr/lib64/libgfortran.so.3.0.0
369faf-369fcef000 ---p 000f 08:01 660772 
/usr/lib64/libgfortran.so.3.0.0
369fcef000-369fcf1000 rw-p 000ef000 08:01 660772 
/usr/lib64/libgfortran.so.3.0.0
369fcf1000-369fcf2000 rw-p  00:00 0 
36a360-36a373f000 r-xp  08:01 675210 
/usr/lib64/libicuuc.so.42.1
36a373f000-36a393f000 ---p 0013f000 08:01 675210 
/usr/lib64/libicuuc.so.42.1
36a393f000-36a395 rw-p 0013f000 08:01 675210 
/usr/lib64/libicuuc.so.42.1
36a395-36a3952000 rw-p  00:00 0 
36a3a0-36a3b88000 r-xp 

[R] Irreproducible exception in R extension

2012-12-28 Thread Simon Zehnder
Dear R-Users,

I am having some trouble running an R extension on our cluster (linux). I call 
C++ code in which I use a) the Scythe Statistical Library and b) OpenMP. Most 
of the jobs run without a problem, but some arbitrary jobs throw an exception 
of the kind printed below while running in a parallel loop. The behavior is to 
me not reproducible, although at every run of 729 Jobs it at least happens 
once. I already tried to enforce the error by using the Intel Compiler instead 
of the GCC 4.7.2 and using the Options '-checkinit' for possibly uninitialized 
values and '-ftrapuv' for initialization of stack variables to unusual values 
to aid error detection. But I cannot enforce the exception, which makes it 
impossible to debug. I already googled this error,  but there only 2-3 small 
forum discussions about it, and so I hope I find some suggestions here. 

1. What do you think this error comes from? 
2. What do you advice me to do to detect the error?

I am excited for your answers.

Simon




*** glibc detected *** /home/simo_109//opt/R/lib64/R/bin/exec/R: double free or 
corruption (!prev): 0x01355610 ***
=== Backtrace: =
/lib64/libc.so.6[0x3845a75916]
/lib64/libc.so.6[0x3845a78443]
/rwthfs/rz/cluster/home/simo_109/opt/R/lib64/R/library/MCpkg/libs/MCpkg.so(_ZN6scythe9DataBlockIdE10deallocateEv+0x7b)[0x7f4645d5d6db]
/rwthfs/rz/cluster/home/simo_109/opt/R/lib64/R/library/MCpkg/libs/MCpkg.so(_ZN6scythe9DataBlockIdED1Ev+0x47)[0x7f4645d5d5bb]
/rwthfs/rz/cluster/home/simo_109/opt/R/lib64/R/library/MCpkg/libs/MCpkg.so(_ZN6scythe18DataBlockReferenceIdE17withdrawReferenceEv+0xaa)[0x7f4645d83442]
/rwthfs/rz/cluster/home/simo_109/opt/R/lib64/R/library/MCpkg/libs/MCpkg.so(_ZN6scythe18DataBlockReferenceIdED1Ev+0x94)[0x7f4645d82cc8]
/rwthfs/rz/cluster/home/simo_109/opt/R/lib64/R/library/MCpkg/libs/MCpkg.so(_ZN6scythe18DataBlockReferenceIdED2Ev+0x47)[0x7f4645d82d9f]
/rwthfs/rz/cluster/home/simo_109/opt/R/lib64/R/library/MCpkg/libs/MCpkg.so(_ZN6scythe6MatrixIdLNS_12matrix_orderE0ELNS_12matrix_styleE1EED1Ev+0x5d)[0x7f4645d8b26d]
/rwthfs/rz/cluster/home/simo_109/opt/R/lib64/R/library/MCpkg/libs/MCpkg.so(_Z11MCgmmS_implIN6scythe8mersenneEEvRNS0_3rngIT_EERP7SEXPRECS8_jjRNS0_6MatrixIdLNS0_12matrix_orderE0ELNS0_12matrix_styleE0EEERKSC_jS8_S8_+0x478f)[0x7f4645d6d6af]
/opt/intel/Compiler/12.1/6.361/rwthlnk/compiler/lib/intel64/libiomp5.so(__kmp_invoke_microtask+0x93)[0x7f4645aabee3]
=== Memory map: 
0040-00401000 r-xp  00:21 32550383   
/rwthfs/rz/cluster/home/simo_109/opt/R/lib64/R/bin/exec/R
0060-00601000 rw-p  00:21 32550383   
/rwthfs/rz/cluster/home/simo_109/opt/R/lib64/R/bin/exec/R
00601000-029cc000 rw-p  00:00 0  [heap]
369ac0-369ac3a000 r-xp  08:01 263771 
/lib64/libreadline.so.6.0
369ac3a000-369ae3a000 ---p 0003a000 08:01 263771 
/lib64/libreadline.so.6.0
369ae3a000-369ae42000 rw-p 0003a000 08:01 263771 
/lib64/libreadline.so.6.0
369ae42000-369ae43000 rw-p  00:00 0 
369bc0-369bc16000 r-xp  08:01 263757 
/lib64/libgcc_s-4.4.6-20120305.so.1
369bc16000-369be15000 ---p 00016000 08:01 263757 
/lib64/libgcc_s-4.4.6-20120305.so.1
369be15000-369be16000 rw-p 00015000 08:01 263757 
/lib64/libgcc_s-4.4.6-20120305.so.1
369c00-369c0e8000 r-xp  08:01 656025 
/usr/lib64/libstdc++.so.6.0.13
369c0e8000-369c2e8000 ---p 000e8000 08:01 656025 
/usr/lib64/libstdc++.so.6.0.13
369c2e8000-369c2ef000 r--p 000e8000 08:01 656025 
/usr/lib64/libstdc++.so.6.0.13
369c2ef000-369c2f1000 rw-p 000ef000 08:01 656025 
/usr/lib64/libstdc++.so.6.0.13
369c2f1000-369c306000 rw-p  00:00 0 
369d00-369d00d000 r-xp  08:01 671072 
/usr/lib64/libgomp.so.1.0.0
369d00d000-369d20c000 ---p d000 08:01 671072 
/usr/lib64/libgomp.so.1.0.0
369d20c000-369d20d000 rw-p c000 08:01 671072 
/usr/lib64/libgomp.so.1.0.0
369fa0-369faf r-xp  08:01 660772 
/usr/lib64/libgfortran.so.3.0.0
369faf-369fcef000 ---p 000f 08:01 660772 
/usr/lib64/libgfortran.so.3.0.0
369fcef000-369fcf1000 rw-p 000ef000 08:01 660772 
/usr/lib64/libgfortran.so.3.0.0
369fcf1000-369fcf2000 rw-p  00:00 0 
36a360-36a373f000 r-xp  08:01 675210 
/usr/lib64/libicuuc.so.42.1
36a373f000-36a393f000 ---p 0013f000 08:01 675210 
/usr/lib64/libicuuc.so.42.1
36a393f000-36a395 rw-p 0013f000 08:01 675210 
/usr/lib64/libicuuc.so.42.1
36a395-36a3952000 rw-p  00:00 0 
36a3a0-36a3b88000 r-xp