Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #61667

Re: Strange crashes

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin1!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ikorot01@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.071
X-Spam-Evidence '*H*': 0.86; '*S*': 0.00; ';-)': 0.03; 'creates': 0.14; 'thread': 0.14; "wouldn't": 0.14; '*any*': 0.16; '4:25': 0.16; 'at,': 0.16; 'chris,': 0.16; 'globals': 0.16; 'igor': 0.16; 'mutable': 0.16; 'shared.': 0.16; 'sorts': 0.16; 'sqlite': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'wed,': 0.18; 'thu,': 0.19; 'this?': 0.23; "shouldn't": 0.24; 'sort': 0.25; 'header:In-Reply- To:1': 0.27; 'chris': 0.29; 'dec': 0.30; 'message- id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'easier': 0.31; 'this.': 0.32; 'probably': 0.32; 'stuff': 0.32; 'another': 0.32; 'url:python': 0.33; "i'd": 0.34; "can't": 0.35; 'created': 0.35; 'something': 0.35; 'objects': 0.35; 'operations': 0.35; 'received:google.com': 0.35; 'url:listinfo': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'should': 0.36; 'so,': 0.37; 'thank': 0.38; 'to:addr:python-list': 0.38; 'issue': 0.38; 'fact': 0.38; 'pm,': 0.38; 'that,': 0.38; 'expect': 0.39; '12,': 0.39; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'how': 0.40; 'even': 0.60; 'solve': 0.60; 'most': 0.60; 'you.': 0.62; 'more': 0.64; 'afraid': 0.65; 'due': 0.66; 'importantly,': 0.68; 'sharing': 0.69; 'protect': 0.79; 'drive.': 0.84; 'factors,': 0.84; 'replicate': 0.84; 'significance': 0.84; 'race': 0.95; '2013': 0.98
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=cK1aC3XRYnaP3wL+mRFMI9dCMD4s9Nnf65enquBgbSM=; b=rDUsrUu7O6TCRye+vYv86cdnhlpc/abuM8ema8cLSszrYy3ljbiudVevH6AbiZyCp9 SFNPWclE9txgw4D2Hqxjs/6lpCSfrKNn9w5ZMYtzdxhyYkgHturZe1pWydER7+vOC6Dd TjDw8Ot1xQjrkEjDNq9zzSSWdXbdzMhE2jiFilgel6eZFJQRAMRIecxgVdILMnuXJ7CE CNXG8tZWqpff+3Q7wGxQNY1ujTnE+GyYialnwwUAqJGd1PMfSuqyLrvCjDnlx/b80G+I VhKqHUk3fTsWRkZfXcmhZqB5roSlj81dVet53n+2FcBSWNaKupALgZv2g6wE7WEKr2Hs jrWA==
MIME-Version 1.0
X-Received by 10.220.145.75 with SMTP id c11mr2516590vcv.30.1386827241998; Wed, 11 Dec 2013 21:47:21 -0800 (PST)
In-Reply-To <CAPTjJmoMbq_Cee-DWW8R+iNt80uNAB14u_m32PhPEQy=PW7-oA@mail.gmail.com>
References <CA+FnnTwsx-AenOdnk3a2O4vfUgyuRcwpFb9to=q+kvQeXC5M_A@mail.gmail.com> <CAPTjJmoMbq_Cee-DWW8R+iNt80uNAB14u_m32PhPEQy=PW7-oA@mail.gmail.com>
Date Wed, 11 Dec 2013 21:47:21 -0800
Subject Re: Strange crashes
From Igor Korot <ikorot01@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
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.3963.1386827623.18130.python-list@python.org> (permalink)
Lines 40
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1386827623 news.xs4all.nl 2884 [2001:888:2000:d::a6]:58392
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:61667

Show key headers only | View raw


Hi, Chris,

On Wed, Dec 11, 2013 at 9:31 PM, Chris Angelico <rosuav@gmail.com> wrote:
> On Thu, Dec 12, 2013 at 4:25 PM, Igor Korot <ikorot01@gmail.com> wrote:
>> ProgrammingError: SQLite objects created in a thread can only be used
>> in that same thread.The object was created in thread id 14260 and this
>> is thread id 9264
>>
>> Where should I start looking for causes?
>
> Well, I'd look for something that creates an SQLite object on one
> thread and uses it on another :)
>
> More generally, your issue is probably due to sharing things across
> threads that shouldn't be shared. That's going to give all sorts of
> race conditions that you might never be able to replicate - the exact
> order of operations might depend on any number of factors, even stuff
> you wouldn't expect to have ANY significance like the speed of your
> hard drive. The fact that it works on your system is indicative of
> luck.
>
> See if you can avoid *any* mutable globals in your thread handlers, or
> if you can't achieve that, have a good hard look at every global that
> any thread other than the main thread can change. The less you have to
> look at, the easier it'll be to find this sort of thing.

I was afraid to the answer like this. ;-)
The codebase is huge and it a lot of queries with connect/execute/disconnect.

So, when I find the culprit variable what do I do?
Make it a part of some class? Protect it with mutex?

How to solve this? And most importantly, how do _I_ verify that its solved?

Thank you.

>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Strange crashes Igor Korot <ikorot01@gmail.com> - 2013-12-11 21:47 -0800

csiph-web