Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A bug detected by valgrind-3.16.1 in minimap2-2.20_x64-linux ? #752

Closed
moold opened this issue Jun 4, 2021 · 4 comments
Closed

A bug detected by valgrind-3.16.1 in minimap2-2.20_x64-linux ? #752

moold opened this issue Jun 4, 2021 · 4 comments
Labels

Comments

@moold
Copy link

moold commented Jun 4, 2021

Hi heng,

I wonder if this is a bug? I have attached the input files:
map.fa.gz
ref.fa.gz

Here is the CMD and log:

valgrind ./minimap2-2.20_x64-linux/minimap2 --sam-hit-only -Y -a -x asm10 -t 10  ref.fa.gz map.fa.gz >/dev/null

==23501== Memcheck, a memory error detector
==23501== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==23501== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info
==23501== Command: ./minimap2-2.20_x64-linux/minimap2 --sam-hit-only -Y -a -x asm10 -t 10 ref.fa.gz map.fa.gz
==23501== 
[M::mm_idx_gen::0.462*2.01] collected minimizers
[M::mm_idx_gen::0.670*1.70] sorted minimizers
[M::main::0.681*1.69] loaded/built the index for 1 target sequence(s)
[M::mm_mapopt_update::0.694*1.67] mid_occ = 50
[M::mm_idx_stat] kmer size: 19; skip: 19; is_hpc: 0; #seq: 1
[M::mm_idx_stat::0.702*1.67] distinct minimizers: 48421 (64.31% are singletons); average occurrences: 1.544; average spacing: 12.041; total length: 900001
==23501== Thread 4:
==23501== Conditional jump or move depends on uninitialised value(s)
==23501==    at 0x4172B3: krmq_update_min_lc_elem (lchain.c:212)
==23501==    by 0x4172B3: krmq_erase_lc_elem (lchain.c:212)
==23501==    by 0x417914: mg_lchain_rmq (lchain.c:291)
==23501==    by 0x40D099: mm_map_frag (map.c:273)
==23501==    by 0x40E0C3: worker_for (map.c:422)
==23501==    by 0x412481: ktf_worker (kthread.c:47)
==23501==    by 0x5356DD4: start_thread (pthread_create.c:307)
==23501==    by 0x5668EAC: clone (clone.S:111)
==23501== 
==23501== Conditional jump or move depends on uninitialised value(s)
==23501==    at 0x4172B3: krmq_update_min_lc_elem (lchain.c:212)
==23501==    by 0x4172B3: krmq_erase_lc_elem (lchain.c:212)
==23501==    by 0x418074: mg_lchain_rmq (lchain.c:282)
==23501==    by 0x40D099: mm_map_frag (map.c:273)
==23501==    by 0x40E0C3: worker_for (map.c:422)
==23501==    by 0x412481: ktf_worker (kthread.c:47)
==23501==    by 0x5356DD4: start_thread (pthread_create.c:307)
==23501==    by 0x5668EAC: clone (clone.S:111)
==23501== 
==23501== Thread 10:
==23501== Conditional jump or move depends on uninitialised value(s)
==23501==    at 0x41F6B8: mm_seed_select (seed.c:56)
==23501==    by 0x41FB50: mm_collect_matches (seed.c:81)
==23501==    by 0x40B072: collect_seed_hits (map.c:179)
==23501==    by 0x40CF85: mm_map_frag (map.c:252)
==23501==    by 0x40E0C3: worker_for (map.c:422)
==23501==    by 0x412481: ktf_worker (kthread.c:47)
==23501==    by 0x5356DD4: start_thread (pthread_create.c:307)
==23501==    by 0x5668EAC: clone (clone.S:111)
==23501== 
[M::worker_pipeline::36.208*1.01] mapped 27 sequences
[M::main] Version: 2.20-r1061
[M::main] CMD: ./minimap2-2.20_x64-linux/minimap2 --sam-hit-only -Y -a -x asm10 -t 10 ref.fa.gz map.fa.gz
[M::main] Real time: 36.289 sec; CPU: 36.768 sec; Peak RSS: 0.619 GB
==23501== 
==23501== HEAP SUMMARY:
==23501==     in use at exit: 0 bytes in 0 blocks
==23501==   total heap usage: 123,045 allocs, 123,045 frees, 1,028,620,143 bytes allocated
==23501== 
==23501== All heap blocks were freed -- no leaks are possible
==23501== 
==23501== Use --track-origins=yes to see where uninitialised values come from
==23501== For lists of detected and suppressed errors, rerun with: -s
==23501== ERROR SUMMARY: 1896 errors from 3 contexts (suppressed: 0 from 0)
@moold moold changed the title A bug detected by valgrind-3.16.1 in minimap2-2.20_x64-linux A bug detected by valgrind-3.16.1 in minimap2-2.20_x64-linux ? Jun 4, 2021
lh3 added a commit that referenced this issue Jun 16, 2021
@lh3 lh3 added the bug label Jun 16, 2021
@lh3
Copy link
Owner

lh3 commented Jun 16, 2021

Actually in both cases, the conditional jumps from uninitialized values would lead to a deadend and the results are not used downstream. They are both harmless. I still fixed these anyway. Thanks for the report.

@lh3 lh3 closed this as completed Jun 16, 2021
@wangyugui
Copy link

@lh3

There is a bug in this patch(3f71478: Heng Li: r1063: fixed an uninitialized access (#752)).

With this patch, the memory usage of 'minimap2 -x sr -k15 -w1 -n12 -f500,1500' will become over 110G from 34G.

And this problem is yet not fixed in current master(7025b0b).

Best Regards

@lh3
Copy link
Owner

lh3 commented Jun 29, 2021

I have got a similar bug report. I will look into this later. Thanks.

@lh3 lh3 reopened this Jun 29, 2021
@lh3 lh3 closed this as completed in e6cce01 Jun 30, 2021
@lh3
Copy link
Owner

lh3 commented Jun 30, 2021

It is a bug caused by that commit. Please try the latest github HEAD. I believe it has been fixed.

Luke20000429 pushed a commit to Minimap2onGPU/mm2-gb that referenced this issue Jun 7, 2022
Luke20000429 pushed a commit to Minimap2onGPU/mm2-gb that referenced this issue Jun 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants