download() in util.py got "Connection refused" from some server

Bug #831784 reported by Spring Zhang
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
LAVA Dispatcher
Fix Released
High
Spring Zhang

Bug Description

Linaro image server has no such failure, but I saw it on my own server, and I think it may affect some server too.

Printing traceback will see the "Connection refused" error:
root@master:/tmp#tar czf /tmp/lava_results.tgz -C /tmp//lava/results .
 tar czf /tmp/lava_results.tgz -C /tmp//lava/results .
root@master:/tmifconfig eth0 | grep 'inet addr' | awk -F: '{print $2}' |awk '{print $1}'
{print $1}' eth0 | grep 'inet addr' | awk -F: '{print $2}' |awk '
192.168.12.2
root@master:/tmp#
id=0
python -m SimpleHTTPServer 80 &> /dev/null &
Traceback (most recent call last):
  File "/home/spring/linaro/lava/91_merged/reliable-result-transfer/lava_dispatcher/utils.py", line 35, in download
    response = urllib2.urlopen(urllib2.quote(url, safe=":/"), timeout=5)
  File "/usr/lib/python2.6/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.6/urllib2.py", line 391, in open
    response = self._open(req, data)
  File "/usr/lib/python2.6/urllib2.py", line 409, in _open
    '_open', req)
  File "/usr/lib/python2.6/urllib2.py", line 369, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.6/urllib2.py", line 1161, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/python2.6/urllib2.py", line 1136, in do_open
    raise URLError(err)
URLError: <urlopen error [Errno 111] Connection refused>
Traceback (most recent call last):
  File "./lava-dispatch", line 42, in <module>
    job.run()
  File "/home/spring/linaro/lava/91_merged/reliable-result-transfer/lava_dispatcher/__init__.py", line 103, in run
    action.run(**params)
  File "/home/spring/linaro/lava/91_merged/reliable-result-transfer/lava_dispatcher/actions/launch_control.py", line 108, in run
    result_path = download(result_tarball, tarball_dir)
  File "/home/spring/linaro/lava/91_merged/reliable-result-transfer/lava_dispatcher/utils.py", line 42, in download
    raise RuntimeError("Could not retrieve %s" % url)
RuntimeError: Could not retrieve http://192.168.12.2/lava_results.tgz

Related branches

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

I've seen this once or twice too. I assume it's a race condition, the host side attempting to connect before the board side's server is up and running (obscuring the actual error with the RuntimeError is really unhelpful btw).

Revision history for this message
Spring Zhang (qzhang) wrote : Re: [Bug 831784] Re: download() in util.py got "Connection refused" from some server

Unfortunately in my side, I failed every time with my Apache server, so I
doubt it's something wrong with my server configuration, which is a default
configuration.

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

On Wed, 24 Aug 2011 02:40:57 -0000, Spring Zhang <email address hidden> wrote:
> Unfortunately in my side, I failed every time with my Apache server, so I
> doubt it's something wrong with my server configuration, which is a default
> configuration.

Um, one of is confused I think. As I understand things, this failure is
the host side failing to connect to the SimpleHTTPServer that's running
on the board. I don't think Apache is involved? It could have a
networking cause, I guess, such as the the grovelling for the IP address
getting the wrong answer, but I think it's more likely to be a race. We
could run SimpleHTTPServer in the foreground, expect for the "Serving
HTTP on 0.0.0.0 port 80" message and then EINTR the process -- might be
slighlty more reliable. I guess it would also be good to see what the
underlying socket error is before working too much in this direction.

Cheers,
mwh

Revision history for this message
Spring Zhang (qzhang) wrote :

sorry, my mistake, it's SimpleHTTPServer! Apache is my LAVA server.

Spring Zhang (qzhang)
Changed in lava-dispatcher:
assignee: nobody → Spring Zhang (qzhang)
status: New → Fix Committed
milestone: none → 2011.09
importance: Undecided → High
Fathi Boudra (fboudra)
Changed in lava-dispatcher:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.