_jcd_show_tab_busy_indicator infinite loop can cause 100% CPU usage if not properly killed
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 50/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- bash, shell
- Domain
- cli, performance
Research direction
Read jcd_function.sh lines 294-311, starting with _jcd_show_tab_busy_indicator and how its parent starts or stops it. Reproduce the tab-completion scenario if possible, then verify the indicator cannot run indefinitely or leave a process consuming CPU. Done means the busy indicator has a bounded lifetime while preserving its intended animation.
Written by the indexing model from the issue text.
Description
Description
The _jcd_show_tab_busy_indicator() function in jcd_function.sh contains an unbounded while true loop that can orphan and consume 100% CPU if the parent process fails to kill it properly.
Location
jcd_function.sh lines 294-311:
_jcd_show_tab_busy_indicator() {
sleep 0.5
local dot_count=0
while true; do
tput rc >&2
tput el >&2
# ... animation code ...
sleep 0.3
done
}
Steps to Reproduce
The exact trigger is unclear, but after extended use of jcd tab completion, a bash session became stuck at 100% CPU with the process in state R+ (running, foreground). The process accumulated over 10 minutes of CPU time and was resistant to SIGKILL.
Environment
- Linux (Debian-based)
- Bash 5.x
- jcd sourced via
.bashrc
Suggested Fix
Add a maximum iteration limit or timeout to prevent infinite spinning:
_jcd_show_tab_busy_indicator() {
local max_iterations=100 # ~30 seconds max
local count=0
sleep 0.5
while [[ $count -lt $max_iterations ]]; do
tput rc >&2
tput el >&2
case $((count % 4)) in
0) printf "" >&2 ;;
1) printf "." >&2 ;;
2) printf ".." >&2 ;;
3) printf "..." >&2 ;;
esac
count=$((count + 1))
sleep 0.3
done
}
- Dominant language
- Shell
- Stars
- 175
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/Sysinternals-jcd
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
Windows Version Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
microsoft/Sysinternals-jcd#19 · 4 comments · 13 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
microsoft/Sysinternals-jcd#14 · 11 comments ·
All issues in microsoft/Sysinternals-jcd
Similar issues
-
Update Vish to 1.1.5 Openpackage-update
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
oSoWoSo/vOid_Community_repOsitory#144 · 1 comment ·
-
help wanted new command
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
tldr-pages/tldr#24151 ·
-
PacReq: Rune IDE Openpackage request
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
pacstall/pacstall-programs#9402 ·
-
[BUG] ci: the first prefetch-images.sh call runs before shard.txt exists, so it is always a no-op Openbug github-actions
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
update-request
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
msys2/MINGW-packages#31768 ·