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

iOS app stops re-drawing mid frame after a while #950

Closed
andydotxyz opened this issue May 7, 2020 · 12 comments
Closed

iOS app stops re-drawing mid frame after a while #950

andydotxyz opened this issue May 7, 2020 · 12 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed OS:iOS Tickets affecting only iOS devices

Comments

@andydotxyz
Copy link
Member

andydotxyz commented May 7, 2020

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
  4. Window is only partially painted and window stops responding.

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

@andydotxyz andydotxyz added blocker Items that would block a forthcoming release bug Something isn't working labels May 7, 2020
@andydotxyz
Copy link
Member Author

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.

@steveoc64
Copy link
Member

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

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

@steveoc64
Copy link
Member

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

@andydotxyz andydotxyz self-assigned this May 8, 2020
@andydotxyz andydotxyz added OS:Android Tickets affecting only Android devices OS:iOS Tickets affecting only iOS devices labels May 19, 2020
@andydotxyz andydotxyz mentioned this issue May 20, 2020
3 tasks
@andydotxyz
Copy link
Member Author

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

@andydotxyz
Copy link
Member Author

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...)

@andydotxyz
Copy link
Member Author

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...

@andydotxyz
Copy link
Member Author

andydotxyz commented May 27, 2020

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()
}

andydotxyz added a commit to andydotxyz/fyne that referenced this issue May 29, 2020
@andydotxyz
Copy link
Member Author

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

@andydotxyz
Copy link
Member Author

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

@andydotxyz
Copy link
Member Author

andydotxyz commented Dec 11, 2020

This is happening (on iOS) again 😢

@andydotxyz andydotxyz added this to the Fixes (v2.1.x) milestone Sep 12, 2021
@changkun
Copy link
Member

I think I've found the root cause with solid evidence. I will try to patch a PR with more details of the issue, and hopefully, we can fix it permanently.

@andydotxyz
Copy link
Member Author

Fix on develop for testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed OS:iOS Tickets affecting only iOS devices
Projects
None yet
Development

No branches or pull requests

3 participants