discreteSeekBar icon indicating copy to clipboard operation
discreteSeekBar copied to clipboard

OpenGL crash on android 6+

Open aldoborrero opened this issue 9 years ago • 23 comments

Hi,

If the component has enabled the option dsb_indicatorPopupEnabled and the device is a Nexus 5x as soon as you start dragging (and just when the animation of the popup is appearing) it explodes producing this output:

03-08 17:45:36.058 2752-2823/com.worldreader A/OpenGLRenderer: Error: Spot pair overflow!!! used 117, total 83
03-08 17:45:36.059 2752-2823/com.worldreader A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 2823 (hwuiTask1)

I think that the main culprit could be located in PopupIndicator.java class but as I didn't have proper time to investigate properly I can't say for sure.

I didn't manage to reproduce it in other devices for now.

Any ideas to move this forward?

Thanks!

aldoborrero avatar Mar 08 '16 17:03 aldoborrero

I am seeing the same issue on Nexus 9 running 6.0.

meghalshah avatar Mar 24 '16 22:03 meghalshah

This crash occurs also on Nexus 6P running 6.0.1.

x7c1 avatar Mar 30 '16 00:03 x7c1

Same crash here on Nexus 6p - it happens while dragging the slider, sometimes immediately, sometimes after you pick up the slider and set it down a few times.

matthewkrueger avatar Apr 02 '16 23:04 matthewkrueger

Same here. I use Nexus 5X running Android version 6.0.1 and it crashes when I slide.

sstoyanova avatar Apr 19 '16 19:04 sstoyanova

The main reason I picked this library was for the nice popup indicator, but since it's not working on flagship devices, it seems that I'll need to look elsewhere unless a fix is in the pipeline. Anyone have recommendations for other libraries? It seems like the developer hasn't updated this project in many months.

matthewkrueger avatar Apr 19 '16 19:04 matthewkrueger

We'd like to know the exact settings you all are using for the popup. Specifically the settings related to dsb_indicatorTextAppearance and dsb_indicatorElevation, and if changing them would make the crash stop happening or not. Thanks!

AnderWeb avatar Apr 20 '16 10:04 AnderWeb

I'm mostly sure the issue is caused by the shadow drawn by android elevation. As I don't have the affected devices to test, it would be very helpful if any of you could test dsb_indicatorElevation="0dp" (or try different values) and see if the crash still happens.

AnderWeb avatar Apr 20 '16 11:04 AnderWeb

The crash happened are 8dp elevation, it has happened for other values too. I havent tested out for no elevation. app:dsb_indicatorElevation="8dp"

mshah61 avatar Apr 20 '16 15:04 mshah61

Hi @AnderWeb thanks for commenting! I just tried with dsb_indicatorElevation="0dp" and that seems to have stopped it from crashing.

If you're curious, here is the XML snippet I'm using:

<org.adw.library.widgets.discreteseekbar.DiscreteSeekBar
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginTop="20dp"
             android:layout_marginBottom="30dp"
             android:id="@+id/distance_slider"
             app:dsb_trackColor="@color/greyBackgroundColor"
             app:dsb_progressColor="@color/greyBackgroundColor"
             app:dsb_indicatorColor="@color/buttonBackgroundColor"
             app:dsb_thumbSize="30dp"
             app:dsb_indicatorPopupEnabled="true"
             app:dsb_indicatorElevation="0dp"
             app:dsb_min="0"
             app:dsb_max="400"
             />

If you're having trouble replicating it, what makes it happen for me (when indicatorPopupEnabled="true" and elevation is left at the default, i.e. not set in XML) is touching the indicator, letting go, then touching it again. The second time I touch it to "pick up" the indicator, it crashes.

Again, with your suggestion of 0dp for indicatorElevation, it seems to have stopped crashing.

matthewkrueger avatar Apr 20 '16 16:04 matthewkrueger

@matthewkrueger thanks, I think there's an issue with shadow rendering on some devices. While searching for more info about this specific crash, I've found some people suffering it with CardView so it's not a DiscreteSeekBar only issue.

I'm not sure about a proper fix to be done. We have limited options as the issue is from android renderer stuff:

  • Proposed solution 1: completely remove the elevation thing to completely avoid the crash.
  • Proposed solution 2: leave it as it is, but just change the default value to 0dp. This would be similar to solution 1 but allowing devs to activate the "dangerous feature"
  • Proposed solution 3: do the shadow by hand. Instead relying on android rendering to draw shadows, just create it dynamically. I think the only "decent" way would be drawing the shape to a Bitmap and blur it, but this would use more memory to hold the Bitmap, so I don't really like it...

I think the safest, easiest and fastest is the solution 1, but I'm open to suggestions.

AnderWeb avatar Apr 20 '16 16:04 AnderWeb

I vote for option 1 or 2. I think option 1 is best if you don't want to deal with other issues being filed - option 2, with a bolded and very obvious warning about the feature being potentially unsafe might be a decent option as well.

matthewkrueger avatar Apr 20 '16 18:04 matthewkrueger

Yeah, for me I think the option 1 or 2 is the clear winner. This thing is not a fault on its own. Another possibility is to create the shadow like the CardLayout does for devices pre 5. Detect which are the current devices that fail with the native version and fallback to the other one. Makes sense? 

--  Aldo Borrero Sent with Airmail

From: matthewkrueger [email protected] Reply: AnderWeb/discreteSeekBar [email protected] Date: 20 April 2016 at 20:22:23 To: AnderWeb/discreteSeekBar [email protected] CC: Aldo Borrero [email protected], Author [email protected] Subject:  Re: [AnderWeb/discreteSeekBar] OpenGL crash on android 6+ (#73)

I vote for option 1 or 2. I think option 1 is best if you don't want to deal with other issues being filed - option 2, with a bolded and very obvious warning about the feature being potentially unsafe might be a decent option as well.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub

aldoborrero avatar Apr 20 '16 20:04 aldoborrero

I just encountered this crash as well on Nexus 5x running 6.0.1.

05-26 14:33:50.890 17109-17183/com.packagename A/OpenGLRenderer: Error: Spot pair overflow!!! used 149, total 94
--------- beginning of crash
05-26 14:33:50.891 17109-17183/com.packagename A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 17183 (hwuiTask1)

This is the SeekBar layout:

<org.adw.library.widgets.discreteseekbar.DiscreteSeekBar
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_marginBottom="16dp"
          android:layout_marginTop="8dp"
          app:dsb_indicatorColor="@color/colorAccent"
          app:dsb_indicatorFormatter="@string/minute_format"
          app:dsb_indicatorSeparation="0dp"
          app:dsb_max="180"
          app:dsb_min="1"
          app:dsb_progressColor="@color/colorAccent"
          app:dsb_rippleColor="@android:color/transparent"
          app:dsb_trackColor="@color/colorPrimary"
          app:dsb_value="10"
          />

The SeekBar is placed inside a CardView:

<android.support.v7.widget.CardView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="center_horizontal"
      android:layout_marginTop="24dp"
      app:cardBackgroundColor="@color/white"
      app:cardElevation="4dp"
      app:contentPadding="16dp"
      >

borwoj avatar May 26 '16 12:05 borwoj

@borwoj as noted above, use app:dsb_indicatorElevation="0dp" to avoid that openGL issue

AnderWeb avatar May 26 '16 16:05 AnderWeb

Actually I've set it to 2dp and haven't seen any crash ever since.

borwoj avatar May 31 '16 20:05 borwoj

Also experienced this issue, but with a different crash:

E/libEGL: error opening cache file /data/user/0/com.orobator.seekbarcrashtest/code_cache/com.android.opengl.shaders_cache: Permission denied (13)

Setting the indicator elevation to 0dp prevents the crash.

AOrobator avatar Sep 11 '16 21:09 AOrobator

A received spot pair overflow crash report with an elevation of 0dp:

    <org.adw.library.widgets.discreteseekbar.DiscreteSeekBar
        android:id="@+id/playback_speed_seekbar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:layout_gravity="center_horizontal"
        dsb_indicatorElevation="0dp"/>

User was running a Galaxy S6 Active on 6.0.

eproto avatar Nov 22 '16 03:11 eproto

@knoware Shouldn't it be app:dsb_indicatorElevation="0dp"?

NotTsunami avatar Nov 22 '16 03:11 NotTsunami

@Tsunamical, good point. I'll give that a try.

eproto avatar Nov 23 '16 01:11 eproto

I've a crash on LG G5, 6.0.1 OS and the issue is resolved with app:dsb_indicatorElevation="0dp" as suggested above

waqarul avatar Apr 24 '17 06:04 waqarul

I also had such problem with spot pair overflow, but using app:dsb_indicatorElevation="0dp" helped me. Try it yourself

GolubRoman avatar Jul 11 '17 21:07 GolubRoman

The crash happened are 8dp elevation, it has happened for other values too. I havent tested out for no elevation. app:dsb_indicatorElevation="8dp"

Amazing 0dp is ok or 8dp is also ok

peerless2012 avatar Mar 11 '19 07:03 peerless2012

Actually I've set it to 2dp and haven't seen any crash ever since.

I test on my device which crash on 4dp, i find 0、1、2、3、5、6、8dp is ok,And 4、7dp crash

peerless2012 avatar Mar 11 '19 08:03 peerless2012