Skip to contentSkip to conversation

get_toolchain_configs: be robust against network errors

Buildroot Peter Korsgaard 2 participants 3 messages Feb 14, 2017 – Feb 15, 2017

lore
Share & tools
lore
#0 lore raw

Once in a while some of my autobuilder instances hangs with an exception from urllib:

Process Process-1:
Traceback (most recent call last):
File "/home/peko/host/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap

    self.run()
  File "/home/peko/host/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "/home/peko/buildroot-test/scripts/autobuild-run", line 804, in run_instance
    ret = gen_config(**kwargs)
  File "/home/peko/buildroot-test/scripts/autobuild-run", line 526, in gen_config
    configs = get_toolchain_configs()
  File "/home/peko/buildroot-test/scripts/autobuild-run", line 291, in get_toolchain_configs
    with urlopen_closing(config["url"]) as r:
  File "/home/peko/buildroot-test/scripts/autobuild-run", line 146, in <lambda>
    urlopen_closing = lambda uri: contextlib.closing(urlopen(uri))
  File "/home/peko/host/usr/lib/python2.7/urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "/home/peko/host/usr/lib/python2.7/urllib2.py", line 404, in open
    response = self._open(req, data)
  File "/home/peko/host/usr/lib/python2.7/urllib2.py", line 422, in _open
    '_open', req)

File "/home/peko/host/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(*args)
File "/home/peko/host/usr/lib/python2.7/urllib2.py", line 1214, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/home/peko/host/usr/lib/python2.7/urllib2.py", line 1184, in do_open
raise URLError(err)
URLError: <urlopen error [Errno -2] Name or service not known>

If this happens, simply ignore the configuration and try again.

---
 scripts/autobuild-run | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
scripts/autobuild-run +5 -1
index cf19735..37c2b12 100755
@@ -528,7 +528,11 @@ def gen_config(**kwargs):
     log_write(log, "INFO: generate the configuration")
 
     # Select a random toolchain configuration
-    configs = get_toolchain_configs(**kwargs)
+    try:
+        configs = get_toolchain_configs(**kwargs)
+    except:
+        return -1
+
     i = randint(0, len(configs) - 1)
     config = configs[i]
 
Signature · 1 line
2.11.0
Reviewed-by
#1 lore raw

Peter, All,

On 2017-02-14 22:36 +0100, Peter Korsgaard spake thusly:

Quoted 31 lines

Once in a while some of my autobuilder instances hangs with an exception from urllib:

Process Process-1:
Traceback (most recent call last):
File "/home/peko/host/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap

    self.run()
  File "/home/peko/host/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "/home/peko/buildroot-test/scripts/autobuild-run", line 804, in run_instance
    ret = gen_config(**kwargs)
  File "/home/peko/buildroot-test/scripts/autobuild-run", line 526, in gen_config
    configs = get_toolchain_configs()
  File "/home/peko/buildroot-test/scripts/autobuild-run", line 291, in get_toolchain_configs
    with urlopen_closing(config["url"]) as r:
  File "/home/peko/buildroot-test/scripts/autobuild-run", line 146, in <lambda>
    urlopen_closing = lambda uri: contextlib.closing(urlopen(uri))
  File "/home/peko/host/usr/lib/python2.7/urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "/home/peko/host/usr/lib/python2.7/urllib2.py", line 404, in open
    response = self._open(req, data)
  File "/home/peko/host/usr/lib/python2.7/urllib2.py", line 422, in _open
    '_open', req)

File "/home/peko/host/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(*args)
File "/home/peko/host/usr/lib/python2.7/urllib2.py", line 1214, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/home/peko/host/usr/lib/python2.7/urllib2.py", line 1184, in do_open
raise URLError(err)
URLError: <urlopen error [Errno -2] Name or service not known>

Quoted 3 lines

If this happens, simply ignore the configuration and try again.

Regards,
Yann E. MORIN.

Quoted 28 lines
---
 scripts/autobuild-run | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
scripts/autobuild-run +5 -1
index cf19735..37c2b12 100755
@@ -528,7 +528,11 @@ def gen_config(**kwargs):
     log_write(log, "INFO: generate the configuration")
 
     # Select a random toolchain configuration
-    configs = get_toolchain_configs(**kwargs)
+    try:
+        configs = get_toolchain_configs(**kwargs)
+    except:
+        return -1
+
     i = randint(0, len(configs) - 1)
     config = configs[i]
 
Signature · 6 lines
2.11.0

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw
In reply to Peter Korsgaard
Quoted 33 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Korsgaard <[email protected]> writes:

Once in a while some of my autobuilder instances hangs with an exception from urllib:

Process Process-1:
Traceback (most recent call last):
File "/home/peko/host/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap

    self.run()
  File "/home/peko/host/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "/home/peko/buildroot-test/scripts/autobuild-run", line 804, in run_instance
    ret = gen_config(**kwargs)
  File "/home/peko/buildroot-test/scripts/autobuild-run", line 526, in gen_config
    configs = get_toolchain_configs()
  File "/home/peko/buildroot-test/scripts/autobuild-run", line 291, in get_toolchain_configs
    with urlopen_closing(config["url"]) as r:
  File "/home/peko/buildroot-test/scripts/autobuild-run", line 146, in <lambda>
    urlopen_closing = lambda uri: contextlib.closing(urlopen(uri))
  File "/home/peko/host/usr/lib/python2.7/urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "/home/peko/host/usr/lib/python2.7/urllib2.py", line 404, in open
    response = self._open(req, data)
  File "/home/peko/host/usr/lib/python2.7/urllib2.py", line 422, in _open
    '_open', req)

File "/home/peko/host/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
result = func(*args)
File "/home/peko/host/usr/lib/python2.7/urllib2.py", line 1214, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/home/peko/host/usr/lib/python2.7/urllib2.py", line 1184, in do_open
raise URLError(err)
URLError: <urlopen error [Errno -2] Name or service not known>

Quoted 3 lines

If this happens, simply ignore the configuration and try again.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard