Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.IllegalStateException: Already released #2767

Closed
EricBigGod opened this issue Dec 28, 2017 · 4 comments
Closed

java.lang.IllegalStateException: Already released #2767

EricBigGod opened this issue Dec 28, 2017 · 4 comments
Labels
Milestone

Comments

@EricBigGod
Copy link

Glide Version:
4.4.0

Integration libraries:
"com.squareup.okhttp3:okhttp:3.6.0",
"com.squareup.okhttp3:logging-interceptor:3.6.0",
"com.github.bumptech.glide:glide:4.4.0",
'com.github.bumptech.glide:compiler:4.4.0',
"com.github.bumptech.glide:okhttp3-integration:4.4.0",

Device/Android Version:
Huawei P6-T00 4.4.2

Issue details / Repro steps / Use case background:
I come across a crash when i quickly drag RecyclerView. I want to load original picture when load failed the thumbnail. if i delete "error(Glide.with(applicationContext).load(url))", it will be good running.

Glide load line / GlideModule (if any) / list Adapter code (if any):

            Glide.with(applicationContext)
                    .load(Utils.getImageCompress(url))
                    .error(Glide.with(applicationContext).load(url))
                    .into(mImageView);

Layout XML:

<com.xxxx.views.AsyncRoundedImageView
            android:id="@id/imageview1"
            android:layout_width="@dimen/_190px2dp"
            android:layout_height="@dimen/_190px2dp"
            android:layout_below="@id/imageview6"
            android:layout_toRightOf="@id/imageview6"
            android:src="@mipmap/ic_launcher"
            app:riv_corner_radius="@dimen/_6px2dp" />

Stack trace / LogCat:

java.lang.IllegalStateException: Already released
    at com.bumptech.glide.util.pool.StateVerifier$DefaultStateVerifier.throwIfRecycled(StateVerifier.java:44)
    at com.bumptech.glide.request.SingleRequest.onLoadFailed(SingleRequest.java:595)
    at com.bumptech.glide.request.SingleRequest.onLoadFailed(SingleRequest.java:591)
    at com.bumptech.glide.load.engine.EngineJob.handleExceptionOnMainThread(EngineJob.java:292)
    at com.bumptech.glide.load.engine.EngineJob$MainThreadCallback.handleMessage(EngineJob.java:325)
    at android.os.Handler.dispatchMessage(Handler.java:98)
    at android.os.Looper.loop(Looper.java:136)
    at android.app.ActivityThread.main(ActivityThread.java:5253)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:939)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
    at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
    at dalvik.system.NativeStart.main(Native Method)
@sjudd sjudd added the bug label Dec 28, 2017
@sjudd
Copy link
Collaborator

sjudd commented Dec 28, 2017

b/70890856

@sjudd
Copy link
Collaborator

sjudd commented Dec 28, 2017

Thanks for filling out the issue template and the detail about error(Glide.with(applicationContext).load(url)). I believe this occurs because we fail to clear the error request if it's in progress here:

.

The call to primary.isFailed() will always return false because the state is reset from failed to cleared when we call primary.clear() in the line before.

@huongtran84
Copy link

I still face the bug.
Glide Version:
4.9.0

Issue details / Repro steps / Use case background:
Activity1: launch to Activity 2
Activity2: change image then finish back Activity1

Glide load line / GlideModule (if any) / list Adapter code (if any):
GlideApp.with(this).asDrawable()
.load(getImage(eventClicked.imageName))
.centerCrop()
.override(200, 200)
.into(new Target()
{
@OverRide
public void onLoadStarted(@nullable Drawable placeholder)
{

                    }

                    @Override
                    public void onLoadFailed(@Nullable Drawable errorDrawable)
                    {

                    }

                    @Override
                    public void onResourceReady(@NonNull Drawable resource, @Nullable Transition<? super Drawable> transition)
                    {
                        try {
                            Bitmap bitmap = Bitmap.createBitmap(AppConfig.PHOTO_SCALE_FACTOR, AppConfig.PHOTO_SCALE_FACTOR, Bitmap.Config.ARGB_8888);
                            Canvas canvas = new Canvas(bitmap);
                            FileOutputStream outputStream = openFileOutput("profilePicture", MODE_PRIVATE);

                            resource.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
                            resource.draw(canvas);
                            bitmap.compress(Bitmap.CompressFormat.PNG, 100, outputStream);

                            outputStream.close();

                            notifyUserProfileChanged();
                        } catch (Exception error) {
                            error.printStackTrace();
                        }
                    }

                    @Override
                    public void onLoadCleared(@Nullable Drawable placeholder)
                    {

                    }

                    @Override
                    public void getSize(@NonNull SizeReadyCallback cb)
                    {

                    }

                    @Override
                    public void removeCallback(@NonNull SizeReadyCallback cb)
                    {
                    }

                    @Nullable
                    @Override
                    public Request getRequest()
                    {
                        return null;
                    }

                    @Override
                    public void setRequest(@Nullable Request request)
                    {

                    }

                    @Override
                    public void onStart()
                    {

                    }

                    @Override
                    public void onStop()
                    {

                    }

                    @Override
                    public void onDestroy()
                    {

                    }
                });

Stack trace / LogCat:
java.lang.IllegalStateException: Already released
at com.bumptech.glide.util.pool.StateVerifier$DefaultStateVerifier.throwIfRecycled(StateVerifier.java:46)
at com.bumptech.glide.request.SingleRequest.begin(SingleRequest.java:236)
at com.bumptech.glide.manager.RequestTracker.resumeRequests(RequestTracker.java:128)
at com.bumptech.glide.RequestManager.resumeRequests(RequestManager.java:292)
at com.bumptech.glide.RequestManager.onStart(RequestManager.java:317)
at com.bumptech.glide.manager.ActivityFragmentLifecycle.onStart(ActivityFragmentLifecycle.java:51)
at com.bumptech.glide.manager.SupportRequestManagerFragment.onStart(SupportRequestManagerFragment.java:182)
at androidx.fragment.app.Fragment.performStart(Fragment.java:2478)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:919)
at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1229)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1295)
at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2605)
at androidx.fragment.app.FragmentManagerImpl.dispatchStart(FragmentManagerImpl.java:2571)
at androidx.fragment.app.FragmentController.dispatchStart(FragmentController.java:256)
at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:533)
at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:179)

@Dpuntu
Copy link

Dpuntu commented Jun 16, 2020

I have the same problem,but I don’t know repro steps。

`
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: java.lang.IllegalStateException: Already released
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at com.bumptech.glide.util.pool.StateVerifier$DefaultStateVerifier.throwIfRecycled(StateVerifier.java:46)
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at com.bumptech.glide.request.SingleRequest.begin(SingleRequest.java:236)
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at com.bumptech.glide.manager.RequestTracker.resumeRequests(RequestTracker.java:128)
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at com.bumptech.glide.RequestManager.resumeRequests(RequestManager.java:292)
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at com.bumptech.glide.RequestManager.onStart(RequestManager.java:317)
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at com.bumptech.glide.manager.ActivityFragmentLifecycle.onStart(ActivityFragmentLifecycle.java:51)
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at com.bumptech.glide.manager.RequestManagerFragment.onStart(RequestManagerFragment.java:201)
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at android.app.Fragment.performStart(Fragment.java:2560)
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1339)
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at android.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1581)
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1642)
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at android.app.FragmentManagerImpl.dispatchMoveToState(FragmentManager.java:3052)
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at android.app.FragmentManagerImpl.dispatchStart(FragmentManager.java:3009)
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at android.app.FragmentController.dispatchStart(FragmentController.java:195)
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at android.app.Activity.performStart(Activity.java:7908)
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3553)
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2250)
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:107)
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at android.os.Looper.loop(Looper.java:230)
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7783)
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:508)
06-12 09:06:17.606929 5755 5755 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants