Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.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.012 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'table.': 0.07; 'false.': 0.09; 'happen?': 0.09; 'second.': 0.09; 'python': 0.11; 'thread': 0.14; 'blocked': 0.16; 'blocking': 0.16; 'minutes.': 0.22; 'to:name:python-list@python.org': 0.22; 'this?': 0.23; 'script': 0.25; 'query': 0.26; 'this:': 0.26; 'second': 0.26; 'message- id:@mail.gmail.com': 0.30; 'usually': 0.31; 'anyone': 0.31; 'run': 0.32; 'running': 0.33; 'could': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'next': 0.36; 'too': 0.37; 'sometimes': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'delete': 0.39; 'to:addr:python.org': 0.39; 'called': 0.40; 'show': 0.63; 'taking': 0.65 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=0PeFoFGbm8WeqeslxuQwHqD6plJ8ExL1RSJw3brnR1s=; b=h0OSZjqYEU2MA9cdzUPActYrfQU3W3ANcrvpTQJWcofyWA9r18VRKof/1ufflS+xIR YsXRvoqB9mGn0XvALOOL6L1BohYBccvXO0u1AXCwWBpCc63dHsZhDbCw1QaLB65gjpEu a/hNRB5212IUqkYgFLsHH6hjdq6nHrnKsWXAFHh+UgrKg3YBMYFfe8d1Wmq0cIlGh9ko br5S1DSXTLJ35qGQgnUdyv5TUTUwiyEGunXs9I62Sh/GkHkin0jUzgmlwmcK62ekPkCg kpal3GQX012V4oSSnQ1xlXf8tJjXij9ZSERej213nZxwdvT48MNkHjuUfTryY0ZpNbkc hm+A== MIME-Version: 1.0 X-Received: by 10.180.74.142 with SMTP id t14mr22861080wiv.71.1405614409035; Thu, 17 Jul 2014 09:26:49 -0700 (PDT) Date: Thu, 17 Jul 2014 12:26:48 -0400 Subject: Blocked thread From: Larry Martell To: "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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1405614416 news.xs4all.nl 2879 [2001:888:2000:d::a6]:48958 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:74647 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 and I do this: while self.isAlive(): self.join(5) if self.isAlive(): # run query to see who is blocking Looking at the timing on this, at 13:45:11.780 I called join and at 13:46:20.118 I was running the query to check for blocking. That query does not show that the delete is running and the next time through the loop isAlive() is False. My WAG is that when the delete query is blocked the join does not return and I am 'blocked' in the join() - does that seem like what would happen? It's not what I would expect. Can anyone think of a better way to do this? I could have a second script that does it, but that's kinda messy.