termux-clipboard-set: ANR if left running
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.3k
- Forks
- 920
- PR merge metrics
- No merged PRs in 30d
Description
Problem description
If termux-clipboard-set is launched interactively (i.e. with an open stdin), it crashes after a minute and an Application Not Responding is logged. Plausibly this can happen for any API calls held open.
Steps to reproduce
$ termux-clipboard-set
(exit 0 after 1 minute)
ANR
ANR in com.termux.api
PID: 19193
Reason: Broadcast of Intent { flg=0x80010 cmp=com.termux.api/.TermuxApiReceiver (has extras) }
ErrorId: 9035ebba-fe91-4137-8db2-113cfa060170
Frozen: false
Load: 0.0 / 0.0 / 0.0
----- Output from /proc/pressure/memory -----
some avg10=0.16 avg60=0.29 avg300=0.26 total=4226554833
full avg10=0.03 avg60=0.08 avg300=0.06 total=1661117865
----- End output from /proc/pressure/memory -----
CPU usage from 20597ms to 0ms ago (2024-10-30 00:35:59.958 to 2024-10-30 00:36:20.555):
...
17% TOTAL: 8.6% user + 7.2% kernel + 0% iowait + 1.6% irq + 0.3% softirq
CPU usage from 979053254ms to 979053254ms ago (1970-01-01 01:00:00.000 to 1970-01-01 01:00:00.000) with 0% awake:
0% TOTAL: 0% user + 0% kernel
Killing 19193:com.termux.api/u0a291 (adj 250): bg anr
Completed ANR of com.termux.api in 163ms, latency 4ms
Expected behavior
No ANR, and the tool not to close early.
Does it need to wait for stdin to reach EOF before making the API call with the finished input?
Additional information
- termux-api application version: 0.50.1
- termux-api package version (installed through apt): 0.58.0
- Android OS version: 13
- Device model: OnePlus Nord CE
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.
Research direction
Reproduce the issue with termux-clipboard-set and an open stdin, then inspect the com.termux.api/.TermuxApiReceiver entry point and the clipboard command's stdin handling. The fix is done when the command waits for the intended input without triggering an ANR or closing early on Android 13.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- api, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100