Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.034 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; '(python': 0.07; 'http': 0.09; 'url:github': 0.09; 'cc:addr:python-list': 0.11; 'wrote': 0.14; 'context:': 0.16; 'proxy,': 0.16; 'seconds,': 0.16; 'subject:issue': 0.16; 'timeout': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'seems': 0.21; 'machine': 0.22; 'issue.': 0.22; 'cc:addr:python.org': 0.22; 'header:User-Agent:1': 0.23; 'error': 0.23; 'gateway': 0.24; 'proxy': 0.24; 'cheers,': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'options': 0.25; 'header:In- Reply-To:1': 0.27; 'network.': 0.30; "i'm": 0.30; 'gives': 0.31; 'code': 0.31; 'requests': 0.31; 'running': 0.33; 'maybe': 0.34; 'could': 0.34; 'message.': 0.35; 'problem': 0.35; 'skip:- 50': 0.35; 'something': 0.35; 'late': 0.35; 'test': 0.35; 'but': 0.35; 'there': 0.35; '+0200,': 0.36; 'seconds': 0.37; 'application': 0.37; 'too': 0.37; 'being': 0.38; 'system,': 0.38; 'thank': 0.38; 'radio': 0.60; 'from:charset:utf-8': 0.61; 'back': 0.62; 'content- disposition:inline': 0.62; 'address': 0.63; 'answer.': 0.68; 'sound': 0.68; 'home': 0.69; 'results': 0.69; 'received:86': 0.91; 'received:hu': 0.93; '2013': 0.98 X-Spam-Flag: NO X-Spam-Score: -1.914 X-Spam-Level: X-Spam-Status: No, score=-1.914 tagged_above=-20 required=4 tests=[ALL_TRUSTED=-1, AWL=0.084, BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, NML_ADSP_CUSTOM_MED=0.9] autolearn=no Date: Thu, 17 Oct 2013 15:55:06 +0200 From: Ervin =?utf-8?Q?Heged=C3=BCs?= To: =?utf-8?B?SsOpcsO0bWU=?= Subject: Re: urllib2 timeout issue References: <20131017153405.3703a916@bouzin.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20131017153405.3703a916@bouzin.lan> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 46 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1382018239 news.xs4all.nl 15951 [2001:888:2000:d::a6]:53781 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:56961 Hello, On Thu, Oct 17, 2013 at 03:34:05PM +0200, Jérôme wrote: > Hi. > > Thank you all for your answers. > > -------------------------------------------------- > Context: > > The problem I want to address is the code being stuck too long when the > network is down. > > I'm working on a software gateway running on a Raspberry Pi, that forwards > data received through a radio link to the network. > > https://github.com/Jerome-github/oem_gateway > > This can be sending HTTP requests every 3 seconds, so a 10 secondes timeout > is an issue. > -------------------------------------------------- > > I was not at home when I wrote my last message. Now back home, I could try on > my own Debian Jessie machine (Python 2.7.5+) and I get the same results as > with the RaspberryPi (long timeout). So there seems to be something going on > with the router/modem. Has your router/modem any HTTP proxy feature? If yes, maybe the proxy gives the late answer. Anyway, if you don't have proxy, and the DNS error cames from local system, you can try to decrease it via resolv.conf: nameserver 1.2.3.4 options timeout:2 It's just an idea... but maybe... Note that the 2 seconds for DNS timeout in resolv.conf may sound crazy, because the _real_slow_ DNS answers will be timeouted for any application - just take a test with it. Cheers, Ervin