Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

DbxDownloader.close() throws java.lang.IllegalStateException: Unbalanced enter/exit

Open
#237 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
android, java
Domain
api

Research direction

Start at DbxDownloader.close() in DbxDownloader.java:131 and reproduce the cancelDownload sequence from the report. Trace the IOUtil.closeQuietly and Android OkHttp source-close frames to determine why cancellation causes “Unbalanced enter/exit.” Done means closing an active downloader no longer throws this exception, with coverage for the cancellation sequence.

Written by the indexing model from the issue text.

Description

Hi, I'm trying to cancel a download. My way to cancel is this.

public void cancelDownload(){
          if (m_dbxDownloader != null) {
              dbxDownloader.close();
              dbxDownloader = null;
          }
    }

When I call dbxDownloader.close(); is thworing an exception. The exception is this

2019-02-22 09:53:14.576 26079-26412/com.toshiba.dse.ebridge.acme.lite E/ExceptionHandler: java.lang.IllegalStateException: Unbalanced enter/exit
        at com.android.okhttp.okio.AsyncTimeout.enter(AsyncTimeout.java:62)
        at com.android.okhttp.okio.AsyncTimeout$2.read(AsyncTimeout.java:209)
        at com.android.okhttp.okio.RealBufferedSource.read(RealBufferedSource.java:60)
        at com.android.okhttp.internal.http.HttpConnection$FixedLengthSource.read(HttpConnection.java:466)
        at com.android.okhttp.internal.Util.skipAll(Util.java:164)
        at com.android.okhttp.internal.Util.discard(Util.java:146)
        at com.android.okhttp.internal.http.HttpConnection$FixedLengthSource.close(HttpConnection.java:483)
        at com.android.okhttp.okio.RealBufferedSource.close(RealBufferedSource.java:421)
        at com.android.okhttp.okio.RealBufferedSource$1.close(RealBufferedSource.java:409)
        at com.dropbox.core.util.IOUtil.closeQuietly(IOUtil.java:149)
        at com.dropbox.core.DbxDownloader.close(DbxDownloader.java:131)

Is this a problem with SDK?

Dominant language
Java
Stars
627
Forks
463
Avg merge
5m
Merged PRs (30d)
10

Contributor guide

No contributing guide indexed for this repository

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 dropbox/dropbox-sdk-java

All issues in dropbox/dropbox-sdk-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.