Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #74655
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <larry.martell@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.056 |
| X-Spam-Evidence | '*H*': 0.89; '*S*': 0.00; 'table.': 0.07; 'postgresql,': 0.09; 'second.': 0.09; 'whatever.': 0.09; 'python': 0.11; 'thread': 0.14; 'blocked': 0.16; 'blocking': 0.16; 'timestamps': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'backend': 0.19; 'server,': 0.19; 'thu,': 0.19; 'seems': 0.21; 'select': 0.22; 'issue.': 0.22; 'minutes.': 0.22; 'separate': 0.22; 'to:name :python-list@python.org': 0.22; 'script.': 0.24; 'script': 0.25; 'query': 0.26; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'that.': 0.31; 'usually': 0.31; 'larry': 0.31; 'probably': 0.32; 'run': 0.32; 'quite': 0.32; 'fri,': 0.33; 'guess': 0.33; 'table': 0.34; 'info': 0.35; 'connection': 0.35; 'transaction': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'idle': 0.36; 'oracle': 0.36; 'doing': 0.36; 'should': 0.36; 'too': 0.37; 'sometimes': 0.38; 'server': 0.38; 'connections': 0.38; 'to:addr :python-list': 0.38; 'issue': 0.38; 'pm,': 0.38; 'rather': 0.38; 'that,': 0.38; 'anything': 0.39; 'does': 0.39; 'delete': 0.39; 'to:addr:python.org': 0.39; 'skip:- 60': 0.39; 'skip:p 20': 0.39; 'how': 0.40; 'even': 0.60; 'monitoring': 0.61; "you're": 0.61; "you'll": 0.62; 'such': 0.63; 'more': 0.64; 'taking': 0.65; 'facilities': 0.69; 'jul': 0.74; '(better': 0.84; 'started,': 0.84; 'transactions': 0.91; 'whereas': 0.91; 'connection,': 0.95 |
| 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:to :content-type; bh=f4q+Y6DZ2T2YH3byAoOup2Xuaa63NORjqd7wVCBFp/Y=; b=ZbmCp8QdZgpVfuI5tNPX75YxgMMOEdHO9Jj6+8JXgMnUbF00WuhkxqvirMpUYo4++V kNwcbME5OHfEUsjVPyUNOGrm/6YnbT9ggnhHqyOPHXsv6zzSe+crTX5phhxE0aSYPKQS a1Vb9hSPI9px98t/hqM4iSYmNit6qmbJLUmdbeXvJC1rkN9r9uMsVCJg43h66As+6gjH m2porwEBrRazisSv6ffF5tu+fCNMGvBPSl8ZC+Zh5VG4iOY/PN/x9s8QPtENk4+47um9 LkWABPxPlIs7ZaL+gXw6Nf4JJEuMh+znP8nFOLePCefjH6MbjFG5iy3jsbtsgufEg9Jp Q1Tg== |
| MIME-Version | 1.0 |
| X-Received | by 10.194.86.225 with SMTP id s1mr47426644wjz.21.1405619721906; Thu, 17 Jul 2014 10:55:21 -0700 (PDT) |
| In-Reply-To | <CAPTjJmpi8d28ahbba0LNQU8rY4r0EvwUmDS2zRMVsUn0tubtuQ@mail.gmail.com> |
| References | <CACwCsY7BWeV14+=OHbgYyfwV8qGkTv_nRC4e4+Ahxv3+RP+tng@mail.gmail.com> <CAPTjJmpi8d28ahbba0LNQU8rY4r0EvwUmDS2zRMVsUn0tubtuQ@mail.gmail.com> |
| Date | Thu, 17 Jul 2014 13:55:21 -0400 |
| Subject | Re: Blocked thread |
| From | Larry Martell <larry.martell@gmail.com> |
| To | "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.11937.1405619727.18130.python-list@python.org> (permalink) |
| Lines | 40 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1405619727 news.xs4all.nl 2886 [2001:888:2000:d::a6]:49272 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:74655 |
Show key headers only | View raw
On Thu, Jul 17, 2014 at 1:32 PM, Chris Angelico <rosuav@gmail.com> wrote: > On Fri, Jul 18, 2014 at 2:26 AM, Larry Martell <larry.martell@gmail.com> wrote: >> I have a python cx_Oracle script that does a delete from a table. >> Usually this takes well under 1 second. But sometimes it takes 1 to 2 >> minutes. I wanted to monitor that delete and if it's taking too long I >> want to see what is blocking it. I run the delete sql in a thread... > > I don't know Oracle specifically, but if it's anything like > PostgreSQL, you'll probably do better with a completely separate > connection to the server, which might need to be a separate process. > In PostgreSQL, I can query currently-active transactions thus: > > rosuav=> select state,query from pg_stat_activity; > state | query > ---------------------+------------------------------------------- > idle in transaction | select * from pg_stat_activity; > active | select state,query from pg_stat_activity; > active | drop table test; > (3 rows) > > (Better than that: Add "where pid=..." to that, using the backend PID > provided by the thread you're monitoring, by "SELECT > pg_backend_pid()". But that's even more PostgreSQL-specific.) > > With info like that, you can see what's happening, and whether it's > stalled out or in a query or whatever. You should also be able to get > some timestamps (Postgres can do that, I would be highly surprised if > Oracle can't), such as when the transaction started, so you can see > how long it's been stalled. > > Thing is, this requires a quite separate connection, which means > you're monitoring the far end rather than the local thread. I suspect > this will give you better results; Oracle's bound to have facilities > for doing this, whereas your local thread may or may not be usefully > monitorable. I can have as many connections to the db server as I want, that's not the issue. The issue is that my main thread seems to be blocked in the join(), so I guess I'm going to need a separate script. I was trying to avoid that.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Blocked thread Larry Martell <larry.martell@gmail.com> - 2014-07-17 13:55 -0400
csiph-web