Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #108639
| Path | csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Pavlos Parissis <pavlos.parissis@gmail.com> |
| Newsgroups | comp.lang.python |
| Subject | intermittent ValueErrors from subprocess |
| Date | Sun, 15 May 2016 17:49:49 +0200 |
| Lines | 103 |
| Message-ID | <mailman.32.1463327394.2226.python-list@python.org> (permalink) |
| References | <57389A9D.1010205@gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="NdDh6tjMhghA2dghThnpLE85d6ba1SjeK" |
| X-Trace | news.uni-berlin.de zrFqQjUA6FvyEMnxLBLdGwzuxrIGgo4YuT52eywcfA0Q== |
| Return-Path | <pavlos.parissis@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'error:': 0.05; 'dev': 0.07; 'executed': 0.07; 'valueerror:': 0.07; 'cmd': 0.09; 'exception:': 0.09; 'url:github': 0.09; 'valueerror': 0.09; 'thread': 0.10; 'python': 0.10; 'exception': 0.13; "'to',": 0.16; 'cmd,': 0.16; 'filename:fname piece:signature': 0.16; 'intermittent': 0.16; 'loopback': 0.16; 'received:192.168.0.103': 0.16; 'received:74.125.82.46': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'reproduce': 0.16; 'running:': 0.16; 'subprocess': 0.16; 'threads': 0.16; 'try:': 0.18; 'runs': 0.18; 'skip:" 30': 0.20; 'parse': 0.22; 'cheers,': 0.22; 'this:': 0.23; 'header:User-Agent:1': 0.26; 'question': 0.27; 'skip:u 20': 0.28; 'interface': 0.29; 'consequence': 0.29; 'code': 0.30; 'anyone': 0.32; '[1]': 0.32; 'dies': 0.33; 'raised': 0.33; 'message- id:@gmail.com': 0.34; 'file': 0.34; 'except': 0.34; 'received:google.com': 0.35; 'so,': 0.35; 'could': 0.35; 'false': 0.35; 'happened': 0.35; 'path': 0.35; 'stable': 0.35; 'unknown': 0.35; 'quite': 0.35; 'received:74.125.82': 0.35; 'but': 0.36; 'assigned': 0.36; 'to:addr:python-list': 0.36; 'hi,': 0.38; 'data': 0.39; 'subject:from': 0.39; "didn't": 0.39; 'received:192': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'behavior': 0.61; 'address': 0.61; 'avoid': 0.61; 'show': 0.62; 'more': 0.63; 'here:': 0.63; 'times': 0.63; 'object:': 0.84; 'url:master': 0.84; 'before?': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=to:from:subject:message-id:date:user-agent:mime-version; bh=PQ02hz/pnVndFG5pO98nOfrk5z39Qdj47T2elA1epKI=; b=O0VAz/YH1EKN79f2fKhXQkOVng4MGnisb1HajaLFIV3Suzx0zu6XbU3uw4RaSBMX8N wdvwsmR2nwinm1hkjehKXVmjHJgD/Rqw8K4NxW4cth7FjZrzfyy6ZWsATRjDZkCcQitt O/aARdXX33bgl6RTbiBq0B5Vfqh+mt2E48LiRKuGgEd1vghclwmR3n+sqDOn7CHup6qD RHDQnvgz2URyTboArLWDXu25plyduYV8+e0UiDAHR5FVXiCedMr899CitAIt0JXSy8WD EGtgMJUU++WfEcQcwKMWYPTgRAVtF3OptfwOehxCHyf4n5Bcjw9ZsleLlDbhaYNt3/5l +gCg== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version; bh=PQ02hz/pnVndFG5pO98nOfrk5z39Qdj47T2elA1epKI=; b=IPnl37JINPv9TtSoUs+kSOLzDVBQ1B9nCtKmLcMYCcnP6ln6IXXi7VpWZ+qE4HCuiL JQLEzPoSpgKgB67vBplFKW6IUoP0HTrr0hbWHXLJGB7Qw/6fhqgUAhO0+2wE91SMG1Uh TwaiFPxzHTIcB/3yP+9PZ7cyvNkczS4MDLUCsPRys19wJOfXmzfO1ZLOQhKg4mbqR1Au na8HLMN5Fi6+qKTXioSPpzyddORQlaQtnbzMud2CvL0E/sqSSVjPr7DuiRE75WQMCjZS wwEwjptUAJMjuMVjLzI0lmZJ5F4U8ia3cLuoElVA97pBEMLx91DtKBFlO7vOWjLTu94r R09g== |
| X-Gm-Message-State | AOPr4FWikeW9wCHJcrGZGodpl0FFzcoa8D0XD4xP3YwJ7TfbRjGxesLebOtbQip2PNMP2w== |
| X-Received | by 10.194.79.70 with SMTP id h6mr28754585wjx.157.1463327392377; Sun, 15 May 2016 08:49:52 -0700 (PDT) |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.7.0 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.22 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <57389A9D.1010205@gmail.com> |
| Xref | csiph.com comp.lang.python:108639 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
Hi,
I get intermittent ValueErrors[1] from subprocess when I check if an IP
is assigned to loopback interface by running:
/sbin/ip address show dev lo to 10.52.12.2/32
I use subprocess.check_output like this:
cmd = [
'/sbin/ip',
'address',
'show',
'dev',
"{}".format(self.config['interface']),
'to',
"{}".format(self.config['ip_prefix']),
]
try:
out = subprocess.check_output(
cmd,
universal_newlines=True,
timeout=1)
except subprocess.CalledProcessError as error:
return True
except subprocess.TimeoutExpired:
return True
else:
if self.config['ip_prefix'] in out:
return True
else:
return False
and I get the following exception:
ValueError: Invalid file object: <_io.TextIOWrapper name=11
encoding='UTF-8'>
As a consequence of the raised exception thread dies and I now catch
ValueError in the same try block in order to avoid the crash.
It has happened ~5 times and this code is executed from multiple
threads and every ~10secs on several(~40) systems for more than
18months. So, it is quite impossible for me to reproduce it.
It could be that the system returns corrupted data or python fails for
some unknown reason to parse the output.
The program uses Python 3.4.4 and runs on Debian stable and CentOS 6/7.
The full code path in question can be found here:
https://github.com/unixsurfer/anycast_healthchecker/blob/master/anycast_healthchecker/servicecheck.py#L90
I did a search on bugs.python.org about it but I didn't find anything.
Has anyone seen this behavior before?
Cheers,
Pavlos
[1] https://gist.github.com/unixsurfer/67db620d87f667423f6f6e3a04e0bff5
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
intermittent ValueErrors from subprocess Pavlos Parissis <pavlos.parissis@gmail.com> - 2016-05-15 17:49 +0200
csiph-web