Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #74665
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed0.kamp.net!newsfeed.kamp.net!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.87.MISMATCH!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.017 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'else:': 0.03; 'detect': 0.07; 'committing': 0.09; 'way:': 0.09; 'cc:addr:python-list': 0.11; 'enough.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'seconds,': 0.16; 'time.time()': 0.16; 'version"': 0.16; 'wrote:': 0.18; 'obviously': 0.18; 'trying': 0.19; 'backend': 0.19; 'commit': 0.19; 'things.': 0.19; 'work,': 0.20; 'minutes.': 0.22; 'otherwise,': 0.22; 'cc:addr:python.org': 0.22; '(or': 0.24; 'cc:2**0': 0.24; 'script': 0.25; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'am,': 0.29; 'raise': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'larry': 0.31; 'long.': 0.31; 'run': 0.32; 'says': 0.33; 'fri,': 0.33; 'actual': 0.34; "i'd": 0.34; 'could': 0.34; 'connection': 0.35; 'something': 0.35; 'case,': 0.35; 'done.': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'done': 0.36; 'wrong': 0.37; 'too': 0.37; 'being': 0.38; 'server': 0.38; 'massive': 0.38; 'whatever': 0.38; 'rather': 0.38; 'does': 0.39; 'tell': 0.60; 'monitoring': 0.61; 'simple': 0.61; 'first': 0.61; 'more': 0.64; 'taking': 0.65; 'insight': 0.68; 'jul': 0.74; 'goal': 0.75; 'monitoring.': 0.84; 'naughty': 0.84; 'to:none': 0.92 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=IVC5rF0rbxPURT1erCLMZc4rH1gR3wDt7E7uTfYycmE=; b=pM+6KtSXQm4xbcDPxivi2cM3E0GWkBrY8QRl26koQSFI8Jc3SMi/U60qjkjTaS7lSa xUwgrhf1Izdrx1vgVsCPC3dbkGnVGMHSEeXrXoFYQh+8nkQxLpCNeZtQVFBjjZ0bjYwv EWlN0QA4ljqpMJx8lj9zOku4/yQDD+kNqjp57wAwbncFTu8wBbPjK3v0x0DntpyvFy2s bfa4i30KrYdWw6vK9lzrLgguoSbKfHyM/ugDlDkAKKRrq6JY+1cG1g5V5wVXy1M57AKf 28dzKRDMowCM44BYZSfAE8KMaYRT2B6HLEcRcpuh1mdvVwAPjBT1hqixZ6bTzxEo5iUV H2BQ== |
| MIME-Version | 1.0 |
| X-Received | by 10.220.1.70 with SMTP id 6mr20280030vce.62.1405621157308; Thu, 17 Jul 2014 11:19:17 -0700 (PDT) |
| In-Reply-To | <CACwCsY7rjermm=NJCB8sVCjnppFOst3v7pFcss_PwTKaV7nfHg@mail.gmail.com> |
| References | <CACwCsY7BWeV14+=OHbgYyfwV8qGkTv_nRC4e4+Ahxv3+RP+tng@mail.gmail.com> <CAPTjJmpi8d28ahbba0LNQU8rY4r0EvwUmDS2zRMVsUn0tubtuQ@mail.gmail.com> <CANc-5UyPjdozTKjOzOy6H=Ar3_Jzx1MU68qymyEoFWx7p_piEQ@mail.gmail.com> <CACwCsY54hxnRHainr7Mk6T=tEosTC2ja-pk7=_6QL11MKsD3+g@mail.gmail.com> <CAPTjJmrapq_bLOEYcwh3+MTrb1JCyUxJYuHrN2Vkd+aU9N12=A@mail.gmail.com> <CACwCsY7rjermm=NJCB8sVCjnppFOst3v7pFcss_PwTKaV7nfHg@mail.gmail.com> |
| Date | Fri, 18 Jul 2014 04:19:17 +1000 |
| Subject | Re: Blocked thread |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| 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> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.11944.1405621159.18130.python-list@python.org> (permalink) |
| Lines | 31 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1405621159 news.xs4all.nl 2933 [2001:888:2000:d::a6]:44607 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:74665 |
Show key headers only | View raw
On Fri, Jul 18, 2014 at 4:13 AM, Larry Martell <larry.martell@gmail.com> wrote:
> But every once it a while it takes 2 minutes. It will be hard
> to detect that manually. What I was trying to do in my threaded code
> was detect when it was taking more than 5 seconds, and then start
> monitoring it.
Fair enough. In that case, I'd just do it the simple way: get the
backend PID (or whatever other connection identification is
appropriate), spin off a thread/process to do the monitoring. It
sleeps five seconds, then does its first query. If the server says
that connection's done its work, easy! Disconnect, job done.
Otherwise, do whatever monitoring you can.
But if your main goal is diagnosis, rather than monitoring, here's a
really really naughty idea that might help: Refrain from committing if
it's taken too long. Something like this:
start = time.time()
# do the actual work, but don't commit
if time.time() > start + 5:
# raise an alarm, tell a human being that something's wrong
else:
commit()
Obviously you run this "dangeroussed-up version" of the script only
when there's a person there to react to the alarm, otherwise you go
for the normal one. But this could give you a massive insight into
what's happening, because until you commit, you have all your locks
and things.
ChrisA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Blocked thread Chris Angelico <rosuav@gmail.com> - 2014-07-18 04:19 +1000
csiph-web