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: Option to adjust the GOMAXPROCS on Android #65603

Closed
tomekit opened this issue Feb 8, 2024 · 1 comment
Closed

x/mobile: Option to adjust the GOMAXPROCS on Android #65603

tomekit opened this issue Feb 8, 2024 · 1 comment
Labels
mobile Android, iOS, and x/mobile
Milestone

Comments

@tomekit
Copy link

tomekit commented Feb 8, 2024

I am running Go library: https://pkg.go.dev/github.com/rclone/rclone/librclone on Android and iOS.

The issue is that once more than one operation runs (e.g. syncing), the application UI rendering thread blocks making app completely frozen. This is especially critical for Flutter apps (but I guess that also applies to native app) where main UI thread needs considerable amount of "CPU time" for app to render frames and be smooth.

One of the option to solve this issue might be setting GOMAXPROCS to e.g. 1. Is it possible with gomobile?

I've found this update:
https://go.dev/blog/go1.5

Related improvements to the scheduler allowed us to change the default GOMAXPROCS value (the number of concurrently executing goroutines) from 1 to the number of logical CPUs.

#16876 (comment)
and related comment:

It is not about API that takes up more than one thread, but about blocking calls. For example, imagine a goroutine calls FileOutputStream.write to write a file locally (it may be a bad example, I'm not familiar with Android API. You can probably come up with a better example); this is a blocking call. In a typical go app a goroutine waiting for a blocking call doesn't hold a thread, but let's other goroutines use it. Java doesn't do that, obviously; an entire thread will be just waiting for the blocking call to return. If GOMAXPROCS=4 and 4 goroutines made blocking calls into Java API, all threads may be waiting for the blocking calls to return and program may freeze.

I would appreciate if you could let me know if there is any option to set: GOMAXPROCS to 1 or what would be alternative way of approaching blocking I/O issue in a mobile environment as described by the above comment.

@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Feb 8, 2024
@gopherbot gopherbot added this to the Unreleased milestone Feb 8, 2024
@seankhliao
Copy link
Member

Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.

For questions please refer to https://github.com/golang/go/wiki/Questions

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mobile Android, iOS, and x/mobile
Projects
None yet
Development

No branches or pull requests

3 participants