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


Groups > comp.lang.python > #26393

Re: CRC-checksum failed in gzip

Date 2012-08-02 12:14 +0200
From Laszlo Nagy <gandalf@shopzeus.com>
Subject Re: CRC-checksum failed in gzip
References (4 earlier) <CAF_E5JZ5=JkR3R=Y9VQ+sp_hCOODMaz2zHRwYVqbexNOCDNX0A@mail.gmail.com> <501961C7.1050405@shopzeus.com> <CAF_E5JamtuPZunDFMaknmBsczRzg7UkxzMsVdy122aQJOrGVKA@mail.gmail.com> <mailman.2845.1343843853.4697.python-list@python.org> <3hrpe9-hbi.ln1@satorlaser.homedns.org>
Newsgroups comp.lang.python
Message-ID <mailman.2862.1343902460.4697.python-list@python.org> (permalink)

Show all headers | View raw


> Technically, that is correct, but IMHO its complete nonsense to share 
> the file object between threads in the first place. If you need the 
> data in two threads, just read the file once and then share the 
> read-only, immutable content. If the file is small or too large to be 
> held in memory at once, just open and read it on demand. This also 
> saves you from having to rewind the file every time you read it.
>
> Am I missing something?
We suspect that his program reads the same file object from different 
threads. At least this would explain his problem. I agree with you - 
usually it is not a good idea to share a file object between threads. 
This is what I told him the first time. But it is not in our hands - he 
already has a program that needs to be fixed. It might be easier for him 
to protect read() calls with a lock. Because it can be done 
automatically, without thinking too much.

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