Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed5.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'anyway.': 0.04; 'memory.': 0.05; 'correct.': 0.07; '(although': 0.09; 'exiting': 0.09; 'linux/unix': 0.09; 'sure)': 0.09; '*and': 0.16; 'call)': 0.16; 'mapped': 0.16; 'resource,': 0.16; 'segfault': 0.16; 'segment': 0.16; 'sense,': 0.16; 'up*': 0.16; 'working.': 0.17; '>>>': 0.18; 'memory': 0.18; 'somebody': 0.23; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'implemented': 0.27; 'parent': 0.29; "i'm": 0.29; '(and': 0.32; 'subject:data': 0.33; 'surely': 0.33; 'to:addr:python-list': 0.33; 'process,': 0.35; "won't": 0.35; 'something': 0.35; 'created': 0.36; 'but': 0.36; 'child': 0.36; 'why': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'think': 0.40; 'received:204': 0.72; '100%': 0.76; 'killed': 0.91 Date: Wed, 01 Aug 2012 16:42:44 +0200 From: Laszlo Nagy User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Pass data to a subprocess References: <5017EFB0.6080608@shopzeus.com> <50193DE4.3030404@shopzeus.com> In-Reply-To: <50193DE4.3030404@shopzeus.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1343832169 news.xs4all.nl 6892 [2001:888:2000:d::a6]:55307 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:26363 >>> Yes, I think that is correct. >> I don't understand why detaching a child process on Linux/Unix would >> make IPC stop working. Can somebody explain? >> > It is implemented with shared memory. I think (although I'm not 100% > sure) that shared memory is created *and freed up* (shm_unlink() > system call) by the parent process. It makes sense, because the child > processes will surely die with the parent. If you detach a child > process, then it won't be killed with its original parent. But the > shared memory will be freed by the original parent process anyway. I > suspect that the child that has mapped that shared memory segment will > try to access a freed up resource, do a segfault or something similar. So detaching the child process will not make IPC stop working. But exiting from the original parent process will. (And why else would you detach the child?)