Open jrandall opened 7 years ago
I've now also run it through valgrind, and it is reporting some problems with the write to ww2
by the vst
function (and the subsequent read by the vvp
function).
Valgrind output is below (note that the source line numbers are slightly off because I've added some debug printing to this version of the code).
==58456== Invalid write of size 8
==58456== at 0x43C529: vst (vsubs.c:27)
==58456== by 0x40A56A: initvmix (qpGraph.c:2165)
==58456== by 0x404F50: main (qpGraph.c:812)
==58456== Address 0x3d525908 is 0 bytes after a block of size 104 alloc'd
==58456== at 0x4C29DB4: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==58456== by 0x40A0DC: initvmix (qpGraph.c:2104)
==58456== by 0x404F50: main (qpGraph.c:812)
==58456==
==58456== Invalid read of size 8
==58456== at 0x43C622: vvp (vsubs.c:43)
==58456== by 0x40A581: initvmix (qpGraph.c:2166)
==58456== by 0x404F50: main (qpGraph.c:812)
==58456== Address 0x3d525908 is 0 bytes after a block of size 104 alloc'd
==58456== at 0x4C29DB4: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==58456== by 0x40A0DC: initvmix (qpGraph.c:2104)
==58456== by 0x404F50: main (qpGraph.c:812)
==58456==
--58456-- VALGRIND INTERNAL ERROR: Valgrind received a signal 11 (SIGSEGV) - exiting
--58456-- si_code=80; Faulting address: 0x0; sp: 0x402bdae00
In my modified code, qpGraph.c:2166 is: vst(ww2, wwinit, 0.5, nwts) ;
and qpGraph.c:2167 is vvp(ww, ww, ww2, nwts) ;
With our data, nwts = 18
and nvar = 13
, so when vst(ww2, wwinit, 0.5, nwts)
loops over ww2
to update it, there is a buffer overrun because nwts
is greater than the size of the ww2
vector.
This is very helpful. Could you make the followng code change:
In initvmix set nvar by nvar = nedge + nwts + nanc*(nanc-1)/2 ;
I think you will see readily where this should go. Your graph is unusual, and I fear inference will be hard. Anyway please see if this fixes the problem and I will update.
Nick
On Thu, Mar 23, 2017 at 8:33 PM, Joshua C. Randall <notifications@github.com
wrote:
I've now also run it through valgrind, and it is reporting some problems with the write to ww2 by the vst function (and the subsequent read by the vvp function).
Valgrind output is below (note that the source line numbers are slightly off because I've added some debug printing to this version of the code).
==58456== Invalid write of size 8 ==58456== at 0x43C529: vst (vsubs.c:27) ==58456== by 0x40A56A: initvmix (qpGraph.c:2165) ==58456== by 0x404F50: main (qpGraph.c:812) ==58456== Address 0x3d525908 is 0 bytes after a block of size 104 alloc'd ==58456== at 0x4C29DB4: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==58456== by 0x40A0DC: initvmix (qpGraph.c:2104) ==58456== by 0x404F50: main (qpGraph.c:812) ==58456== ==58456== Invalid read of size 8 ==58456== at 0x43C622: vvp (vsubs.c:43) ==58456== by 0x40A581: initvmix (qpGraph.c:2166) ==58456== by 0x404F50: main (qpGraph.c:812) ==58456== Address 0x3d525908 is 0 bytes after a block of size 104 alloc'd ==58456== at 0x4C29DB4: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==58456== by 0x40A0DC: initvmix (qpGraph.c:2104) ==58456== by 0x404F50: main (qpGraph.c:812) ==58456== --58456-- VALGRIND INTERNAL ERROR: Valgrind received a signal 11 (SIGSEGV) - exiting --58456-- si_code=80; Faulting address: 0x0; sp: 0x402bdae00
In my modified code, qpGraph.c:2166 is: vst(ww2, wwinit, 0.5, nwts) ; and qpGraph.c:2167 is vvp(ww, ww, ww2, nwts) ;
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/DReichLab/AdmixTools/issues/17#issuecomment-288900612, or mute the thread https://github.com/notifications/unsubscribe-auth/AQn_h1INXXERA16QAftKwJ_wSnZERnWBks5row9YgaJpZM4MnXwD .
@bumblenick I am sure that will fix the problem, as it would necessarily make nvar
at least as large as nwts
, a more explicit version of which is the fix I already tried and can confirm is working (see PR #18).
OK; I will install this tomorrow
N
On Thu, Mar 23, 2017 at 9:32 PM, Joshua C. Randall <notifications@github.com
wrote:
@bumblenick https://github.com/bumblenick I am sure that will fix the problem, as it would necessarily make nvar at least as large as nwts, a more explicit version of which is the fix I already tried and can confirm is working (see PR #18 https://github.com/DReichLab/AdmixTools/pull/18).
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/DReichLab/AdmixTools/issues/17#issuecomment-288908621, or mute the thread https://github.com/notifications/unsubscribe-auth/AQn_h7g9WbIzyE1lvFzg7qt3g3mV4f4uks5rox0WgaJpZM4MnXwD .
During a run of qpGraph, we got the following error:
Using gdb, I've tracked this down to the
free (ww2)
call at the end ofinitvmix
: https://github.com/DReichLab/AdmixTools/blob/master/src/qpGraph.c#L2183