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


Groups > comp.lang.python > #88386

Re: Lockfile hanling

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <skip.montanaro@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.031
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'url:pypi': 0.03; 'cc:addr :python-list': 0.11; "(i'm": 0.16; 'issue?': 0.16; 'prevent': 0.16; 'wrote:': 0.18; 'python?': 0.22; 'cc:addr:python.org': 0.22; '31,': 0.24; 'module,': 0.24; 'skip': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'correct': 0.29; 'am,': 0.29; 'reaches': 0.30; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'author,': 0.31; 'weeks': 0.32; 'url:python': 0.33; 'received:google.com': 0.35; 'url:org': 0.36; 'handle': 0.38; 'files': 0.38; 'how': 0.40; 'to:addr:gmail.com': 0.65; 'close': 0.67; 'mar': 0.68; '2015': 0.84
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 :cc:content-type:content-transfer-encoding; bh=aPrvN40haQii85GonDsFcmZfMhrFtxskwhiY1MyZ9rA=; b=hd2YDYNrIyNWZODGIt5bBO325YDMzPcktZv/qhilcEq8I0kiitCSB8uWd/I6oy1ZHf NspvMjBKY6FjKNjfyZss+ajtFsvplXOjMNLKyJSP47auVa2WowAOwdKDR3udw4hg7KQs NwiNJOEG9DF3wGnkoPudZvO1j8TJF+rOfGpeRS0ARTv2Bhj4VWoKB+a6A0W50ZzRaSo1 A52u28O8lDwuYo5emoppbrFCTfs3J55ixTtIuvMfyKxHy7XLD0vv+dsJChAKOS/ZGLE1 8UM8JkSzF8Kv4+KnjGTVhN83MokljP3Jo1bSAScuMsqfbEll4JgoYnZkvn1SEWk3jIJx qyVg==
MIME-Version 1.0
X-Received by 10.183.11.97 with SMTP id eh1mr33287852obd.7.1427813757700; Tue, 31 Mar 2015 07:55:57 -0700 (PDT)
In-Reply-To <20150331145012.GA4460@arxnet.hu>
References <20150331145012.GA4460@arxnet.hu>
Date Tue, 31 Mar 2015 09:55:57 -0500
Subject Re: Lockfile hanling
From Skip Montanaro <skip.montanaro@gmail.com>
To Ervin Hegedüs <airween@gmail.com>
Cc Python <python-list@python.org>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.19
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.375.1427813777.10327.python-list@python.org> (permalink)
Lines 19
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1427813777 news.xs4all.nl 2841 [2001:888:2000:d::a6]:34826
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:88386

Show key headers only | View raw


On Tue, Mar 31, 2015 at 9:50 AM, Ervin Hegedüs <airween@gmail.com> wrote:
> After few weeks the process
> reaches the number if max fd's.
>
> How can I prevent or avoid this issue? What's the correct way to
> handle the lockfile in Python?

Ervin,

You need to close the files you open. I don't see that happening in
your code snippet. You might consider the pylockfile module, available
from PyPI:

https://pypi.python.org/pypi/lockfile

(I'm the original author, though others have taken it over.)

Skip

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


Thread

Re: Lockfile hanling Skip Montanaro <skip.montanaro@gmail.com> - 2015-03-31 09:55 -0500

csiph-web