Idle connection thread is not a daemon, so the JVM cannot exit without close()
Maintainers usually reply within 3 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- java
- Domain
- networking
Research direction
Start in httpclient/src/main/java/com/backblaze/b2/client/webApiHttpClient/HttpClientFactoryImpl.java: the constructor at lines 60-61 creates and starts the idle connection monitor thread, and the thread class at lines 220-246 never calls setDaemon. Reproduce by running a small main that builds a B2StorageClient with the default factory and returns without close(), then check whether the JVM stays alive. Done when the JVM exits on its own and the existing tests still pass after the thread is marked as a daemon before start().
Written by the indexing model from the issue text.
Description
What happens
HttpClientFactoryImpl starts an IdleConnectionMonitorThread in its constructor, and the thread is never marked as a daemon. A program that creates a client and does not call close() on it keeps running after main returns, with no message. Calling close() is documented as the right way, but the hang is easy to hit in short programs and tests.
Where
httpclient/src/main/java/com/backblaze/b2/client/webApiHttpClient/HttpClientFactoryImpl.java:60-61 (constructor creates and starts the thread) and :220-246 (the thread class, which does not call setDaemon(true); no setDaemon call exists anywhere in the repository).
Why it matters
Impact: Left behind (a running thread keeps the process alive), silent. Severity: Medium, because it only happens when the caller never closes the client (an unusual condition, since B2StorageClientImpl documents that close() should be called) and the workaround is to call close().
How to check
Found by reading the code, not reproduced. Read the constructor and the thread class. Running a small main that builds a B2StorageClient with the default factory and returns without closing it should leave the JVM running (a thread dump would show the monitor thread). Calling setDaemon(true) before start() would let the JVM exit.
Version
Seen at v6.5.0. Present on the default branch: present.
- Dominant language
- Java
- Stars
- 103
- Forks
- 23
- Avg merge
- 5d 8h
- Merged PRs (30d)
- 3
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
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 Backblaze/b2-sdk-java
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Backblaze/b2-sdk-java#248 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Backblaze/b2-sdk-java#247 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Backblaze/b2-sdk-java#246 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Backblaze/b2-sdk-java#245 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Backblaze/b2-sdk-java#242 ·
Maintainers usually reply within 3 days
All issues in Backblaze/b2-sdk-java
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
IETF-Hackathon/pqc-certificates#351 ·
Maintainers usually reply within 2 days
-
hermes-queue
Difficulty 2/5 Under an hour Newbie friendliness 72/100
chrisalunlloyd2-sudo/mindpalace#393 ·
Maintainers usually reply within 1 day
-
core-types enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
higher-kinded-j/higher-kinded-j#1509 ·
Maintainers usually reply within 1 day