Minimac4 icon indicating copy to clipboard operation
Minimac4 copied to clipboard

Runtime errors

Open yutoubb opened this issue 6 years ago • 17 comments

I get this "free(): invalid next size (normal)" error when using Minimac4 It seems the imputation is finished, and the files are generated but the software trying to free the memory and get this error?

Command line /share/app/glibc-2.17/lib/ld-2.17.so --library-path /share/app/glibc-2.17/lib:/share/app/gcc-5.2.0/lib64:/share/app/gcc-5.2.0/lib:/share/app/libz/zlib-1.2.11/:/share/app/cmake-3.3.2/lib:/opt/gridengine/lib/lx-amd64::/opt/python/lib ~/software/imputation/minimac4 --refHaps ~/refpanel/G1K_P3_M3VCF_FILES_WITH_ESTIMATES/chr21.1000g.Phase3.v5.With.Parameter.Estimates.m3vcf.gz --haps ~/Eagle_Minimac4/imputation/out/0.40/006/phased.0.40.006.vcf.gz --prefix ~/Eagle_Minimac4/imputation/out/0.40/006/minimac.0.40.006 --cpus 1

Error message:

.........
 ------------------------------------------------------------------------------
                                END OF PROGRAM
 ------------------------------------------------------------------------------
*** Error in `~/software/imputation/minimac4': free(): invalid next size (normal): 0x00002b1871aacdf0 ***
======= Backtrace: =========
/share/app/glibc-2.17/lib/libc.so.6(+0x78466)[0x2b17f850f466]
/share/app/glibc-2.17/lib/libc.so.6(+0x7a3b3)[0x2b17f85113b3]
~/software/imputation/minimac4(_ZN11MarkovModelD1Ev+0xb5)[0x423265]
~/software/imputation/minimac4(_ZN8Analysis11RunAnalysisER6StringS1_S1_S1_+0x8bf)[0x42054f]
~/software/imputation/minimac4(_ZN8Analysis17AnalyzeExperimentER6StringS1_S1_S1_R11AllVariable+0x972)[0x421042]
~/software/imputation/minimac4(main+0x919)[0x418239]
/share/app/glibc-2.17/lib/libc.so.6(__libc_start_main+0xfd)[0x2b17f84b684d]
~/software/imputation/minimac4[0x418b7f]
======= Memory map: ========
00400000-0049f000 r-xp 00000000 73b:8ddf2 144116098088930977             ~/software/imputation/minimac4
..........

yutoubb avatar Dec 03 '18 10:12 yutoubb

I ran a series of imputation jobs with different number of samples (from 1 to 42, we are planning to do more later) in combination with other experiment parameters, and I got different errors.

Besides the error mentioned above, the other error types are listed here:

 Appending chunk to final output VCF File :  SOME_PATH/minimac.0.95.026.dose.vcf.gz
*** Error in `minimac4': munmap_chunk(): invalid pointer: 0x00002ac0381e1f80 ***
       Saving Samples in temporary VCF file ...
*** Error in `minimac4': malloc(): smallbin double linked list corrupted: 0x00002ac8cde1c850 ***
       Saving Samples in temporary VCF file ...
*** Error in `minimac4': corrupted double-linked list: 0x00002b5bf7148f40 ***
 ------------------------------------------------------------------------------
                                END OF PROGRAM
 ------------------------------------------------------------------------------
*** Error in `minimac4': double free or corruption (!prev): 0x00002ba5c224cde0 ***

I am not sure if all of them were due to the 1.0.0 version I used. Could Anyone send me the executables from version 1.0.1?

yutoubb avatar Dec 04 '18 05:12 yutoubb

This is basic memory corruption. I'm assuming this is an issue with the dynamic loading of a specific version of libc. In any case, it will not be easily debugged via an issues thread. Have you tried building from source using the instructions at https://github.com/statgen/Minimac4/issues/14#issuecomment-441264355

jonathonl avatar Dec 05 '18 01:12 jonathonl

I tried to compile under a Ubuntu 14.04 vm on a cloud server, and copy the executable to our cluster, and use glibc 2.17 to run it. For this v1.0.1 version, 90% of the jobs are finished with out error. but 10% of them still got follow error.

 Starting Imputation ...

  Imputing Samples 1-37 [100%] out of 37 samples ...
minimac4: /opt/bin/Minimac4/src/MarkovModel.cpp:1102: void MarkovModel::unfoldProbabilities(int, std::vector<float>&, std::vector<float>&, std::vector<float>&, int, std::vector<ReducedHaplotypeInfo>&, int): Assertion `adj_norec[i]<1e18' failed.

The error can be repeated on certain jobs, even including some jobs that have succeed with v1.0.0.

yutoubb avatar Dec 07 '18 03:12 yutoubb

This seems like some kind of precision overflow issue. As of now I would suggest you to use minimac3 instead. In the meantime if you could email me the log files, I can look into it and Try to fix the bug.

On Thu, Dec 6, 2018, 7:55 PM yutoubb <[email protected] wrote:

I tried to compile under a Ubuntu 14.04 vm on a cloud server, and copy the executable to out cluster, and use glibc to run it. For this v1.0.1 version, 90% of the jobs are finished with out error. but 10% of them still got follow error.

Starting Imputation ...

Imputing Samples 1-37 [100%] out of 37 samples ... minimac4: /opt/bin/Minimac4/src/MarkovModel.cpp:1102: void MarkovModel::unfoldProbabilities(int, std::vector&, std::vector&, std::vector&, int, std::vector<ReducedHaplotypeInfo>&, int): Assertion `adj_norec[i]<1e18' failed.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/statgen/Minimac4/issues/16#issuecomment-445114893, or mute the thread https://github.com/notifications/unsubscribe-auth/AHuICK8LiR2qbB8gNvs41ysTeoq7L-ZQks5u2eawgaJpZM4Y-TER .

Santy-8128 avatar Dec 07 '18 06:12 Santy-8128

I tried to send you an email but got an unknown error. Here is the stderr and stdout: stderr

/opt/gridengine/default/spool/compute-f14-16/job_scripts/7827469: line 1: 194704 Aborted                 (core dumped) /share/app/glibc-2.17/lib/ld-2.17.so --library-path /share/app/glibc-2.17/lib:/share/app/gcc-5.2.0/lib64:/share/app/gcc-5.2.0/lib:/share/app/libz/zlib-1.2.11/:/share/app/cmake-3.3.2/lib:/opt/gridengine/lib/lx-amd64:/opt/openmpi/lib:/opt/python/lib /software/imputation/minimac4 --refHaps /refpanel/G1K_P3_M3VCF_FILES_WITH_ESTIMATES/chr21.1000g.Phase3.v5.With.Parameter.Estimates.m3vcf.gz --haps /workdir/Eagle_Minimac4/imputation/out/0.10/038/phased.0.10.038.vcf.gz --prefix /workdir/Eagle_Minimac4/imputation/out/0.10/038/minimac.0.10.038 --cpus 1

real	9m41.060s
user	9m14.829s
sys	0m12.227s

stdout

 -------------------------------------------------------------------------------- 
          Minimac4 - Fast Imputation Based on State Space Reduction HMM
 --------------------------------------------------------------------------------
           (c) 2014 - Sayantan Das, Christian Fuchsberger, David Hinds
                             Mary Kate Wing, Goncalo Abecasis 

 Version: 1.0.1;
 Built: Thu Dec  6 09:08:54 UTC 2018 by root

 Command Line Options: 
       Reference Haplotypes : --refHaps [/refpanel/G1K_P3_M3VCF_FILES_WITH_ESTIMATES/chr21.1000g.Phase3.v5.With.Parameter.Estimates.m3vcf.gz],
                              --passOnly, --rsid, --referenceEstimates [ON],
                              --mapFile [docs/geneticMapFile.b38.map.txt.gz]
          Target Haplotypes : --haps [/workdir/Eagle_Minimac4/imputation/out/0.10/038/phased.0.10.038.vcf.gz]
          Output Parameters : --prefix [/workdir/Eagle_Minimac4/imputation/out/0.10/038/minimac.0.10.038],
                              --estimate, --nobgzip, --vcfBuffer [200],
                              --format [GT,DS], --allTypedSites, --meta,
                              --memUsage
        Chunking Parameters : --ChunkLengthMb [20.00], --ChunkOverlapMb [3.00]
          Subset Parameters : --chr [], --start, --end, --window
   Approximation Parameters : --minimac3, --probThreshold [0.01],
                              --diffThreshold [0.01], --topThreshold [0.01]
           Other Parameters : --log, --help, --cpus [1], --params
                  PhoneHome : --noPhoneHome, --phoneHomeThinning [50]


 URL = http://genome.sph.umich.edu/wiki/Minimac4
 Starting Main Imputation/Estimation Analysis ... 

 Performing preliminary check on input parameters... 

 ------------------------------------------------------------------------------
                             PRELIMINARY FILE CHECK                            
 ------------------------------------------------------------------------------

 Checking GWAS haplotype file : /workdir/Eagle_Minimac4/imputation/out/0.10/038/phased.0.10.038.vcf.gz

 Gathering variant information ...

 Successful !!! 

 Checking Reference haplotype file : /refpanel/G1K_P3_M3VCF_FILES_WITH_ESTIMATES/chr21.1000g.Phase3.v5.With.Parameter.Estimates.m3vcf.gz

 Gathering variant information ...

 Successful !!! 

 Reference Panel   : Found 2504 samples (5008 haplotypes) and 653791 variants ...

 Target/GWAS Panel : Found 38 samples (76 haplotypes) and 57426 variants ...
                     57426 variants overlap with Reference panel 
                     0 variants imported that exist only in Target/GWAS panel

 ------------------------------------------------------------------------------
                           CHUNKING INFORMATION                           
 ------------------------------------------------------------------------------

 Chunking region into 1 chunk(s) with atleast 653791 variants in each chunk ... 

 Details of chunks is given below ...

 No   LeftBuffer      LeftEnd   RightPoint  RightBuffer       #Sites(GWAS/Ref/%)
 -------------------------------------------------------------------------------
  1      9411245      9411245     48119740     48119740    57426/  653791/ 8.78%


 ------------------------------------------------------------------------------
                           MAIN IMPUTATION ANALYSIS                            
 ------------------------------------------------------------------------------

 Starting imputation analysis of 1 chunk(s) ... 

 -------------------------------------------
 Analyzing Chunk 1/1 [chr21:9411245-48119740]
 -------------------------------------------

 Reading chunk from reference panel ... 
 Reading chunk from target/GWAS panel ... 

 Compressing reference panel at GWAS sites ... 
 Re-compression successful (211 seconds) !!!

 Starting Imputation ...

  Imputing Samples 1-38 [100%] out of 38 samples ...
minimac4: /opt/bin/Minimac4/src/MarkovModel.cpp:1102: void MarkovModel::unfoldProbabilities(int, std::vector<float>&, std::vector<float>&, std::vector<float>&, int, std::vector<ReducedHaplotypeInfo>&, int): Assertion `adj_norec[i]<1e18' failed.

yutoubb avatar Dec 07 '18 07:12 yutoubb

Minimac3 dose not sopport hg19 reference? should I change the chromosome names in vcf and refpanel from chr21 to 21 ?

 Checking variant information ...

 Error !!! Target VCF File contains chromosome : chr21
 VCF File can only contain chromosomes 1-22 and X !!!
 Program Aborting ...

 Program Exiting ...

yutoubb avatar Dec 07 '18 07:12 yutoubb

No you don’t have to change your reference panel.

Simply add the following option to your command line would work: --myChromosome chr21

This is a latent option which is not included in the documentation..

yukt avatar Dec 07 '18 16:12 yukt

Got the results from Minimac3. Thank you very much!

yutoubb avatar Dec 14 '18 07:12 yutoubb

Was the source of this error ever found or corrected? We are still encountering this bug in minimac4: minimac4: /build/minimac4/build/Minimac4/Minimac4/src/MarkovModel.cpp:1085: void MarkovModel::unfoldProbabilities(int, std::vector<float>&, std::vector<float>&, std::vector<float>&, int, std::vector<ReducedHaplotypeInfo>&, int): Assertion 'adj_norec[i]<1e18' failed.

mikesivley avatar Nov 03 '20 16:11 mikesivley

I'd also be interested if the issues described above where resolved. I have a similar runtime error with minimac4: minimac4: /home/ddidomizio/tmp_src/Minimac4/src/MarkovModel.cpp:755: void MarkovModel::CreatePRefPAlt(ReducedHaplotypeInfo&, int, int): Assertion 'FoldedProbValue[MappedIndex]>=0.0f' failed.

I am attaching my logfile. m4_chr20_chunk2_imputed.txt

Just in case you wonder about my chunking parameters, my input data is already chunked (from my previous pipeline with minimac3) so I chose these parameters to effectively disable the chunking.

@Santy-8128 , any advise? Thank you!

evakoe avatar Nov 27 '20 07:11 evakoe

I have the same problem as @yutoubb and @mikesivley:

Minimac4: MarkovModel.cpp:1085: void MarkovModel::unfoldProbabilities(int, std::vector<float>&,
std::vector<float>&, std::vector<float>&, int, std::vector<ReducedHaplotypeInfo>&, int):
Assertion `adj_norec[i]<1e18' failed.

Please let me know if you need access to the log file or dataset.

agrueneberg avatar Sep 18 '21 18:09 agrueneberg

Please pull the latest from the master branch, delete the contents of your build directory, configure, and build.

jonathonl avatar Sep 19 '21 16:09 jonathonl

@jonathonl I already tried a version based on the latest commit on the master branch after seeing a bunch of probability-related fixes after 1.0.2 was released. Same behavior.

agrueneberg avatar Sep 19 '21 18:09 agrueneberg

If you have the latest from master, then you need to reconfigure from a clean (e.g., empty) build directory before rebuilding the latest. You would not be getting that message with a clean build from master unless you explicitly enabled a debug build.

jonathonl avatar Sep 19 '21 18:09 jonathonl

You got me there: I was compiling the few .cpp files manually because I didn't want to mess around with CMake / cget and didn't no-op the assert calls in the process. I'm definitely on a fresh checkout on the latest commit, though. If I set -DNDEBUG (as the Release build type would do), the error disappears of course -- but the question is should it and should its presence in the debug build be ignored?

agrueneberg avatar Sep 20 '21 12:09 agrueneberg

That assertion can be ignored. The 1e18 threshold is too stringent. If those values actually get too large, the results file will be filled with NaN's.

jonathonl avatar Sep 20 '21 13:09 jonathonl

OK, thanks for letting me know!

agrueneberg avatar Sep 20 '21 14:09 agrueneberg