why bazel doesn't support proxy?

1,391 views
Skip to first unread message

杜秀涛

unread,
Nov 29, 2017, 4:44:08 AM11/29/17
to bazel-dev
in  src/main/cpp/blaze.cc , there are codes like below:

static void PrepareEnvironmentForJvm() {
  if (!blaze::GetEnv("http_proxy").empty()) {
    PrintWarning("ignoring http_proxy in environment.");
    blaze::UnsetEnv("http_proxy");
}

I want to know why bazel has to unset http_proxy, and is there an official way to use proxy for bazel?

Thanks and best wishes.

Philipp Wollermann

unread,
Nov 29, 2017, 4:51:05 AM11/29/17
to 杜秀涛, Lukács T. Berki, Jakob Buchgraber, bazel-dev
This was done by Lukacs in this change: https://github.com/bazelbuild/bazel/commit/86a28b0fa2940377d5073071f79a81383fd7cfe3

We should definitely fix this.

Jakob: Any idea how to tell gRPC to connect directly even when http_proxy is set?


--
You received this message because you are subscribed to the Google Groups "bazel-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-dev+...@googlegroups.com.
To post to this group, send email to baze...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-dev/78f3af8d-0492-4d40-b0c9-2740c5119547%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Google Germany GmbH
Erika-Mann-Straße 33
80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

Lukács T. Berki

unread,
Nov 29, 2017, 4:57:05 AM11/29/17
to Philipp Wollermann, 杜秀涛, Jakob Buchgraber, bazel-dev
What do you need a HTTP proxy for?

I added these lines when I made the Bazel client and the Bazel server talk to each other over gRPC; it's a localhost-only thing, so a proxy didn't seem to make much sense and some people had it set and Bazel didn't work for them.

On 29 November 2017 at 10:50, Philipp Wollermann <phi...@google.com> wrote:
This was done by Lukacs in this change: https://github.com/bazelbuild/bazel/commit/86a28b0fa2940377d5073071f79a81383fd7cfe3

We should definitely fix this.

Jakob: Any idea how to tell gRPC to connect directly even when http_proxy is set?
On Wed, Nov 29, 2017 at 10:44 AM 杜秀涛 <duxi...@gmail.com> wrote:
in  src/main/cpp/blaze.cc , there are codes like below:

static void PrepareEnvironmentForJvm() {
  if (!blaze::GetEnv("http_proxy").empty()) {
    PrintWarning("ignoring http_proxy in environment.");
    blaze::UnsetEnv("http_proxy");
}

I want to know why bazel has to unset http_proxy, and is there an official way to use proxy for bazel?

Thanks and best wishes.

--
You received this message because you are subscribed to the Google Groups "bazel-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-dev+unsubscribe@googlegroups.com.

To post to this group, send email to baze...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-dev/78f3af8d-0492-4d40-b0c9-2740c5119547%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Google Germany GmbH
Erika-Mann-Straße 33
80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg



--
Lukács T. Berki | Software Engineer | lbe...@google.com | 

Google Germany GmbH | Erika-Mann-Str. 33  | 80636 München | Germany | Geschäftsführer: Paul Manicle, Halimah DeLaine Prado | Registergericht und -nummer: Hamburg, HRB 86891

Tobias Werth

unread,
Nov 29, 2017, 4:59:17 AM11/29/17
to Lukács T. Berki, Philipp Wollermann, 杜秀涛, Jakob Buchgraber, bazel-dev
Does bazel fetch still use the http proxy after your commit?

On Wed, Nov 29, 2017 at 10:57 AM 'Lukács T. Berki' via bazel-dev <baze...@googlegroups.com> wrote:
What do you need a HTTP proxy for?

I added these lines when I made the Bazel client and the Bazel server talk to each other over gRPC; it's a localhost-only thing, so a proxy didn't seem to make much sense and some people had it set and Bazel didn't work for them.
On 29 November 2017 at 10:50, Philipp Wollermann <phi...@google.com> wrote:
This was done by Lukacs in this change: https://github.com/bazelbuild/bazel/commit/86a28b0fa2940377d5073071f79a81383fd7cfe3

We should definitely fix this.

Jakob: Any idea how to tell gRPC to connect directly even when http_proxy is set?
On Wed, Nov 29, 2017 at 10:44 AM 杜秀涛 <duxi...@gmail.com> wrote:
in  src/main/cpp/blaze.cc , there are codes like below:

static void PrepareEnvironmentForJvm() {
  if (!blaze::GetEnv("http_proxy").empty()) {
    PrintWarning("ignoring http_proxy in environment.");
    blaze::UnsetEnv("http_proxy");
}

I want to know why bazel has to unset http_proxy, and is there an official way to use proxy for bazel?

Thanks and best wishes.

--
You received this message because you are subscribed to the Google Groups "bazel-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-dev+...@googlegroups.com.

To post to this group, send email to baze...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-dev/78f3af8d-0492-4d40-b0c9-2740c5119547%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Google Germany GmbH
Erika-Mann-Straße 33
80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg



--
Lukács T. Berki | Software Engineer | lbe...@google.com | 

Google Germany GmbH | Erika-Mann-Str. 33  | 80636 München | GermanyGeschäftsführer: Paul Manicle, Halimah DeLaine Prado | Registergericht und -nummer: Hamburg, HRB 86891

--
You received this message because you are subscribed to the Google Groups "bazel-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-dev+...@googlegroups.com.

To post to this group, send email to baze...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--

Tobias Werth
Software Engineer


Google Germany GmbH
Erika-Mann-Straße 33
80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado 
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

Diese E-Mail ist vertraulich. Falls sie diese fälschlicherweise erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter, löschen Sie alle Kopien und Anhänge davon und lassen Sie mich bitte wissen, dass die E-Mail an die falsche Person gesendet wurde. 
     
This e-mail is confidential. If you received this communication by mistake, please don't forward it to anyone else, please erase all copies and attachments, and please let me know that it has gone to the wrong person.

Jakob Buchgraber

unread,
Nov 29, 2017, 4:59:18 AM11/29/17
to Philipp Wollermann, 杜秀涛, Lukács T. Berki, bazel-dev
Yes, gRPC should respect the NO_PROXY environment variable.  That being said, we are on such an old gRPC version that I wouldn't be surprised if that version doesn't.

Eithery way, it seems fair for Bazel to ignore HTTP_PROXY given that it's only supposed to run on localhost?
--

Jakob Buchgraber

Software Engineer

Google Germany GmbH

Erika-Mann-Straße 33

80636 München


Geschäftsführer: Paul Manicle, Halimah DeLaine Prado

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg


Philipp Wollermann

unread,
Nov 29, 2017, 5:00:51 AM11/29/17
to Lukács T. Berki, 杜秀涛, Jakob Buchgraber, bazel-dev
Well, you obviously need an HTTP proxy to access any HTTP server, if you need one in your environment.
The problem is that "bazel fetch" ignores the proxy due to this change, breaking it.

On Wed, Nov 29, 2017 at 10:57 AM Lukács T. Berki <lbe...@google.com> wrote:
What do you need a HTTP proxy for?

I added these lines when I made the Bazel client and the Bazel server talk to each other over gRPC; it's a localhost-only thing, so a proxy didn't seem to make much sense and some people had it set and Bazel didn't work for them.
On 29 November 2017 at 10:50, Philipp Wollermann <phi...@google.com> wrote:
This was done by Lukacs in this change: https://github.com/bazelbuild/bazel/commit/86a28b0fa2940377d5073071f79a81383fd7cfe3

We should definitely fix this.

Jakob: Any idea how to tell gRPC to connect directly even when http_proxy is set?
On Wed, Nov 29, 2017 at 10:44 AM 杜秀涛 <duxi...@gmail.com> wrote:
in  src/main/cpp/blaze.cc , there are codes like below:

static void PrepareEnvironmentForJvm() {
  if (!blaze::GetEnv("http_proxy").empty()) {
    PrintWarning("ignoring http_proxy in environment.");
    blaze::UnsetEnv("http_proxy");
}

I want to know why bazel has to unset http_proxy, and is there an official way to use proxy for bazel?

Thanks and best wishes.

--
You received this message because you are subscribed to the Google Groups "bazel-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-dev+...@googlegroups.com.

To post to this group, send email to baze...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-dev/78f3af8d-0492-4d40-b0c9-2740c5119547%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Google Germany GmbH
Erika-Mann-Straße 33
80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

Lukács T. Berki

unread,
Nov 29, 2017, 5:01:38 AM11/29/17
to Tobias Werth, Philipp Wollermann, 杜秀涛, Jakob Buchgraber, bazel-dev
On 29 November 2017 at 10:59, Tobias Werth <twe...@google.com> wrote:
Does bazel fetch still use the http proxy after your commit?
I haven't checked. 
 

On Wed, Nov 29, 2017 at 10:57 AM 'Lukács T. Berki' via bazel-dev <baze...@googlegroups.com> wrote:
What do you need a HTTP proxy for?

I added these lines when I made the Bazel client and the Bazel server talk to each other over gRPC; it's a localhost-only thing, so a proxy didn't seem to make much sense and some people had it set and Bazel didn't work for them.
On 29 November 2017 at 10:50, Philipp Wollermann <phi...@google.com> wrote:
This was done by Lukacs in this change: https://github.com/bazelbuild/bazel/commit/86a28b0fa2940377d5073071f79a81383fd7cfe3

We should definitely fix this.

Jakob: Any idea how to tell gRPC to connect directly even when http_proxy is set?
On Wed, Nov 29, 2017 at 10:44 AM 杜秀涛 <duxi...@gmail.com> wrote:
in  src/main/cpp/blaze.cc , there are codes like below:

static void PrepareEnvironmentForJvm() {
  if (!blaze::GetEnv("http_proxy").empty()) {
    PrintWarning("ignoring http_proxy in environment.");
    blaze::UnsetEnv("http_proxy");
}

I want to know why bazel has to unset http_proxy, and is there an official way to use proxy for bazel?

Thanks and best wishes.

--
You received this message because you are subscribed to the Google Groups "bazel-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-dev+unsubscribe@googlegroups.com.

To post to this group, send email to baze...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-dev/78f3af8d-0492-4d40-b0c9-2740c5119547%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Google Germany GmbH
Erika-Mann-Straße 33
80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg



--
Lukács T. Berki | Software Engineer | lbe...@google.com | 

Google Germany GmbH | Erika-Mann-Str. 33  | 80636 München | GermanyGeschäftsführer: Paul Manicle, Halimah DeLaine Prado | Registergericht und -nummer: Hamburg, HRB 86891

--
You received this message because you are subscribed to the Google Groups "bazel-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-dev+unsubscribe@googlegroups.com.

To post to this group, send email to baze...@googlegroups.com.
--

Tobias Werth
Software Engineer


Google Germany GmbH

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado 
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

Diese E-Mail ist vertraulich. Falls sie diese fälschlicherweise erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter, löschen Sie alle Kopien und Anhänge davon und lassen Sie mich bitte wissen, dass die E-Mail an die falsche Person gesendet wurde. 
     
This e-mail is confidential. If you received this communication by mistake, please don't forward it to anyone else, please erase all copies and attachments, and please let me know that it has gone to the wrong person.

Philipp Wollermann

unread,
Nov 29, 2017, 5:03:37 AM11/29/17
to Lukács T. Berki, Tobias Werth, 杜秀涛, Jakob Buchgraber, bazel-dev
The user comments suggest that bazel fetch is broken in environments where you need a proxy: https://github.com/bazelbuild/bazel/commit/86a28b0fa2940377d5073071f79a81383fd7cfe3

On Wed, Nov 29, 2017 at 11:01 AM 'Lukács T. Berki' via bazel-dev <baze...@googlegroups.com> wrote:
On 29 November 2017 at 10:59, Tobias Werth <twe...@google.com> wrote:
Does bazel fetch still use the http proxy after your commit?
I haven't checked. 
On Wed, Nov 29, 2017 at 10:57 AM 'Lukács T. Berki' via bazel-dev <baze...@googlegroups.com> wrote:
What do you need a HTTP proxy for?

I added these lines when I made the Bazel client and the Bazel server talk to each other over gRPC; it's a localhost-only thing, so a proxy didn't seem to make much sense and some people had it set and Bazel didn't work for them.
On 29 November 2017 at 10:50, Philipp Wollermann <phi...@google.com> wrote:
This was done by Lukacs in this change: https://github.com/bazelbuild/bazel/commit/86a28b0fa2940377d5073071f79a81383fd7cfe3

We should definitely fix this.

Jakob: Any idea how to tell gRPC to connect directly even when http_proxy is set?
On Wed, Nov 29, 2017 at 10:44 AM 杜秀涛 <duxi...@gmail.com> wrote:
in  src/main/cpp/blaze.cc , there are codes like below:

static void PrepareEnvironmentForJvm() {
  if (!blaze::GetEnv("http_proxy").empty()) {
    PrintWarning("ignoring http_proxy in environment.");
    blaze::UnsetEnv("http_proxy");
}

I want to know why bazel has to unset http_proxy, and is there an official way to use proxy for bazel?

Thanks and best wishes.

--
You received this message because you are subscribed to the Google Groups "bazel-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-dev+...@googlegroups.com.

To post to this group, send email to baze...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-dev/78f3af8d-0492-4d40-b0c9-2740c5119547%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Google Germany GmbH
Erika-Mann-Straße 33
80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg



--
Lukács T. Berki | Software Engineer | lbe...@google.com | 

Google Germany GmbH | Erika-Mann-Str. 33  | 80636 München | GermanyGeschäftsführer: Paul Manicle, Halimah DeLaine Prado | Registergericht und -nummer: Hamburg, HRB 86891

--
You received this message because you are subscribed to the Google Groups "bazel-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-dev+...@googlegroups.com.

To post to this group, send email to baze...@googlegroups.com.
--

Tobias Werth
Software Engineer


Google Germany GmbH

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado 
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

Diese E-Mail ist vertraulich. Falls sie diese fälschlicherweise erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter, löschen Sie alle Kopien und Anhänge davon und lassen Sie mich bitte wissen, dass die E-Mail an die falsche Person gesendet wurde. 
     
This e-mail is confidential. If you received this communication by mistake, please don't forward it to anyone else, please erase all copies and attachments, and please let me know that it has gone to the wrong person.



--
Lukács T. Berki | Software Engineer | lbe...@google.com | 

Google Germany GmbH | Erika-Mann-Str. 33  | 80636 München | GermanyGeschäftsführer: Paul Manicle, Halimah DeLaine Prado | Registergericht und -nummer: Hamburg, HRB 86891

--
You received this message because you are subscribed to the Google Groups "bazel-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-dev+...@googlegroups.com.

To post to this group, send email to baze...@googlegroups.com.

Jakob Buchgraber

unread,
Nov 29, 2017, 5:04:16 AM11/29/17
to Philipp Wollermann, Lukács T. Berki, 杜秀涛, bazel-dev
We certainly shouldn't break bazel fetch :P. I guess setting NO_PROXY=localhost:<server port> may be better. The C++ API may also have an option to disable proxying.
--

Jakob Buchgraber

Software Engineer

Google Germany GmbH

Erika-Mann-Straße 33

80636 München


Geschäftsführer: Paul Manicle, Halimah DeLaine Prado

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg


Philipp Wollermann

unread,
Nov 29, 2017, 5:07:10 AM11/29/17
to Jakob Buchgraber, Lukács T. Berki, 杜秀涛, bazel-dev
I'll have a look at this and send a fix if I can come up with one.

Philipp Wollermann

unread,
Dec 7, 2017, 12:23:55 PM12/7/17
to Jakob Buchgraber, Lukács T. Berki, 杜秀涛, bazel-dev
OK, now after I wrote all this code to set the proxy system properties from the http(s)_proxy environment variables, I realize that this should have just worked:

Yes, as the OP pointed out, the code in our C++ client indeed removes the "http_proxy" variable from the envvars, but before that they are stored and converted into --client_env flags. This means that the running Bazel server has access to them via CommandEnvironment#getClientEnv.

There is code in the remote repository stuff that then parses these variables to connect via a proxy for HTTP and Git repositories:

So... was there actually any problem to solve here? Did something not work?

On Wed, Nov 29, 2017 at 11:06 AM, Philipp Wollermann <phi...@google.com> wrote:
I'll have a look at this and send a fix if I can come up with one.
On Wed, Nov 29, 2017 at 11:04 AM Jakob Buchgraber <buc...@google.com> wrote:
We certainly shouldn't break bazel fetch :P. I guess setting NO_PROXY=localhost:<server port> may be better. The C++ API may also have an option to disable proxying.
On Wed, Nov 29, 2017 at 11:00 AM Philipp Wollermann <phi...@google.com> wrote:
Well, you obviously need an HTTP proxy to access any HTTP server, if you need one in your environment.
The problem is that "bazel fetch" ignores the proxy due to this change, breaking it.

On Wed, Nov 29, 2017 at 10:57 AM Lukács T. Berki <lbe...@google.com> wrote:
What do you need a HTTP proxy for?

I added these lines when I made the Bazel client and the Bazel server talk to each other over gRPC; it's a localhost-only thing, so a proxy didn't seem to make much sense and some people had it set and Bazel didn't work for them.
On 29 November 2017 at 10:50, Philipp Wollermann <phi...@google.com> wrote:
This was done by Lukacs in this change: https://github.com/bazelbuild/bazel/commit/86a28b0fa2940377d5073071f79a81383fd7cfe3

We should definitely fix this.

Jakob: Any idea how to tell gRPC to connect directly even when http_proxy is set?
On Wed, Nov 29, 2017 at 10:44 AM 杜秀涛 <duxi...@gmail.com> wrote:
in  src/main/cpp/blaze.cc , there are codes like below:

static void PrepareEnvironmentForJvm() {
  if (!blaze::GetEnv("http_proxy").empty()) {
    PrintWarning("ignoring http_proxy in environment.");
    blaze::UnsetEnv("http_proxy");
}

I want to know why bazel has to unset http_proxy, and is there an official way to use proxy for bazel?

Thanks and best wishes.

--
You received this message because you are subscribed to the Google Groups "bazel-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-dev+unsubscribe@googlegroups.com.

Jakob Buchgraber

unread,
Dec 7, 2017, 2:49:04 PM12/7/17
to Philipp Wollermann, Lukács T. Berki, 杜秀涛, bazel-dev
I haven't tested with an actual proxy but pointing http_proxy / https_proxy to a none existent proxy makes bazel fetch not work. This indicates that the variables do actually have an effect :-).

P.S.: bazel fetch just sits there forever ... that's something we should fix!

Best,
Jakob

To unsubscribe from this group and stop receiving emails from it, send an email to bazel-dev+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages