Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BrokenPipeError for remote archives #233

Closed
ThomasWaldmann opened this issue Mar 14, 2015 · 5 comments
Closed

BrokenPipeError for remote archives #233

ThomasWaldmann opened this issue Mar 14, 2015 · 5 comments

Comments

@ThomasWaldmann
Copy link
Contributor

I encountered this issue in a bit strange way, by trying to use zlib level 0.
But I guess this could happen otherwise also, e.g. if data compresses really badly. Or even otherwise.

In attic/key.py (about line 80), there is a line like:

return b''.join([self.TYPE_STR, zlib.compress(data)])

Add compression level 0 there (instead of the implicit default level 6):

return b''.join([self.TYPE_STR, zlib.compress(data, 0)])

Now run the unit tests: fakeroot -u tox

You may have one additional issue in the test log now:

284 test_overwrite (attic.testsuite.archiver.RemoteArchiverTestCase) ... Traceback (most recent call last):
285   File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
286     "__main__", mod_spec)
287   File "/usr/lib/python3.4/runpy.py", line 85, in _run_code
288     exec(code, run_globals)
289   File "/tmp/merge/.tox/py34/lib/python3.4/site-packages/attic/archiver.py", line 740, in <module>
290     main()
291   File "/tmp/merge/.tox/py34/lib/python3.4/site-packages/attic/archiver.py", line 727, in main
292     exit_code = archiver.run(sys.argv[1:])
293   File "/tmp/merge/.tox/py34/lib/python3.4/site-packages/attic/archiver.py", line 717, in run
294     return args.func(args)
295   File "/tmp/merge/.tox/py34/lib/python3.4/site-packages/attic/archiver.py", line 54, in do_serve
296     return RepositoryServer(restrict_to_paths=args.restrict_to_paths).serve()
297   File "/tmp/merge/.tox/py34/lib/python3.4/site-packages/attic/remote.py", line 58, in serve
298     sys.stdout.buffer.write(msgpack.packb((1, msgid, None, res)))
299 BrokenPipeError: [Errno 32] Broken pipe

It was reproduced by @paolodina on ubuntu 14.10 64bit and me on ubuntu 14.04 64bit.
dcrouch from IRC #attic could not reproduce on centos 6.6.

A special thing to note about zlib level 0 is that output data always will be bigger than input data.

@ThomasWaldmann
Copy link
Contributor Author

Something within these changes broke it (I used git bisect to find it):

git diff c973040..bd5b72a

@ThomasWaldmann
Copy link
Contributor Author

it is not in zlib.

i kept zlib default level and just appended >64kB dummy bytes to compression result (and stripped it from end before invoking decompress) - that breaks it in exactly the same way.

@ThomasWaldmann
Copy link
Contributor Author

I found it is related to pipe I/O, fix coming soon, just doing some final tests.

@ThomasWaldmann
Copy link
Contributor Author

See PR #234.

@paolodina
Copy link

@ThomasWaldmann I run the tests with fakeroot -u tox and confirm the BrokenPipeError disappeared. Good for me on xubuntu 14.10.

@ThomasWaldmann ThomasWaldmann changed the title zlib level 0 - potential attic or platform issue pipe I/O issue for remote archives Mar 15, 2015
@ThomasWaldmann ThomasWaldmann changed the title pipe I/O issue for remote archives BrokenPipeError for remote archives Mar 15, 2015
@jborg jborg closed this as completed in cbbe0fc Apr 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants