Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!rt.uk.eu.org!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.01; 'oct': 0.02; 'value,': 0.04; '>in': 0.07; 'app,': 0.07; 'bug.': 0.07; 'threads,': 0.07; 'url:gnu': 0.07; 'python': 0.08; 'exception:': 0.09; 'exceptions': 0.09; 'exceptions,': 0.09; 'filename': 0.09; 'googled': 0.09; 'indicates': 0.09; 'pos': 0.09; 'presume': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:modules': 0.09; 'suggestions:': 0.09; 'truncate': 0.09; 'subject:python': 0.10; 'library': 0.13; 'gui': 0.13; 'url:software': 0.13; '>can': 0.16; '[errno': 0.16; 'bieber': 0.16; 'case...': 0.16; 'email addr:ix.netcom.com': 0.16; 'email name:wlfraed': 0.16; 'from:addr:ix.netcom.com': 0.16; 'from:addr:wlfraed': 0.16; 'from:name:dennis lee bieber': 0.16; 'integers.': 0.16; 'invoking': 0.16; 'message-id:@4ax.com': 0.16; 'oleg': 0.16; 'received:wlfraed': 0.16; 'skip:> 40': 0.16; 'subject:handling': 0.16; 'url:manual': 0.16; 'url:netcom': 0.16; 'url:wlfraed': 0.16; 'wulfraed': 0.16; 'wrote:': 0.16; 'wed,': 0.17; 'linux': 0.17; '>>>': 0.18; 'occurred': 0.18; 'wrap': 0.18; 'written': 0.19; 'extension': 0.21; 'url:home': 0.21; 'feb': 0.22; 'complete,': 0.23; 'documented': 0.23; 'module,': 0.23; 'received:166': 0.23; 'translated': 0.23; 'math': 0.24; "python's": 0.24; 'suspect': 0.24; 'traceback': 0.24; 'function': 0.27; 'raise': 0.28; '3.0': 0.28; 'lee': 0.28; 'second': 0.29; 'handling': 0.30; 'i/o': 0.30; 'skip:> 30': 0.30; 'modules': 0.32; "can't": 0.32; 'sort': 0.32; 'to:addr:python-list': 0.33; 'object': 0.33; 'all.': 0.34; 'header:X-Complaints-To:1': 0.34; 'towards': 0.35; 'suggestions': 0.35; 'skip:" 20': 0.35; 'operating': 0.35; 'file': 0.35; 'skip:" 10': 0.36; 'charset:us- ascii': 0.36; 'but': 0.37; 'received:org': 0.37; 'unless': 0.37; 'another': 0.37; 'happens': 0.37; 'signal': 0.38; 'some': 0.38; 'subject:with': 0.38; 'skip:o 20': 0.38; "i'd": 0.39; 'url:org': 0.39; 'why': 0.39; 'being': 0.39; 'subject:: ': 0.39; 'to:addr:python.org': 0.40; 'one,': 0.40; '2011': 0.60; 'most': 0.60; 'more': 0.61; 'your': 0.61; 'waiting': 0.62; 'show': 0.67; 'ports': 0.67; 'serial': 0.71; 'dennis': 0.73; 'interrupted': 0.73; '(4,': 0.84; '-0800': 0.84; '>some': 0.84; 'interrupt': 0.84; 'samsung': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: python reliability with EINTR handling in general modules Date: Wed, 01 Feb 2012 11:07:13 -0500 References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: mobile-166-147-100-048.mycingular.net X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES 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: 72 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1328112606 news.xs4all.nl 6941 [2001:888:2000:d::a6]:48372 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:19715 On Wed, 1 Feb 2012 06:15:22 -0800 (PST), oleg korenevich wrote: >I have linux board on samsung SoC s3c6410 (ARM11). I build rootfs with >buildroot: Python 2.7.1, uClibc-0.9.31. Linux kernel: Linux buildroot >2.6.28.6 #177 Mon Oct 3 12:50:57 EEST 2011 armv6l GNU/Linux > >My app, written on python, in some mysterios conditons raise this >exceptions: > >1) exception: > > File "./dfbUtils.py", line 3209, in setItemData >ValueError: (4, 'Interrupted system call') >code: > >currentPage=int(math.floor(float(rowId)/ >self.pageSize))==self.selectedPage >2) exception: > >File "./terminalGlobals.py", line 943, in getFirmawareName >OSError: [Errno 4] Interrupted system call: 'firmware' >code: > >for fileName in os.listdir('firmware'): >Some info about app: it have 3-7 threads, listen serial ports via >'serial' module, use gui implemented via c extension that wrap >directfb, i can't reproduce this exceptions, they are not predictable. > >I googled for EINTR exceptions in python, but only found that EINTR >can occur only on slow system calls and python's modules socket, >subprocess and another one is already process EINTR. So what happens >in my app? Why simple call of math function can interrupt program at >any time, it's not reliable at all. I have only suggestions: ulibc >bug, kernel/hw handling bug. But this suggestions don't show me >solution. I see nothing in your traceback that indicates that the interrupt occurred in the math library call -- unless you deleted that line. In the first one, I'd be more likely to suspect your C extension/wrapper... (are the fields .pageSize and .selectedPage coming from an object implemented in C?) As for the math stuff... I presume both rowID and .pageSize are constrained to be 0 or positive integers. If that is the case, invoking math.floor() is just redundant overhead as the documented behavior of int() is to truncate towards 0, which for a positive value, is the same as floor() >>> neg = -3.141592654 >>> pos = 3.141592654 >>> int(neg) -3 >>> math.floor(neg) -4.0 >>> int(pos) 3 >>> math.floor(pos) 3.0 >>> In the second case... Well, os.listdir() is most likely translated into some operating system call. http://www.gnu.org/software/libc/manual/html_node/Interrupted-Primitives.html And, while that call is waiting for I/O to complete, some sort of signal is being received. -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/