Issue 1:
Glide Version: 4.0.0

Integration libraries: None

Device/Android Version: Genymotion Nexus 5X 7.1.1

Issue details / Repro steps / Use case background: While scrolling in a RecyclerView with many pictures (~60) app crashes and throws a ConcurrentModificationException.

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

void loadFromUrls(Context context, ImageView view, String url, String thumbUrl, RequestListener<Bitmap> listener, boolean transform, float sizeMultiplier) {

RequestOptions options = RequestOptions().diskCacheStrategy(DiskCacheStrategy.RESOURCE).dontAnimate();
if (!transform) options.dontTransform();

if (!thumbUrl.isEmpty()) {
Glide.with(context).asBitmap().load(url)
.thumbnail(Glide.with(context).asBitmap().load(thumbUrl)
.thumbnail(sizeMultiplier)
.apply(options.priority(Priority.IMMEDIATE)))
.apply(options.priority(Priority.HIGH))
.listener(listener)
.into(view);
} else if (!url.isEmpty()) {
Glide.with(context).asBitmap().load(url).thumbnail(sizeMultiplier)
.apply(options.priority(Priority.HIGH))
.listener(listener)
.into(view);
}
}

Layout XML:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:foreground="?selectableItemBackground">

<ImageView
android:id="@+id/wallpaper_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
tools:ignore="ContentDescription"/>

<LinearLayout
android:id="@+id/wallpaper_details"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="68dp"
android:paddingStart="@dimen/fabs_margin"
android:paddingLeft="@dimen/fabs_margin"
android:paddingEnd="@dimen/fabs_margin"
android:paddingRight="@dimen/fabs_margin"
android:layout_gravity="start|bottom"
android:gravity="start|bottom"
tools:ignore="UseCompoundDrawables">

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:layout_gravity="center_vertical"
android:gravity="center_vertical">

<TextView
android:id="@+id/wallpaper_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:ellipsize="end"
android:textColor="@android:color/white"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textSize="16sp"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
tools:text="Wallpaper name"/>

<TextView
android:id="@+id/wallpaper_author"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:maxLines="1"
android:ellipsize="end"
android:textColor="@android:color/white"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textSize="12sp"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
tools:text="John Doe"/>

</LinearLayout>

<ImageView
android:id="@+id/heart_icon"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="?selectableItemBackgroundBorderless"
android:visibility="gone"
android:layout_gravity="center"
android:gravity="center"
tools:ignore="ContentDescription"/>

</LinearLayout>

</FrameLayout>

Stack trace / LogCat:

E/AndroidRuntime: FATAL EXCEPTION: main
Process: jahirfiquitiva.apps.test, PID: 13226
java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.next(ArrayList.java:831)
at com.bumptech.glide.request.target.ViewTarget$SizeDeterminer.notifyCbs(ViewTarget.java:180)
at com.bumptech.glide.request.target.ViewTarget$SizeDeterminer.checkCurrentDimens(ViewTarget.java:197)
at com.bumptech.glide.request.target.ViewTarget$SizeDeterminer$SizeDeterminerLayoutListener.onPreDraw(ViewTarget.java:310)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:944)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2205)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1254)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6337)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:874)
at android.view.Choreographer.doCallbacks(Choreographer.java:686)
at android.view.Choreographer.doFrame(Choreographer.java:621)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:860)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

Issue 2:
Glide Version: 4.0.0

Integration libraries: okhttp3-integration

Device/Android Version: Galaxy Note 5 7.0/Nexus 6P 8.0

In my app there is a list (RecyclerView) of images, which load through Glide. Some images are GIF, so for them I use static thumbnails. When I quickly scroll down and up the app crashes with following exception:

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.blinkseven.jrviewer, PID: 18619
java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.next(ArrayList.java:831)
at com.bumptech.glide.request.target.ViewTarget$SizeDeterminer.notifyCbs(ViewTarget.java:180)
at com.bumptech.glide.request.target.ViewTarget$SizeDeterminer.checkCurrentDimens(ViewTarget.java:197)
at com.bumptech.glide.request.target.ViewTarget$SizeDeterminer$SizeDeterminerLayoutListener.onPreDraw(ViewTarget.java:310)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1013)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2513)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1522)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7098)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:927)
at android.view.Choreographer.doCallbacks(Choreographer.java:702)
at android.view.Choreographer.doFrame(Choreographer.java:638)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:913)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6682)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)

I noticed that the app crashes only on items with GIFs and its thumbnails, namely when I include thumbnails loading.

Here is an example of loading GIFs with Glide:

RequestBuilder<Drawable> thumbnailRequest = GlideApp
.with(this)
.load(imageModel.getUri())
.thumbnail(0.5f)
.fallback(android.R.color.holo_orange_light)
.placeholder(android.R.color.holo_green_light)
.error(android.R.color.holo_red_light)
.dontAnimate();

GlideApp
.with(this)
.load(imageModel.getFullUri())
.listener(listener)
// Load gif's thumbnail through RequestBuilder
.thumbnail(thumbnailRequest)
.fallback(android.R.color.holo_orange_light)
.placeholder(android.R.color.holo_green_light)
.error(android.R.color.holo_red_light)
.into((ImageView) findViewById(R.id.image));

If exclude 'thumbnail' option there is no exception.