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

fix: shorebird release can sometimes hang on a flutter build step #2904

Open
hann-yun opened this issue Feb 18, 2025 · 3 comments
Open

fix: shorebird release can sometimes hang on a flutter build step #2904

hann-yun opened this issue Feb 18, 2025 · 3 comments
Labels
bug Something isn't working waiting for response Waiting for customer response

Comments

@hann-yun
Copy link

when i run release & patch, i faced infinity loading..

so i added --verbose, and found

 /Users/$USERNAME/.shorebird/bin/cache/flutter/9904ef00d8085df9b100561035d698dee4d8bf6a/bin/flutter build ipa --release --flavor=deve..

stuck this step. so i directly run that cli.
finally occur flutter build error.

but build via shorebird cli, infinity loading( actually flutter occur build error )

@hann-yun hann-yun added the bug Something isn't working label Feb 18, 2025
@felangel
Copy link
Contributor

What was the build error when building with Flutter? It would be great to have the full flutter logs so we can reproduce the issue locally, thanks!

@felangel felangel added the waiting for response Waiting for customer response label Feb 19, 2025
@eseidel
Copy link
Contributor

eseidel commented Feb 21, 2025

What could be happening is that we're not correctly servicing stderr/stdout in our invocation of flutter. The parent process (in this case shorebird) gives the child process it's stderr/stdin. If (as in our case) the parent gives a pipe or buffer to the child, but then doesn't always read from that pipe/buffer (or doesn't read until the child is finished, as in our case), the pipe/buffer can fill up and then the child's write() calls will block. This can cause a deadlock.

The correct way to handle this is to make sure stderr/stdin are serviced, either by routing them to /dev/null, or to a file or handling the stream callbacks in Dart, if we just wait until the end, we could deadlock if the buffer fills, the child blocks on the write, and then the child never finishes, thus we never get to actually read/print the child's output.

https://github.com/shorebirdtech/shorebird/blob/main/packages/shorebird_cli/lib/src/shorebird_process.dart#L248

Yeah, I suspect if that's big enough, the stderr/stdout stream will just fill up. I'm not sure what the recommended dart pattern is, we may need to invent one.

@eseidel
Copy link
Contributor

eseidel commented Feb 21, 2025

It's also possible that the above theory I offered is wrong of course.

@eseidel eseidel changed the title fix: ignore flutter error during build shorebird fix: shorebird release can sometimes hang on a flutter build step Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting for response Waiting for customer response
Projects
None yet
Development

No branches or pull requests

3 participants