Detect arguments that would exceed limits, attempt to raise limits, and fail early if not possible

Open
#376 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
42/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
c

Research direction

Start by tracing how command-line arguments determine the number of input files and where file descriptors are opened. Review the POSIX getrlimit and setrlimit behavior described in the issue, then check the existing error paths for resource-limit failures. Done means limits are checked and raised when possible, with a clear error status and message when they cannot support the requested inputs.

Written by the indexing model from the issue text.

Description

D2: Moderate P2: Desirable

There have been a couple of issues (#119, #329) that ended up being an issue with OS resource limits on the number of open files, but this was not obvious to the users because bcftools did not report a useful error message.

In addition to reporting the error at the time it occurs I think it would be useful to add a new feature that would check system limits (i.e. with getrlimit on POSIX systems) against the number of file descriptors that appear to be necessary based on the command-line arguments, and if the need is greater than the limit, attempt to raise the limit (i.e. with setrlimit). If the limit is not high enough and cannot be raised, bcftools should exit with an error status and print a clear message as to what the problem is (e.g. "Processing will require 1503 open file descriptors, but limit cannot be raised past 1024 - please raise the limit or try again with fewer input files.").

Dominant language
C
Stars
891
Forks
277
Avg merge
2d 23h
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from samtools/bcftools

All issues in samtools/bcftools

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.