Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 325963 - enable/disable mirrors via another means other than System properties
Summary: enable/disable mirrors via another means other than System properties
Status: CLOSED DUPLICATE of bug 266199
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: 3.6.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: P2 Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-22 09:50 EDT by Nicolas Bros CLA
Modified: 2010-09-27 10:38 EDT (History)
4 users (show)

See Also:


Attachments
list of contacted mirrors (32.58 KB, text/plain)
2010-09-22 11:18 EDT, Nicolas Bros CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Bros CLA 2010-09-22 09:50:46 EDT
Option "eclipse.p2.mirrors=false" disables mirrors, but p2 checks mirrors anyway in some cases (I don't know which exactly).

This resulted in a very slow build for me (Bug 323977), that I could only fix by hacking org.eclipse.equinox.internal.p2.repository.FileReader to not connect to mirrors.

It would be useful to have an option that disables all connections to mirrors, even if that can result in a failed install.
Comment 1 DJ Houghton CLA 2010-09-22 10:14:17 EDT
The mirror selection code in p2 should be completely disabled if you set the eclipse.p2.mirrors=false System property. (the code is in an "if" stmt) 

Are you able to get a dump of the System properties for a build where the bits are being retrieved from the mirrors when this property is set?

When you made the code changes in bug 324983 comment 9, what was the console output? Which non-eclipse.org sites was it trying to access?

Thomas, are you familiar with Buckminster and how the properties should be set in order to be passed along to p2? Have you seen any problems in this area recently?
Comment 2 Nicolas Bros CLA 2010-09-22 11:18:48 EDT
Created attachment 179385 [details]
list of contacted mirrors

Here is a build log with information about which URLs p2 tries to access:
https://hudson.eclipse.org/hudson/job/modisco-nightly/211/consoleFull

Since the log is very verbose, I am attaching the list of contacted mirrors.
Comment 3 Nicolas Bros CLA 2010-09-22 11:34:35 EDT
I add code to print the properties and system environment in org.eclipse.equinox.internal.p2.repository.FileReader.sendRetrieveRequest, and eclipse.p2.mirrors is here. Here is what I get:

***** SYSTEM PROPERTIES *****
eclipse.download = 'file:/home/data/httpd/download.eclipse.org'
eclipse.p2.mirrors = 'false'

***** SYSTEM ENV *****
ANT_OPTS = '-Dhttp.proxyHost=proxy.eclipse.org -Dhttp.proxyPort=9898 -Dhttps.proxyHost=proxy.eclipse.org -Dhttps.proxyPort=9898 -Dhttp.noProxyHosts="*.eclipse.org" -Dhttps.noProxyHosts="*.eclipse.org"'
WINDOWMANAGER = '/usr/bin/gnome'
JAVA_HOME = '/shared/common/sun-jdk1.6.0_21_x64'
LESSCLOSE = 'lessclose.sh %s %s'
ENV = '/etc/bash.bashrc'
SSH_CLIENT = '172.30.206.140 35548 22'
HOSTTYPE = 'x86_64'
HUDSON_URL = 'https://hudson.eclipse.org/hudson/'
MAIL = '/var/mail/hudsonbuild'
JOB_URL = 'https://hudson.eclipse.org/hudson/job/modisco-nightly/'
https_proxy = 'http://proxy.eclipse.org:9898'
HOSTNAME = 'build'
HOST = 'hudson-slave1'
PWD = '/opt/users/hudsonbuild/workspace/modisco-nightly'
XCURSOR_THEME = 'DMZ'
VERSION = '0.9.0'
LS_OPTIONS = '-N --color=none -T 0'
CVS_RSH = 'ssh'
G_FILENAME_ENCODING = '@locale,UTF-8,ISO-8859-15,CP1252'
MACHTYPE = 'x86_64-suse-linux'
G_BROKEN_FILENAMES = '1'
NODE_NAME = 'hudson-slave1'
NLSPATH = '/usr/dt/lib/nls/msg/%L/%N.cat'
BUILD_NUMBER = '215'
FRESH_WORKSPACE = 'true'
EXECUTOR_NUMBER = '7'
INPUTRC = '/opt/users/hudsonbuild/.inputrc'
HISTSIZE = '1000'
XKEYSYMDB = '/usr/share/X11/XKeysymDB'
XDG_CONFIG_DIRS = '/etc/xdg'
PATH = '/shared/common/sun-jdk1.6.0_21_x64/bin:/opt/users/hudsonbuild/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/opt/kde3/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin'
XNLSPATH = '/usr/share/X11/nls'
BUILD_TYPE = 'N'
LESS_ADVANCED_PREPROCESSOR = 'no'
http_proxy = 'http://proxy.eclipse.org:9898'
LESS = '-M -I'
PAGER = 'less'
ANT_ARGS = '-Dhttp.proxyHost=proxy.eclipse.org -Dhttp.proxyPort=9898 -Dhttps.proxyHost=proxy.eclipse.org -Dhttps.proxyPort=9898 -Dhttp.noProxyHosts="*.eclipse.org" -Dhttps.noProxyHosts="*.eclipse.org"'
PYTHONSTARTUP = '/etc/pythonstart'
SVN_REVISION = '3189'
no_proxy = 'localhost, 127.0.0.1, eclipse.org, 172.30.206.0'
HUDSON_HOME = '/opt/users/hudsonbuild/.hudson'
INFOPATH = '/usr/local/info:/usr/share/info:/usr/info'
OSTYPE = 'linux'
FRESH_TARGET_PLATFORM = 'true'
PROJRELENGROOT = 'svn://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.modisco/releng/trunk'
SIGN_UPDATE_SITE = 'false'
LESSKEY = '/etc/lesskey.bin'
INFODIR = '/usr/local/info:/usr/share/info:/usr/info'
SHLVL = '3'
XFILESEARCHPATH = '/usr/dt/app-defaults/%L/Dt'
MANPATH = '/usr/local/man:/usr/local/share/man:/usr/share/man'
MINICOM = '-c on'
CPU = 'x86_64'
COLORTERM = '1'
SKIP_LONG_JUNIT_TESTS = 'false'
NNTPSERVER = 'news'
XDG_DATA_DIRS = '/usr/share:/etc/opt/kde3/share:/opt/kde3/share'
JAVA_ARGS = '-Dhttp.proxyHost=proxy.eclipse.org -Dhttp.proxyPort=9898 -Dhttps.proxyHost=proxy.eclipse.org -Dhttps.proxyPort=9898 -Dhttp.noProxyHosts="*.eclipse.org" -Dhttps.noProxyHosts="*.eclipse.org"'
BUILD_ID = '2010-09-22_11-29-35'
LOGNAME = 'hudsonbuild'
BUILD_TAG = 'hudson-modisco-nightly-215'
BUILD_URL = 'https://hudson.eclipse.org/hudson/job/modisco-nightly/215/'
PROFILEREAD = 'true'
_ = '/shared/common/sun-jdk1.6.0_21_x64/bin/java'
LD_LIBRARY_PATH = '/opt/public/common/sun-jdk1.6.0_21_x64/jre/lib/amd64/server:/opt/public/common/sun-jdk1.6.0_21_x64/jre/lib/amd64:/opt/public/common/sun-jdk1.6.0_21_x64/jre/../lib/amd64'
SSH_CONNECTION = '172.30.206.140 35548 172.30.206.141 22'
SHELL = '/bin/bash'
MORE = '-sl'
WORKSPACE = '/opt/users/hudsonbuild/workspace/modisco-nightly'
JVM_OPTS = '-Dhttp.proxyHost=proxy.eclipse.org -Dhttp.proxyPort=9898 -Dhttps.proxyHost=proxy.eclipse.org -Dhttps.proxyPort=9898 -Dhttp.noProxyHosts="*.eclipse.org" -Dhttps.noProxyHosts="*.eclipse.org"'
DISPLAY = ':10'
USER = 'hudsonbuild'
QT_HOME_DIR = '/usr/share/desktop-data'
JOB_NAME = 'modisco-nightly'
HOME = '/opt/users/hudsonbuild'
LESSOPEN = 'lessopen.sh %s'
HUDSON_COOKIE = '1bd243f2-35af-4f56-8e0f-d92166f7adf4'
CSHEDIT = 'emacs'
LANG = 'en_US.UTF-8'
Comment 4 DJ Houghton CLA 2010-09-22 11:36:44 EDT
Are the single quotes around 'false' something that you added or actually part of the value of the property?
Comment 5 Nicolas Bros CLA 2010-09-22 11:51:32 EDT
(In reply to comment #4)
> Are the single quotes around 'false' something that you added or actually part
> of the value of the property?
I added it in the print statement; it's not part of the value.
Comment 6 Thomas Hallgren CLA 2010-09-22 16:16:44 EDT
(In reply to comment #1)
> Thomas, are you familiar with Buckminster and how the properties should be set
> in order to be passed along to p2?

Buckminster will just use the p2 api's to access the repositories and it doesn't interfere with what's been passed in the system properties. This is also shown in the printout from comment #3 where the eclipse.p2.mirrors = 'false' is present. 

> Have you seen any problems in this area recently?

I have seen that resolutions often take very long to complete, not just from Buckminster but also when resolving target platforms or doing normal installs into my IDE. I haven't had time to investigate deeper so I'm afraid I can't be of much help.
Comment 7 DJ Houghton CLA 2010-09-22 17:43:29 EDT
I haven't been able to reproduce this yet locally by doing regular installs. If you don't mind instrumenting your build, can you put some debug information in:
   SimpleArtifactRepository#getMirror
This is the code where we decide if we want to use a mirror or not.

I'm not sure if putting a full stack trace in the FileReader code would help or just dump out more information than we can handle.

Of course the next step would be to set up the build for remote debugging or enable us to run it locally here so we can connect.
Comment 8 Nicolas Bros CLA 2010-09-23 03:41:08 EDT
I have added debug print statements in SimpleArtifactRepository#getMirror.
I am getting: MIRRORS_ENABLED = true.

MIRRORS_ENABLED is defined as:
public static final boolean MIRRORS_ENABLED = !"false".equals(Activator.getContext().getProperty("eclipse.p2.mirrors")); //$NON-NLS-1$//$NON-NLS-2$

So, I added other print statements in SimpleArtifactRepository#getMirror:

Activator.getContext().getProperty("eclipse.p2.mirrors") returns null.

Whereas System.getProperty("eclipse.p2.mirrors") returns "false".

So, it looks like BundleContext#getProperty is not working as expected.
Comment 9 Thomas Hallgren CLA 2010-09-23 03:49:11 EDT
This might be caused by late setting of the system property. If you pass it as an option to the Buckminster command, i.e.

buckminster <some command> -Dxxx=yyy

or

buckminster -P<some property file> ...

then Buckminster will see to that it ends up in the system properties. That however, might be too late. I don't know when the p2 bundle is activated and if it's activated before the Buckminster command bundle is activated, then this would probably happen.

Can you try and pass the option as a jvm option instead? I.e.

buckminster xxxx -vmargs -Dxxx=yyy
Comment 10 Nicolas Bros CLA 2010-09-23 04:02:51 EDT
It works! Thank you Thomas.

I get:
MIRRORS_ENABLED = false
System.getProperty("eclipse.p2.mirrors") = false
Activator.getContext().getProperty("eclipse.p2.mirrors") = false

To avoid this problem in the future, maybe Buckminster could emit a warning when properties are passed in this way, and explain the better way?
Comment 11 Thomas Hallgren CLA 2010-09-23 05:16:22 EDT
I would be interested if there's a way to influence the OSGi framework after it's initialized. Regardless of that, I still think this bug is very relevant so I'm reopening it. There should be some other way to tell p2 to avoid mirrors then to just set a property.
Comment 12 Gunnar Wagenknecht CLA 2010-09-23 05:46:58 EDT
(In reply to comment #11)
> There should be some other way to tell p2 to avoid mirrors
> then to just set a property.

At least, it shouldn't be a constant but changeable at runtime. FWIW, I would also like the ability to "override" the list of mirrors at runtime or provide alternate mirrors.

Currently, I can mirror p2 repos inside my network. However, I can't use a single shared p2 target platform for developers and build systems because I manually have to switch the repos. It would be great if I can "annotate" repos at runtime with mirrors to look at with a higher priority.
Comment 13 DJ Houghton CLA 2010-09-23 08:43:20 EDT
Nicolas, thank you for the investigation. I have removed this as a blocker for bug 324983.

I have updated the bug report title to better reflect what this bug is asking for now. (see comment 12)

Gunnar, I have opened bug 326039 to address being able to pass your own list of mirrors.
Comment 14 John Arthorne CLA 2010-09-27 10:38:03 EDT

*** This bug has been marked as a duplicate of bug 266199 ***