-
Notifications
You must be signed in to change notification settings - Fork 36
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
Close CRAM reference #23
Comments
Thanks for finding this bug. Indeed, I never call I added this now to BamReader.h. It seems to work on both CRAM or BAM files without any issues. Can you let me know if it solves the problem for your case (with several thousand CRAM files), which I don't have for testing? |
Hmm, weird, when I compile with the change, it stops working entirely for BAM and CRAM. It passes your tests? This is usage like
and it now crashes on the Close() |
So I didn't get any further on the above. Same problem, when I actively call Close(), everything breaks, for BAMs and CRAMs, but when I don't call Close(), the file limit problem persists and things blow up when I use lots of CRAMs I'm having trouble making a minimal C++ only example using the example code you've listed on the README though? So "make seqtools" works for me normally, but when I try to make a new Frankenstein "seqtools.cpp" with the code from one of the examples, I get the following |
OK, now I've got what should be reproducible. With the commit I get a segfault when trying to close the reader
|
Before you spend more time on this, I realized that I had made an error with the commit to fix this issue (and erased the commit). It turns out that the original code does close the cram reference. I put a print statement in the htslib function that closes the cram reference, and confirmed it will indeed close with either calling the So that leaves me puzzled about your error. Could it be that your readers are not going out of scope or being closed soon enough? |
Ah, you deleted the commit. I thought I was crazy for awhile there. Anyway, I'm still getting the bug. Here's what should be reproducible, using one small main and one function that loads some reads out of a cram. This occurs even though I am using
and then on a cluster node without internet
log.withoutinternet.txt |
Thanks for sending along an example. Right now, it may take me some time to get to this but I am curious to get this resolved. Do you have any issues with similar pipelines that query a purely HTSlib based tool, like SAMtools? I am wondering if the issue is with SeqLib handling or with HTSlib itself. |
Hey, have been using seqLib successfully for a while, but I just ran into an issue. I have a function, and within this function, I create a BamReader object, get reads out, etc. This works well, except I've recently noticed that when I use CRAM files and set the reference using BamReader::SetCramReference, the reference is not closed when calling BamReader::Close(), or when the BamReader object goes out of scope when the function ends. So when I call my function on several thousand CRAM files, the code crashes because I don't have enough file handles. Can you please implement a method to close the cram reference?
Error message wise, when running I get this
one for each file (this is run on a cluster without internet access), then once I run out of file handles, I get
The text was updated successfully, but these errors were encountered: