AnderWeb / discreteSeekBar

Apache License 2.0
2.11k stars 400 forks source link

OpenGL crash on android 6+ #73

Open aldoborrero opened 8 years ago

aldoborrero commented 8 years ago

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!

meghalshah commented 8 years ago

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

x7c1 commented 8 years ago

This crash occurs also on Nexus 6P running 6.0.1.

matthewkrueger commented 8 years ago

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.

sstoyanova commented 8 years ago

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

matthewkrueger commented 8 years ago

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.

AnderWeb commented 8 years ago

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 commented 8 years ago

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.

mshah61 commented 8 years ago

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

matthewkrueger commented 8 years ago

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.

AnderWeb commented 8 years ago

@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:

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

matthewkrueger commented 8 years ago

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.

aldoborrero commented 8 years ago

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 notifications@github.com Reply: AnderWeb/discreteSeekBar reply@reply.github.com Date: 20 April 2016 at 20:22:23 To: AnderWeb/discreteSeekBar discreteseekbar@noreply.github.com CC: Aldo Borrero aldo@aldoborrero.com, Author author@noreply.github.com 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

borwoj commented 8 years ago

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"
      >
AnderWeb commented 8 years ago

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

borwoj commented 8 years ago

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

AOrobator commented 7 years ago

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.

eproto commented 7 years ago

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.

NotTsunami commented 7 years ago

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

eproto commented 7 years ago

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

waqarul commented 7 years ago

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

GolubRoman commented 6 years ago

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

peerless2012 commented 5 years ago

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 commented 5 years ago

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