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


Groups > comp.lang.python > #88399

Re: Lockfile hanling

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'error:': 0.07; 'modify': 0.07; 'weeks.': 0.07; 'app,': 0.09; 'method:': 0.09; 'weeks,': 0.09; 'thread': 0.14; '24]': 0.16; 'files:': 0.16; 'mechanism.': 0.16; 'threads.': 0.16; 'prevent': 0.16; 'wrote:': 0.18; 'file,': 0.19; 'written': 0.21; '31,': 0.24; 'bytes': 0.24; 'file.': 0.24; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'file': 0.32; 'open': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'should': 0.36; 'application': 0.37; 'too': 0.37; 'christian': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'here': 0.66; 'between': 0.67; 'mar': 0.68; '3-4': 0.68; '2015': 0.84; 'datas': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=IUG5HWShE4SEw5qVib5Pn6A8vnFQuSEkxL9cj5rv44s=; b=t5zFKdF8wl1IcV1mEGHzaVEK2KDmMuhnQPIRiQDdFTgJXeYriHsc0RXQmCElb+HN4I PX96fOOZ7YyeWNmf/tV3VOLCyIDQQEHxnvb0v7Yj5y22vLIb+i4GXcfjO3hI1jY9zVcq KXV6wEcqLQaOhO2DqrW34OvVL6ycSFi8t0CiUCrESg7Vkjnul93SgiBL2lEHbCxivRDt 3YoG4Y4VYyfmuBnxmSGSAx76L2Iu7ybkdEZn9TzhGbN2G0KPaxIb69KldiKTm0a+tp/u T56Qoe+mIieMTv0SreRFIrl92LyJAQa0eRx4sJcU1VRNKZQ9VNXyxLaw1GDTOK0hByv9 fa5A==
X-Received by 10.66.100.138 with SMTP id ey10mr70067729pab.142.1427829471094; Tue, 31 Mar 2015 12:17:51 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <mfeqm7$r6e$1@dont-email.me>
References <mailman.374.1427813384.10327.python-list@python.org> <mfeqm7$r6e$1@dont-email.me>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Tue, 31 Mar 2015 13:17:10 -0600
Subject Re: Lockfile hanling
To 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.385.1427829474.10327.python-list@python.org> (permalink)
Lines 23
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1427829474 news.xs4all.nl 2864 [2001:888:2000:d::a6]:43505
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:88399

Show key headers only | View raw


On Tue, Mar 31, 2015 at 12:58 PM, Christian Gollwitzer <auriocus@gmx.de> wrote:
> Am 31.03.15 um 16:50 schrieb Ervin Hegedüs:
>>
>> there is an app, written in Python, which stores few bytes of
>> datas in a single file. The application uses threads. Every
>> thread can modify the file, but only one at a time. I'm using a
>> lock file to prevent the multiple access.
>>
>> Here is the lock method:
>>
>> [...]
>> This works as well for me - about 3-4 weeks. After some weeks, I
>> got this error:
>>
>> OSError: [Errno 24] Too many open files: '/var/spool/myapp/queue.lock'
>>
>
> Can you try if fcntl.flock() does what you want? Should be better than
> inventing your own locking mechanism.

flock locks are per-process; they won't help for synchronizing access
between competing threads in the same process.

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


Thread

Lockfile hanling Ervin Hegedüs <airween@gmail.com> - 2015-03-31 16:50 +0200
  Re: Lockfile hanling Christian Gollwitzer <auriocus@gmx.de> - 2015-03-31 20:58 +0200
    Re: Lockfile hanling Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-31 13:17 -0600
      Re: Lockfile hanling Christian Gollwitzer <auriocus@gmx.de> - 2015-03-31 21:59 +0200
        Re: Lockfile hanling Ian Kelly <ian.g.kelly@gmail.com> - 2015-03-31 14:12 -0600
        Re: Lockfile hanling Sturla Molden <sturla.molden@gmail.com> - 2015-04-01 23:51 +0000

csiph-web