Bug 735336 - Gnome proxy settings not picked up by JVM, with java.net.useSystemProxies=true
Summary: Gnome proxy settings not picked up by JVM, with java.net.useSystemProxies=true
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: java-1.7.0-openjdk
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
Assignee: Andrew John Hughes
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 738952
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-09-02 12:08 UTC by Reinout van Schouwen
Modified: 2015-06-30 00:34 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-06-30 00:34:19 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Program to print the current proxy configuration to standard output (1.33 KB, text/x-java)
2011-09-02 12:08 UTC, Reinout van Schouwen
no flags Details

Description Reinout van Schouwen 2011-09-02 12:08:31 UTC
Created attachment 521216 [details]
Program to print the current proxy configuration to standard output

Description of problem:
When instructing the Java virtual machine to use the system proxy settings, the system proxy settings are in fact ignored.

Version-Release number of selected component (if applicable):
java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.3) (fedora-59.1.10.3.fc15-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

$ gnome-control-center --version
gnome-control-center 3.0.1.1

How reproducible:
Always

Steps to Reproduce:
1. Open the Gnome network settings
2. Set a proxy configuration
3. Run the attached test program
  
Actual results:
Output is:
proxy hostname : DIRECT
No Proxy

Expected results:
proxy hostname : <value from gnome network settings>
proxy port : <value from gnome network settings>

Additional info:
According to http://netbeans.org/bugzilla/show_bug.cgi?id=194916#c12 this did work under Gnome 2.x.

Comment 1 Deepak Bhole 2011-09-02 21:16:39 UTC
Just looked into this one.. it looks like a bug in gnome-control-center.

When proxy settings are changed through gnome-control-center, it does not modify the value of any of the elements in /system/http_proxy/ as it ought to.

If the elements are manually set (via cli or a tool like gconf-editor), Java uses the proxy correctly.

Changing component to control-center.

Comment 2 Reinout van Schouwen 2011-09-05 11:36:59 UTC
(In reply to comment #1)

> When proxy settings are changed through gnome-control-center, it does not
> modify the value of any of the elements in /system/http_proxy/ as it ought to.
> 
> If the elements are manually set (via cli or a tool like gconf-editor), Java
> uses the proxy correctly.
> 
> Changing component to control-center.

Note that changes *do* show up in dconf-editor under System > proxy. Perhaps gconf settings should also be adjusted for backwards compatibility.

Comment 3 Deepak Bhole 2011-09-06 15:22:43 UTC
Ah, didn't realize it is read from dconf now. 

Java currently has no mechanism to check dconf, so if the settings could be replicated into gconf for compatibility, that'd be great!

Comment 4 Andrew John Hughes 2011-09-06 21:34:18 UTC
It sounds like OpenJDK needs updating to use glib and GSettings (which has a dconf backend) and not gconf.

Comment 5 Andrew John Hughes 2011-09-07 14:18:54 UTC
Had a look at this more this morning.  The change to OpenJDK looks pretty simple.

Comment 6 Andrew John Hughes 2011-09-13 15:49:38 UTC
Reassign as a Java bug.

Comment 7 Andrew John Hughes 2011-09-13 15:50:00 UTC
Taking bug.

Comment 8 Andrew John Hughes 2011-09-16 06:03:31 UTC
Well, I have this working:

public class TestProxy
{
  public static void main(String[] args)
    throws Exception
  {
    System.out.println(new DefaultProxySelector().select(new URI("http://redhat.com")));
  }
}

phost: null, pport: 0, systemProxies: true
cproto: http
use_same_proxy: 1
used_proto: http
use_proxy: 1, mode: manual
phost: orthanc, pport: 3128
*ptr: localhost, urlhost: redhat.com
*ptr: 127.0.0.0/8, urlhost: redhat.com
[HTTP @ orthanc:3128]

The final line being the output from the program, and the above ones the result of a few debugging lines I added to the native code to check the return values from gsettings.

An issue that came up in developing this is that GNOME Control Center currently doesn't set some of the required values explicitly, notably enabling the HTTP proxy:

    <key type="b" name="enabled">
      <default>false</default>
      <summary>Use HTTP proxy</summary>
      <description>Enables the proxy settings when accessing HTTP over the Internet.</description>
    </key>


and allowing per-protocol settings:

    <key type="b" name="use-same-proxy">
      <default>true</default>
      <summary>Use same proxy for all protocols</summary>
      <description>Whether to use the same proxy for all protocols or not.</description>
    </key>


Instead, we get the default values which means the HTTP proxy is always disabled and the same proxy (assumed to be HTTP in the existing code) is used for all.  I'll file an appropriate bug with the control center for this.

The settings can be fixed manually using dconf-editor and, as GSettings works via backends, this also works with gconf via the GSettings gconf backend.

Comment 9 Andrew John Hughes 2011-09-16 06:15:25 UTC
Depend on control center bug.

Comment 10 Andrew John Hughes 2011-09-23 16:27:59 UTC
This is fixed in IcedTea7:

http://icedtea.classpath.org/hg/icedtea7-forest/jdk/rev/a8b6a570543b

I'll make a backport to IcedTea6 once 7-2.0 is out the door.

Comment 11 Fedora End Of Life 2012-08-07 14:36:50 UTC
This message is a notice that Fedora 15 is now at end of life. Fedora
has stopped maintaining and issuing updates for Fedora 15. It is
Fedora's policy to close all bug reports from releases that are no
longer maintained. At this time, all open bugs with a Fedora 'version'
of '15' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that
we were unable to fix it before Fedora 15 reached end of life. If you
would still like to see this bug fixed and are able to reproduce it
against a later version of Fedora, you are encouraged to click on
"Clone This Bug" (top right of this page) and open it against that
version of Fedora.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

The process we are following is described here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 12 Reinout van Schouwen 2012-08-07 20:06:11 UTC
(In reply to comment #10)
> This is fixed in IcedTea7:
> 
> http://icedtea.classpath.org/hg/icedtea7-forest/jdk/rev/a8b6a570543b
> 
> I'll make a backport to IcedTea6 once 7-2.0 is out the door.

Did this happen? It would be good for F16 users still...

Comment 13 Andrew John Hughes 2012-08-08 10:44:48 UTC
This is in 7, as far as I'm aware.  There didn't seem to be much point adding it to 6 with it being gone in F17.

Can someone confirm the issue is fixed?

Comment 14 Andrew John Hughes 2012-08-08 10:48:28 UTC
Moving to F16, but I'd like to know it works with 7 before backporting.

Comment 15 Reinout van Schouwen 2012-08-09 09:06:34 UTC
$ java -version
java version "1.7.0_05-icedtea"
OpenJDK Runtime Environment (fedora-2.2.1.fc17.9-x86_64)
OpenJDK 64-Bit Server VM (build 23.0-b21, mixed mode)
[reinout@elmont Downloads]$ java TestProxy
proxy hostname : DIRECT
No Proxy

I'm afraid it doesn't work with current icedtea in F17...

Comment 16 Fedora End Of Life 2013-01-16 22:18:45 UTC
This message is a reminder that Fedora 16 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 16. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '16'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 16's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 16 is end of life. If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora, you are encouraged to click on 
"Clone This Bug" and open it against that version of Fedora.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 17 Andrew John Hughes 2013-01-18 21:09:34 UTC
Still an issue.  We fixed the issue, but then GNOME changed the schemas and broke the fix...

Comment 18 Reinout van Schouwen 2013-02-12 11:05:27 UTC
(In reply to comment #17)
> Still an issue.  We fixed the issue, but then GNOME changed the schemas and
> broke the fix...

Looking at the code, the schemas weren't changed as such, but the key org.gnome.system.proxy.use_same_proxy was deprecated and the openjdk patch depended on that.

By simply checking whether the org.gnome.system.proxy.mode == 'manual' and forgoing the use_same_proxy check, I believe this issue could be fixed for all GNOME 3 versions.

Comment 19 Fedora End Of Life 2013-04-03 19:11:06 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.

(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19

Comment 20 Andrew John Hughes 2015-01-09 20:23:59 UTC
Moving to java-1.7.0-openjdk as java-1.6.0-openjdk hasn't been in Fedora for a long time.

This should have been fixed by the 2.5.3 update in October 2014. Can someone please confirm that it now works? It worked for me with GNOME 3.12.2.

Comment 21 Fedora End Of Life 2015-01-09 21:52:32 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 22 Fedora End Of Life 2015-05-29 08:40:04 UTC
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '20'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 23 Fedora End Of Life 2015-06-30 00:34:19 UTC
Fedora 20 changed to end-of-life (EOL) status on 2015-06-23. Fedora 20 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.