Fyne: iOS app stops re-drawing mid frame after a while

Created on 7 May 2020  路  9Comments  路  Source: fyne-io/fyne

Describe the bug:

Run a Fyne app on an iOS device and it works well for a minute or two.
Then it freezed mid-frame (bottom half of the screen is bgcolour) and does not respond.
Rotating will turn the screen black. Force quit required.

To Reproduce:

Steps to reproduce the behaviour:

  1. Load fyne_demo on iOS device
  2. Tap around and cause lots of redraws (theme setting for example).
  3. See drawing eventually stops

Screenshots:

8DC1ABCE-AE15-4559-838D-B97576484091

Device (please complete the following information):

  • OS: iOS
  • Version: 13.3.1
  • Go version: 1.12.4
  • Fyne version: develop

I think this happened on 1.2.x as well

Android iOS blocker bug

Most helpful comment

maybe if we audit the GLES interface and make sure its not ignoring errors

All 9 comments

I think this may be tied to either text or scroller... it does not happen in every app.
My gameboy app for example can quite happily run for 20 - 30 minutes without any issue, but it is only images and event rectangles.

I have seen this happen exactly the same on Android as well

esp the bit about rotate = black screen of death + hard reset

maybe if we audit the GLES interface and make sure its not ignoring errors

Maybe we can re-use the code that was maxing out refresh event queue to see if this can be reproduced?

I may have been mistaken as to where the freeze occurs. For the corrupted content to be visible it implies that the publish event has been called... So somehow the paint cycle seems to have finished early (like part way through a widget) and then published but something in gomobile stops the event thread before the next frame.

So it could be outside an openGL call. I have not yet been able to capture the stack in this state (in fact I'm not sure how...)

OK, In the vendored github.com/fyne-io/mobile/gl/work.go around line 90 I updated work: make(chan call, workbufLen*4), (add the *4 part) and it seems to help.
Could other people please try this out and see if you can still reproduce this issue (@stuartmscott :))? My working hypothesis was that if enough GL items got queued between processing then the call could hang and somehow that hangs the processing routine...

Of course maybe it just makes it 4*less likely, but I don't think that's the case...

A modified version of #904 helped to replicate this reliably:

package main

import (
    "image/color"

    "fyne.io/fyne"
    "fyne.io/fyne/app"
    "fyne.io/fyne/canvas"
    "fyne.io/fyne/layout"
    "fyne.io/fyne/widget"
)

func main() {
    app := app.New()
    win := app.NewWindow("Some Window")

    cells := make([]fyne.CanvasObject, 0, 80*25)
    for i := 0; i < 80; i++ {
        for j := 0; j < 25; j++ {
            cells = append(cells, canvas.NewRectangle(color.RGBA{R: 255, G: 255, B: 255, A: 128}))
        }
    }
    container := fyne.NewContainerWithLayout(layout.NewGridLayout(25), cells...)

    c := 0
    b := widget.NewButton("START", func() {
        for i := 0; i < 80; i++ {
            for j := 0; j < 25; j++ {
                index := i*25 + j
                obj, _ := container.Objects[index].(*canvas.Rectangle)
                if c == 0 {
                    obj.FillColor = color.RGBA{R: 20, G: 30, B: 100, A: 128}
                } else if c == 1 {
                    obj.FillColor = color.RGBA{R: 100, G: 20, B: 30, A: 128}
                } else if c == 2 {
                    obj.FillColor = color.RGBA{R: 30, G: 100, B: 20, A: 128}
                }
                obj.Refresh()
            }
        }
        c = (c+1)%3
    })

    win.SetContent(fyne.NewContainerWithLayout(layout.NewBorderLayout(nil, b, nil,  nil), container, b))
    win.ShowAndRun()
}

I think it's finally tracked down and fixed in #1013

This is now on develop for testing - please re-open with any details you have if it is observed again.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lusingander picture lusingander  路  3Comments

develar picture develar  路  6Comments

semyon-dev picture semyon-dev  路  4Comments

steveoc64 picture steveoc64  路  7Comments

boussou picture boussou  路  9Comments