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

x/mobile/app: trying to close the closed channel #10686

Closed
rakyll opened this issue May 4, 2015 · 2 comments
Closed

x/mobile/app: trying to close the closed channel #10686

rakyll opened this issue May 4, 2015 · 2 comments

Comments

@rakyll
Copy link
Contributor

rakyll commented May 4, 2015

There is a race condition I came across on android.go. It's reproducible with the program below.

import "golang.org/x/mobile/app"

func main() {
    app.Run(app.Callbacks{})
}
  1. Launch the app.
  2. Use back button to stop it.
  3. Relaunch the app.

The following panic happens.

I/GoLog   (12527): app.Run called
I/Go      (12527): app.Run
E/Go      (12527): panic: close of closed channel
E/Go      (12527): goroutine 12 [running, locked to thread]:
E/Go      (12527): golang.org/x/mobile/app.run(0xf43bae30, 0xf43bae34, 0xf43bae2c, 0xf43bae38)
E/Go      (12527):  /Users/jbd/src/golang.org/x/mobile/app/android.go:281 +0x144
E/Go      (12527): golang.org/x/mobile/app.Run(0xf43bae30, 0xf43bae34, 0xf43bae2c, 0xf43bae38)
E/Go      (12527):  /Users/jbd/src/golang.org/x/mobile/app/app.go:20 +0x3c
E/Go      (12527): main.main()
E/Go      (12527):  /Users/jbd/src/github.com/rakyll/gopher/main.go:77 +0x50
E/Go      (12527): golang.org/x/mobile/app/internal/callfn.CallFn(0xf420488c)
E/Go      (12527):  /Users/jbd/src/golang.org/x/mobile/app/internal/callfn/callfn_arm.s:10 +0x20
E/Go      (12527): created by golang.org/x/mobile/app.callMain
E/Go      (12527):  /Users/jbd/src/golang.org/x/mobile/app/android.go:79 +0x16c
E/HTC Acoustic(  202): set_rt5506_amp:mode = 0 device = 0x4
D/HTC Acoustic(  202): query headset om 3
E/Go      (12527): goroutine 17 [syscall, locked to thread]:
D/HTC Acoustic(  202): premode = 7, rt5506mode=7

/cc @crawshaw @hyangah

@crawshaw crawshaw self-assigned this May 4, 2015
@crawshaw
Copy link
Member

crawshaw commented May 4, 2015

I rewrote a lot of the state handling this morning to deal with this and several other bugs and limitations. I'll pull it apart and send out the CLs over the next couple days.

@gopherbot
Copy link

CL https://golang.org/cl/9708 mentions this issue.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 10, 2021
Config provides a way to concurrently access Width and Height.

Register provides a way for packages to run code on app state change
without plumbing changes all the way to the process main function.
This is motivated by gl/glutil.Image which needs to rebuild its
textures on start/stop and can be deeply nested.
(See golang.org/cl/9707 for the followup.)

Tested manually on android and darwin/amd64. Doing this kind makes it
clear any CL modifying this code needs a lot of manual testing right
now, so some kind of trybot support is something I'm going to
prioritise.

Fixes golang/go#10686
Fixes golang/go#10461
Fixes golang/go#10442
Fixes golang/go#10226
Updates golang/go#10327

Change-Id: I2882ebf3995b6ed857cda823e94fbb17c54b43a8
Reviewed-on: https://go-review.googlesource.com/9708
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 11, 2021
Config provides a way to concurrently access Width and Height.

Register provides a way for packages to run code on app state change
without plumbing changes all the way to the process main function.
This is motivated by gl/glutil.Image which needs to rebuild its
textures on start/stop and can be deeply nested.
(See golang.org/cl/9707 for the followup.)

Tested manually on android and darwin/amd64. Doing this kind makes it
clear any CL modifying this code needs a lot of manual testing right
now, so some kind of trybot support is something I'm going to
prioritise.

Fixes golang/go#10686
Fixes golang/go#10461
Fixes golang/go#10442
Fixes golang/go#10226
Updates golang/go#10327

Change-Id: I2882ebf3995b6ed857cda823e94fbb17c54b43a8
Reviewed-on: https://go-review.googlesource.com/9708
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants