Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'thread,': 0.04; 'exits': 0.07; 'subject:issue': 0.07; 'threads,': 0.07; 'unexpected': 0.07; 'python': 0.08; 'underlying': 0.09; 'url:github': 0.09; 'cleanly': 0.16; 'does,': 0.16; 'cc:addr:python-list': 0.16; 'looked': 0.16; 'wrote:': 0.18; 'seems': 0.20; "haven't": 0.20; 'cc:no real name:2**0': 0.21; 'header:In-Reply-To:1': 0.22; '(or': 0.22; 'happening': 0.24; 'cc:2**0': 0.26; 'code': 0.26; 'fact': 0.27; 'not.': 0.28; 'cc:addr:python.org': 0.29; 'pm,': 0.29; 'generally': 0.30; 'terminate': 0.30; 'threads': 0.30; 'specifically': 0.30; 'like.': 0.32; 'thread': 0.32; 'header:User- Agent:1': 0.33; 'fri,': 0.34; 'test': 0.34; 'lee': 0.34; 'flag': 0.34; 'yet,': 0.34; 'finished': 0.35; 'example,': 0.37; 'executing': 0.37; 'but': 0.37; 'using': 0.37; 'references': 0.38; 'data': 0.38; 'recommended': 0.39; 'application': 0.40; 'john': 0.61; 'your': 0.61; 'provided': 0.62; 'subject: / ': 0.63; 'cause': 0.67; 'here:': 0.67; '11:37': 0.84; 'clemens': 0.84 Date: Sat, 17 Mar 2012 18:17:10 -0400 From: Lee Clemens User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120209 Thunderbird/10.0.1 MIME-Version: 1.0 To: John O'Hagan Subject: Re: Daemonization / Popen / pipe issue References: <4F63F2FE.1030409@leeclemens.net> <20120317143726.7134d2b04d56d1759d8eeeb6@johnohagan.com> In-Reply-To: <20120317143726.7134d2b04d56d1759d8eeeb6@johnohagan.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:xwjvOy/W6Bs+vWgsYr8Na/RvKxpzjaJCz2TSxpkqQsM 1JfUvj4LK6ixQErClm5FZT56mGgWUSwRHB7il3vRwOIJSRZ6W2 QtegBoBNfNTALiNtwZyWMRiq6kC14hFL4ZdHDOMSYj+EMnuAw6 7TrYenJ+RaW026Xmdri5PisoRAqz/uLuLVdYnTeN3F0rFkdNWT mu9NZsjlN3f12xNQjyxI5vTeND5aVGjYmiar58YHRjeIopr/QC kGdcPjqZWZUPeQ3HZ7h0NVB1x5WVupL0EMZGGHvWRowxIc7Lth PJvl6pbTfJzDdaGfqwNyJiKlL/WwOZLiQ8FcOXYEPWaOvabhr6 oKaw5AhzR/yYcggQKjn4= Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1332022695 news.xs4all.nl 6849 [2001:888:2000:d::a6]:34602 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:21836 On 03/16/2012 11:37 PM, John O'Hagan wrote: > On Fri, 16 Mar 2012 22:12:14 -0400 > Lee Clemens wrote: > >> I have a multi-threaded application >> >> I have provided a test-case here: https://gist.github.com/2054194 > I haven't looked at your test case yet, but a possible cause is the fact that > the main application (or main thread) exits if it has finished executing and > only daemon threads remain. This can abruptly terminate threads which may be > busy, for example, communicating via a pipe. The best solution IMO is not to > use daemon threads, but to give all threads a way to terminate cleanly before > the main thread does, even if this means using a flag or the like. > > HTH, > > John > I call .join() on each spawned thread, whether it is daemonized or not. The code is available here: https://gist.github.com/2054194 Is it generally not recommended to daemonize Python applications using this method? Do you have any references or data to support your opinion? Do you have any references which specifically state - "Daemonizing Python applications cause Python to work in unexpected ways."? As that is what seems to be happening - data corrupting pipe redirection at an underlying level....