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

gRPC call failed: failed to connect to all addresses #498

Open
hac425xxx opened this issue Jan 3, 2023 · 9 comments
Open

gRPC call failed: failed to connect to all addresses #498

hac425xxx opened this issue Jan 3, 2023 · 9 comments

Comments

@hac425xxx
Copy link

project type: bitbake ( sorry, the project is not open source. )
bear version: 3.0.20, compile from source.

I try to use bear 3.0.20 , but error occur .

wrapper: failed with: gRPC call failed: failed to connect to all addresses; last error: UNKNOWN: Network is unreachable

I also try follow method, but not work

export no_proxy=localhost,127.0.0.1
export GRPC_DNS_RESOLVER=native

unset https_proxy;unset http_proxy
@rizsotto
Copy link
Owner

rizsotto commented Jan 3, 2023

Hey @hac425xxx , were there any problem to use the issue template to file the bug report?

  • I am asking it, because the OS (and OS version) is really matters how Bear works.
  • Also, the way you've invoked Bear does matter too.
  • If you can add a bit more logs that helps too. (using the --verbose flag)
  • Since the error message contains reference to networking, if you provide details how the network is configured on your machine could help too.

Please consider that this is a project that I am working on my free time. And you are asking for help. Could you put some more effort to communicate clearly and provide relevant details? (Just try to imagine what would you need to know if someone ask your help.)

@hac425xxx
Copy link
Author

hac425xxx commented Jan 4, 2023

OS

ubuntu-20.04  in docker 

bitbake version

BitBake Build Tool Core version 2.0.0

grpc error log (bear -vvvv)

[02:12:35.392664, wr, 307290, ppid: 307272] gRPC call requested: supervise::Supervisor::Resolve
[02:12:35.393411, wr, 307290, ppid: 307272] gRPC call [Resolve] finished: false
[02:12:35.393479, wr, 307290, ppid: 307272] failed with: gRPC call failed: failed to connect to all addresses; last error: UNKNOWN: Network is unreachable

network infomation


eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.17.0.2  netmask 255.255.0.0  broadcast 172.17.255.255
        ether 02:42:ac:11:00:02  txqueuelen 0  (Ethernet)
        RX packets 728857  bytes 3664080969 (3.6 GB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 444811  bytes 33425488 (33.4 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 226817  bytes 64679662 (64.6 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 226817  bytes 64679662 (64.6 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

content of /etc/hosts

$ cat /etc/hosts
127.0.0.1       localhost
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.17.0.2      1ae1c8595a29

@hac425xxx
Copy link
Author

hac425xxx commented Jan 4, 2023

bear with gcc works, but failed with bitbake.

maybe related to #293 ?

$ bear -- gcc /tmp/a.c -o /tmp/x
$ cat compile_commands.json 
[
  {
    "arguments": [
      "/usr/local/bin/gcc",
      "-c",
      "-o",
      "/tmp/x",
      "/tmp/a.c"
    ],
    "directory": "/home/xd/build/build",
    "file": "/tmp/a.c",
    "output": "/tmp/x"
  }
]

@hac425xxx
Copy link
Author

it seems work ~~

bear  --force-wrapper  -- bitbake ccc

does --force-wrapper have a document link and how it works?

@rizsotto
Copy link
Owner

rizsotto commented Jan 4, 2023

I am glad to hear that it works. Though it's not clear why, because the both mode (the preload and the wrapper) is using gRPC to report the executions. And the error message you've pasted was about network connection problems.

Anyway, here is a more detailed description how the tool is working. This will answer the question what the --force-wrapper flags does.

@rizsotto rizsotto closed this as completed Jan 4, 2023
@hac425xxx
Copy link
Author

sorry, --force-wrapper don't work, the output (compile_commands.json) is empty ~~~

@rizsotto rizsotto reopened this Jan 4, 2023
@rizsotto
Copy link
Owner

rizsotto commented Jan 4, 2023

That's more understandable, because then the wrapper was not called, and therefore no error message. My bet if it will work, it will work with the preload model. But not sure if this can be done...

The error message suggest to me that bitbake is creating a sandbox where the network is not accessible...

I found that BitBake has an option to explicitly disable network access.

Browsing the BitBake source, I've found an utility function, which disables networking. This is called from the bitbake-worker script in some condition... Could you run bitbake (without Bear) in a verbose mode? And look for this debug level log: Attempting to disable network for?

@hac425xxx
Copy link
Author

I try to remove the call to bb.utils.disable_network(uid, gid)

And get another error

[08:37:27.333343, wr, 375243, ppid: 375204] arguments parsed: {program: /usr/local/lib/bear/wrapper, arguments: [{--: [mkdir, -p, /home/xxx/build]}, {--destination: [dns:///localhost:33431]}, {--execute: [/home/xxx/build/tmp/hosttools/mkdir]}, {--verbose: []}]}
[08:37:27.333456, wr, 375243, ppid: 375204] failed with: No such file or directory

/home/xxx/build/tmp/hosttools/mkdir is link to /usr/bin/mkdir

@ForceFaction
Copy link

I had a similar problem just now. You should really consider to not use localhost but 127.0.0.1 directly, since this makes name resolution irrelevant. See: here and here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants