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(initializer): correctly reap dangling processes #3717

Merged
merged 1 commit into from
Oct 2, 2024

Conversation

mudler
Copy link
Owner

@mudler mudler commented Oct 2, 2024

Description

This PR fixes a current existing issue when starting new processes. If the backend fails, for instance by loading the model and the model was not explicitly configured with a backend, LocalAI would loop over the backends - however if it fails it won't reap the process, and calling deleteProcess is a no-op as the model isn't registered yet.

Notes for Reviewers

Signed commits

  • Yes, I signed my commits.

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
@@ -376,7 +376,9 @@

if !ready {
log.Debug().Msgf("GRPC Service NOT ready")
ml.deleteProcess(o.model)
if process := client.Process(); process != nil {
process.Stop()

Check warning

Code scanning / gosec

Errors unhandled. Warning

Errors unhandled.
@@ -388,11 +390,15 @@

res, err := client.GRPC(o.parallelRequests, ml.wd).LoadModel(o.context, &options)
if err != nil {
ml.deleteProcess(o.model)
if process := client.Process(); process != nil {
process.Stop()

Check warning

Code scanning / gosec

Errors unhandled. Warning

Errors unhandled.
return nil, fmt.Errorf("could not load model: %w", err)
}
if !res.Success {
ml.deleteProcess(o.model)
if process := client.Process(); process != nil {
process.Stop()

Check warning

Code scanning / gosec

Errors unhandled. Warning

Errors unhandled.
@mudler mudler merged commit 4686877 into master Oct 2, 2024
25 of 26 checks passed
@mudler mudler deleted the fix/start_failure branch October 2, 2024 18:37
@mudler mudler added the bug Something isn't working label Oct 2, 2024
Copy link

netlify bot commented Oct 2, 2024

Deploy Preview for localai ready!

Name Link
🔨 Latest commit 9ecd4cc
🔍 Latest deploy log https://app.netlify.com/sites/localai/deploys/66fd92e63a493000082b9f33
😎 Deploy Preview https://deploy-preview-3717--localai.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant