Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'example:': 0.03; 'exception': 0.03; 'say,': 0.05; 'bug.': 0.07; 'puts': 0.07; 'suppose': 0.07; 'calculates': 0.09; 'explanation': 0.09; 'fails.': 0.09; 'received:mail-lpp01m010-f46.google.com': 0.09; 'threads,': 0.09; 'bug': 0.10; 'cc:addr:python-list': 0.10; 'thread': 0.11; 'aug': 0.13; '(the': 0.15; 'file,': 0.15; 'blocks': 0.16; 'disk.': 0.16; 'intermittent': 0.16; 'involved?': 0.16; 'passes,': 0.16; 'sense,': 0.16; 'sorts': 0.16; 'subject:failed': 0.16; 'surprising': 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; 'wed,': 0.16; 'wrote:': 0.17; 'fix': 0.17; 'code,': 0.18; 'code.': 0.20; 'trying': 0.21; 'cc:2**0': 0.23; "haven't": 0.23; 'seems': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'bugs': 0.27; 'guess': 0.27; 'handling': 0.27; 'errors.': 0.27; 'forgot': 0.27; 'message-id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'rest': 0.28; 'initial': 0.28; 'run': 0.28; 'post': 0.28; '+0100,': 0.29; "d'aprano": 0.29; 'really,': 0.29; 'running.': 0.29; 'steven': 0.29; 'starts': 0.29; 'probably': 0.29; "i'm": 0.29; 'connection': 0.30; 'received:209.85.215.46': 0.30; 'expect': 0.31; 'code': 0.31; 'point': 0.31; 'gets': 0.32; 'asking': 0.32; 'problem.': 0.32; 'file': 0.32; "aren't": 0.33; 'problem': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'clear': 0.35; 'remote': 0.35; "won't": 0.35; 'received:209.85': 0.35; 'there': 0.35; 'really': 0.36; 'but': 0.36; 'depends': 0.36; "didn't": 0.36; 'anything': 0.36; 'two': 0.37; 'why': 0.37; 'detail': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'some': 0.38; 'there,': 0.38; 'where': 0.40; 'subject:-': 0.40; 'header:Received:5': 0.40; 'help': 0.40; 'your': 0.60; 'back': 0.62; 'different': 0.63; 'ever': 0.63; 'details': 0.63; 'andrea': 0.84; 'completely,': 0.84; 'find.': 0.84; 'goose': 0.84; 'troubles': 0.84; 'shares': 0.91; 'lot,': 0.95 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=29A7DN4V6FJX8rXzj9Kuujh3cvyQztS12JHTKyLRFWA=; b=VSZ/w8/Sf1hZvggqV46ga2y260xNtuZSRGg6mVigE9tOnJd2byFztpu8DzNh8tOlRV YiqSYYfXCFg824W4cJtQoaHp5gJTammrwaYWhVW8lVnbT0LWEN4VVDWqAbSOeTVWwDZD 2aP9hyvs5ALe/khkMNGEjAhvo7zl3ZNW2Qg/jhVWm/gZ+Io/CzZQqoLqXlLf3dvf5xjQ 9zfxwKw8l0e7bOBTVlKTJd0ug4qU5QDn01zaK6fXmyisQOMzsmK2JvahCDYzJ8sC3V9A gfUpmkgIoWpzNxJkNDZFtzd2wIVU+6Z0oxU0XnPnMrTBwEPgUJuyz+vpFcTPYDq7H69O 2N1Q== MIME-Version: 1.0 In-Reply-To: <501956a7$0$29978$c3e8da3$5496439d@news.astraweb.com> References: <50190ED6.1040100@shopzeus.com> <501956a7$0$29978$c3e8da3$5496439d@news.astraweb.com> Date: Wed, 1 Aug 2012 17:38:56 +0100 Subject: Re: CRC-checksum failed in gzip From: andrea crotti To: "Steven D'Aprano" 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 56 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1343839139 news.xs4all.nl 6969 [2001:888:2000:d::a6]:34081 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:26370 2012/8/1 Steven D'Aprano : > On Wed, 01 Aug 2012 14:01:45 +0100, andrea crotti wrote: > >> Full traceback: >> >> Exception in thread Thread-8: > > "DANGER DANGER DANGER WILL ROBINSON!!!" > > Why didn't you say that there were threads involved? That puts a > completely different perspective on the problem. > > I *was* going to write back and say that you probably had either file > system corruption, or network errors. But now that I can see that you > have threads, I will revise that and say that you probably have a bug in > your thread handling code. > > I must say, Andrea, your initial post asking for help was EXTREMELY > misleading. You over-simplified the problem to the point that it no > longer has any connection to the reality of the code you are running. > Please don't send us on wild goose chases after bugs in code that you > aren't actually running. > > >> there seems to be no clear pattern and just randmoly fails. > > 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. > Thanks a lot, that makes a lot of sense.. I haven't given this detail before because I didn't write this code, and I forgot that there were threads involved completely, I'm just trying to help to fix this bug. Your explanation makes a lot of sense, but it's still surprising that even just reading files without ever writing them can cause troubles using threads :/