-
Notifications
You must be signed in to change notification settings - Fork 442
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
htslib 1.9 aborts in bcf_update_format invoked from cyvcf2 autotests #813
Comments
Original problem now fixed, but we might want to look into making |
@daviesrob: Ouch. Apologies if the following rant is not intended for you... hoping not to shoot the messenger. BUT here are the docs for
Would you be so kind as to point out where it says that it can be called only once with a resize? How are we even to know if a resize is necessary? And thanks for classifying all object bindings to More constructively, can you help us understand what needs to be done to properly document which other functions in htslib are similarly limited to a single resize? And help us to understand what needs to be done to generalize the functionality? I and others are happy to step up to do the work, but we're not bloody mind readers. |
I wrote neither the function nor its documentation. The assert statement in question can be triggered by calling This of course has nothing to do with what language or object bindings you happen to be using. It fact cyvcf2 (and possibly also pysam) avoids this problem if built with an embedded htslib by disabling asserts, which (as far as I can tell) results in htslib leaking memory instead of calling I think this should be reasonably easy to fix, so we should be able to get it to work as advertised for people who are indecisive about what value they want to store. I should add that this limitation is also present in |
I apologize for the grumpy tone of my initial response and appreciate your more constructive reply. Is the solution as simple as transforming the asserts into calls to free those extra pointers? I admit I've not yet looked at the specific code, but will dedicate some time to doing so in the coming days. |
As far as I can tell, yes. The pointer would need to be freed in a similar way to when tags are removed here. In fact thinking about it, that should act as a work-around - call Any fix would need additions to the test harness to ensure that it gets exercised. |
Rather than asserting that no value has previously been set, free any previously set value array before unpacking the new one. Fixes samtools#813. (This free() is all that's left after duplicating the "Mark the tag for removal, free existing memory if necessary" code from earlier in each function, and removing assignments that are unnecessary due to the immediately following bcf_unpack_info/fmt_core1() call.) Add test cases that update to small, large, and finally middle-sized values, so that both reallocation and reuse are exercised.
Hello,
The htslib shipping with cyvcf2 was substituted with the official release 1.9. The problem reproduces with both Python 2 and Python 3 (3.7).
First reported on brentp/cyvcf2#109
The text was updated successfully, but these errors were encountered: