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

Issue with starting a server on MacOS (also too many/wrong bugs printed) #4716

Closed
aronchick opened this issue Nov 23, 2024 · 5 comments
Closed
Labels
request/waiting-reply Request: Waiting for further information from the issue reporter type/bug Type: Something is not working as expected

Comments

@aronchick
Copy link
Collaborator

three bugs:

  1. Golang logs are still printing to the stdout when starting.
  2. Error on cannot bind is not helpful
  3. Getting an error on api-host?
❯ sudo bacalhau serve --compute --config Compute.Orchestrators=20.150.213.161
09:43:10.65 | INF cmd/cli/serve/serve.go:103 > Config loaded from: [/Users/daaronch/.bacalhau/config.yaml], and with data-dir /Users/daaronch/.bacalhau
09:43:10.651 | INF cmd/cli/serve/serve.go:181 > Starting bacalhau...

Error: error starting node: listen tcp 52.156.167.129:1234: bind: can't assign requested address

❯ bacalhau config list
 KEY                                               VALUE                        DESCRIPTION
 API.Auth.AccessPolicyPath                                                      AccessPolicyPath is the path to a file or directory that will be loaded as the
                                                                                policy to apply to all inbound API requests. If unspecified, a policy that
                                                                                permits access to all API endpoints to both authenticated and unauthenticated
                                                                                users (the default as of v1.2.0) will be used.
 API.Auth.Methods                                  map[ClientKey:{challenge }]  Methods maps "method names" to authenticator implementations. A method name is a
                                                                                human-readable string chosen by the person configuring the system that is shown
                                                                                to users to help them pick the authentication method they want to use. There can
                                                                                be multiple usages of the same Authenticator *type* but with different configs
                                                                                and parameters, each identified with a unique method name. For example, if an
                                                                                implementation wants to allow users to log in with Github or Bitbucket, they
                                                                                might both use an authenticator implementation of type "oidc", and each would
                                                                                appear once on this provider with key / method name "github" and "bitbucket". By
                                                                                default, only a single authentication method that accepts authentication via
                                                                                client keys will be enabled.
 API.Host                                          52.156.167.129               Host specifies the hostname or IP address on which the API server listens or the
                                                                                client connects.
 API.Port                                          1234                         Port specifies the port number on which the API server listens or the client
                                                                                connects.
[...]
@aronchick aronchick added type/bug Type: Something is not working as expected request/new Request: Indicates a new request that has been submitted and awaits initial triage labels Nov 23, 2024
Copy link

linear bot commented Nov 23, 2024

@aronchick
Copy link
Collaborator Author

But when i try to set the API Host, it still doesn't work?

❯ sudo bacalhau serve --compute --config Compute.Orchestrators=20.150.213.161 --config API.Host=20.150.213.161
09:47:05.915 | INF cmd/cli/serve/serve.go:103 > Config loaded from: [/Users/daaronch/.bacalhau/config.yaml], and with data-dir /Users/daaronch/.bacalhau
09:47:05.916 | INF cmd/cli/serve/serve.go:181 > Starting bacalhau...

Error: error starting node: listen tcp 20.150.213.161:1234: bind: can't assign requested address
❯ bacalhau node list --config API.Host=20.150.213.161
 ID          TYPE       APPROVAL  STATUS     LABELS                                              CPU  MEMORY  DISK  GPU
 n-13b3fa3e  Requester  APPROVED  CONNECTED  Architecture=amd64 DISK_GB=991 HOSTNAME=
                                             IP=20.150.213.161 LOCATION= MACHINE_TYPE=
                                             MEMORY_GB=62.7 NODE_TYPE=requester
                                             ORCHESTRATORS=0.0.0.0 Operating-System=linux
                                             VCPU_COUNT=16

@aronchick aronchick changed the title Print out bugs and errors Issue with starting a server on MacOS (also too many/wrong bugs printed) Nov 25, 2024
@aronchick
Copy link
Collaborator Author

It's not that another port has something running.

bash-5.2# sudo lsof -i tcp:1234
bash-5.2#

@wdbaruni
Copy link
Member

Golang logs are still printing to the stdout when starting.

When running bacalhau serve, we print logs on what the agent is doing, which is expected for any similar type of application and helps with debugging purposes. Running client commands on the other hand, such as bacalhau job list, doesn't print these kind of logs. We don't see this as a bug as this is expected behaviour

Error on cannot bind is not helpful

Yes, the error is not helpful and should be improved. @CodeRabbit create an issue to improve error reported when failing to bind to a listen address

Getting an error on api-host?

The issue you are getting is because --config API.Host=<address> is used for two purposes depending on the command you are running:

  • Client commands: this will be the address of the orchestrator node the client will call, such as when submitting jobs or getting results. The default value in this context is 127.0.0.1
  • Serve command: this will be the address the agent will listen and bind to. The default value in this context is 0.0.0.0

In your case, you are trying to bind a remote address when running a node locally. I am assuming 20.150.213.161 is not a valid address for your node. This usually happens when you do something like:

# set bacalhau config to call remote orchestrator
# this will update your config at ~/.bacalhau/config.yaml
bacalhau config set API.Host=52.156.167.129

# run client commands
bacalhau docker run ....

# then you decide to run a node locally using the same config at ~/.bacalhau/config.yaml
sudo bacalhau serve --compute --config Compute.Orchestrators=20.150.213.161

# here you will get the following error because you are mixing client config with serve configs
Error: error starting node: listen tcp 52.156.167.129:1234: bind: can't assign requested address

I think the mitigation here is to provide a better error with hints on how to fix the issue. Does that sound right?

@wdbaruni wdbaruni added request/waiting-reply Request: Waiting for further information from the issue reporter and removed request/new Request: Indicates a new request that has been submitted and awaits initial triage labels Nov 25, 2024
Copy link
Contributor

coderabbitai bot commented Nov 25, 2024

Tip

For best results, initiate chat on the files or code changes.

@wdbaruni, I've created the issue as requested: #4720.

🔗 Analysis chain
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
gh issue create \
  --title "Improve error message when failing to bind to a listen address" \
  --body "When users attempt to bind to an invalid or unavailable address, the error message is not helpful. Please improve the error message to provide hints or suggestions on how to fix the issue.

Requested by @wdbaruni.

Related issue: https://github.com/bacalhau-project/bacalhau/issues/4716" \
  --assignee wdbaruni

Length of output: 463

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
request/waiting-reply Request: Waiting for further information from the issue reporter type/bug Type: Something is not working as expected
Projects
None yet
Development

No branches or pull requests

2 participants