htslib/c what is the correct way to use bgzf_thread_pool ?
1
1
Entering edit mode
15 months ago

I try to split fastq files into 'N' chunks using a simple CC program and htslib-C . It works fine:

./split2file -o TMP S1.R1.fq.gz S1.R2.fq.gz -n 10 

but when I use a thread pool ( As far as I understand I can use one and only one thread pool for reading and writing the files ?)

./split2file -o TMP S1.R1.fq.gz S1.R2.fq.gz -n 10 -t 2
[LOG] closing "TMP.00001.R1.fastq.gz" N=100.
Segmentation fault

When I use threads I've got a SIGSEGV signal.

here is the gdb stacktrace:

#0  0x00007ffff718209b in pthread_cond_signal@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x00007ffff7f56770 in hts_tpool_dispatch3 () from /CONDAS/users/ifb-tools/miniconda3/envs/samtools-1.15.1/lib/libhts.so.3
#2  0x00007ffff7f11d42 in mt_queue () from /CONDAS/users/ifb-tools/miniconda3/envs/samtools-1.15.1/lib/libhts.so.3
#3  0x00007ffff7f148e5 in bgzf_flush () from /CONDAS/users/ifb-tools/miniconda3/envs/samtools-1.15.1/lib/libhts.so.3
#4  0x00007ffff7f14b76 in bgzf_close () from /CONDAS/users/ifb-tools/miniconda3/envs/samtools-1.15.1/lib/libhts.so.3
#5  0x0000555555557a3d in PairedEnd::~PairedEnd() ()
#6  0x0000555555556bc3 in main ()

here is the code:

(removed)

What Am i doing wrong ?

fastq multithread htslib C • 645 views
ADD COMMENT
2
Entering edit mode
15 months ago

answering my question:

i was calling hts_tpool_destroy(pool); before closing the bgz output writers.

ADD COMMENT

Login before adding your answer.

Traffic: 1618 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6