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


Groups > comp.lang.python > #26389

Re: CRC-checksum failed in gzip

Path csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <andrea.crotti.0@gmail.com>
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; 'example:': 0.03; '__name__': 0.07; 'bug.': 0.07; 'suppose': 0.07; 'calculates': 0.09; 'threads,': 0.09; 'bug': 0.10; 'cc:addr:python-list': 0.10; 'def': 0.10; 'thread': 0.11; '(the': 0.15; 'file,': 0.15; "'__main__':": 0.16; 'blocks': 0.16; 'disk.': 0.16; 'intermittent': 0.16; 'passes,': 0.16; 'reproduce': 0.16; 'run(self):': 0.16; 'sorts': 0.16; 'subject:failed': 0.16; 'threading': 0.16; 'threads': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'fix': 0.17; 'import': 0.21; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'idea': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'bugs': 0.27; 'guess': 0.27; 'start,': 0.27; 'message-id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'rest': 0.28; 'run': 0.28; "d'aprano": 0.29; 'really,': 0.29; 'steven': 0.29; 'starts': 0.29; 'class': 0.29; 'expect': 0.31; 'code': 0.31; 'gets': 0.32; 'file': 0.32; 'could': 0.32; 'right?': 0.33; 'problem': 0.33; "can't": 0.34; 'received:google.com': 0.34; 'remote': 0.35; "won't": 0.35; 'received:209.85': 0.35; 'there': 0.35; 'add': 0.36; 'really': 0.36; 'but': 0.36; 'depends': 0.36; 'anything': 0.36; 'should': 0.36; 'two': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'skip:o 20': 0.38; 'some': 0.38; 'there,': 0.38; 'where': 0.40; 'subject:-': 0.40; 'header:Received:5': 0.40; 'help': 0.40; 'matter': 0.61; 'details': 0.63; 'find.': 0.84; 'happening?': 0.84; 'shares': 0.91
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; bh=zgZOv42og0wY0+o0M/2WRMJap1Hlw1f9OmqIllO65WI=; b=Dv3omEtk9O1nQq89z5hd3E6385OtifycEn9VF5GCkC6X1ggJqTmAKx/do8jTUYy7iD qnO+M6WdkPlxoasmNrQutyL0+Ac2Ii21Dg3YHMv8i6RSw48J09LfLflmZw+YdQd3yuD7 EzSyWMB+tXTqzAeOvQ3OtXXjFsE/DL3+lP3pdMYRLvOfovAU9LZAJYFi6JmQeWKgTs8f WDAOqPtRZqGaURGcqYtrXWWTqVDp/xt7XrEC3jY6JTBrL2iC0eWG+nDZ/UNoLZhvXn5j Wc5JIc53UfCWURGRaaosYoDl8k8S2ecZ7+L3Wci5btIhnU6goGBhARbmsGGTc2GuZ0Et Zgig==
MIME-Version 1.0
In-Reply-To <501956a7$0$29978$c3e8da3$5496439d@news.astraweb.com>
References <CAF_E5JahAZ4w3em_aqBbx63pxiTU-nqtRLZWb5_jRQr2yqhRWA@mail.gmail.com> <50190ED6.1040100@shopzeus.com> <mailman.2825.1343826107.4697.python-list@python.org> <501956a7$0$29978$c3e8da3$5496439d@news.astraweb.com>
Date Thu, 2 Aug 2012 10:26:51 +0100
Subject Re: CRC-checksum failed in gzip
From andrea crotti <andrea.crotti.0@gmail.com>
To "Steven D'Aprano" <steve+comp.lang.python@pearwood.info>
Content-Type text/plain; charset=ISO-8859-1
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 <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2859.1343899619.4697.python-list@python.org> (permalink)
Lines 49
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1343899619 news.xs4all.nl 6889 [2001:888:2000:d::a6]:52173
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:26389

Show key headers only | View raw


2012/8/1 Steven D'Aprano <steve+comp.lang.python@pearwood.info>:
>
> When you start using threads, you have to expect these sorts of
> intermittent bugs unless you are very careful.
>
> My guess is that you have a bug where two threads read from the same file
> at the same time. Since each read shares state (the position of the file
> pointer), you're going to get corruption. Because it depends on timing
> details of which threads do what at exactly which microsecond, the effect
> might as well be random.
>
> Example: suppose the file contains three blocks A B and C, and a
> checksum. Thread 8 starts reading the file, and gets block A and B. Then
> thread 2 starts reading it as well, and gets half of block C. Thread 8
> gets the rest of block C, calculates the checksum, and it doesn't match.
>
> I recommend that you run a file system check on the remote disk. If it
> passes, you can eliminate file system corruption. Also, run some network
> diagnostics, to eliminate corruption introduced in the network layer. But
> I expect that you won't find anything there, and the problem is a simple
> thread bug. Simple, but really, really hard to find.
>
> Good luck.

One last thing I would like to do before I add this fix is to actually
be able to reproduce this behaviour, and I thought I could just do the
following:

import gzip
import threading


class OpenAndRead(threading.Thread):
    def run(self):
        fz = gzip.open('out2.txt.gz')
        fz.read()
        fz.close()


if __name__ == '__main__':
    for i in range(100):
        OpenAndRead().start()


But no matter how many threads I start, I can't reproduce the CRC
error, any idea how I can try to help it happening?

The code in run should be shared by all the threads since there are no
locks, right?

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


Thread

Re: CRC-checksum failed in gzip andrea crotti <andrea.crotti.0@gmail.com> - 2012-08-01 14:01 +0100
  Re: CRC-checksum failed in gzip Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-01 16:17 +0000
    Re: CRC-checksum failed in gzip andrea crotti <andrea.crotti.0@gmail.com> - 2012-08-01 17:38 +0100
    Re: CRC-checksum failed in gzip Laszlo Nagy <gandalf@shopzeus.com> - 2012-08-01 19:05 +0200
    Re: CRC-checksum failed in gzip andrea crotti <andrea.crotti.0@gmail.com> - 2012-08-01 18:17 +0100
    Re: CRC-checksum failed in gzip Laszlo Nagy <gandalf@shopzeus.com> - 2012-08-01 19:57 +0200
      Re: CRC-checksum failed in gzip Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-08-02 10:49 +0200
        Re: CRC-checksum failed in gzip Laszlo Nagy <gandalf@shopzeus.com> - 2012-08-02 12:14 +0200
    Re: CRC-checksum failed in gzip andrea crotti <andrea.crotti.0@gmail.com> - 2012-08-02 10:26 +0100
    Re: CRC-checksum failed in gzip Laszlo Nagy <gandalf@shopzeus.com> - 2012-08-02 12:21 +0200
    Re: CRC-checksum failed in gzip andrea crotti <andrea.crotti.0@gmail.com> - 2012-08-02 11:57 +0100
    Re: CRC-checksum failed in gzip andrea crotti <andrea.crotti.0@gmail.com> - 2012-08-02 11:59 +0100

csiph-web