-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
abyss-pe: increase stack size limit for certain ABySS programs
We were seeing stack overflows in the `abyss-bloom-dbg` program on conifer genomes, caused by graph searches implemented with recursion. We also occasionally see stack overflows in `SimpleGraph` and `PathConsensus`, also due to recursive graph searches. As a workaround for this problem, I have added a wrapper script called `abyss-stack-size` which runs a shell command with an increased max stack size, using `ulimit -s`.
- Loading branch information
Ben Vandervalk
committed
Dec 4, 2018
1 parent
f7a3e1d
commit 017e6c9
Showing
3 changed files
with
36 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/sh | ||
|
||
if [ $# -lt 2 ]; then | ||
echo "Usage: $(basename $0) <STACK_SIZE> <COMMAND>" >&2 | ||
echo "Run COMMAND in a shell with a maximum stack size of" >&2 | ||
echo "at least STACK_SIZE in kilobytes." >&2 | ||
exit 1 | ||
fi | ||
min_stack=$1; shift | ||
|
||
# Note: A max stack size of "unlimited" may not actually | ||
# be unlimited. For example, on Linux, using "unlimited" | ||
# results in a max stack size of 2 MB, which | ||
# is less than the default max stack size of 8 MB. | ||
# How confusing! | ||
|
||
stack=$(ulimit -s) | ||
if [ "$stack" = "unlimited" ] || [ "$stack" -lt "$min_stack" ]; then | ||
ulimit -s $min_stack | ||
fi | ||
stack=$(ulimit -s) | ||
|
||
echo "Running with max stack size of $stack KB: $*" >&2 | ||
exec /bin/sh -c "$*" | ||
|