From b1b66be5937ca906737bb2238c87e3e5464bd507 Mon Sep 17 00:00:00 2001 From: Marian Beermann Date: Thu, 30 Mar 2017 13:09:02 +0200 Subject: [PATCH 1/2] fix chunker holding the GIL during blocking I/O --- src/borg/_chunker.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/borg/_chunker.c b/src/borg/_chunker.c index b72f6bd8b..9b7e7137f 100644 --- a/src/borg/_chunker.c +++ b/src/borg/_chunker.c @@ -157,6 +157,8 @@ chunker_fill(Chunker *c) off_t offset, length; int overshoot; PyObject *data; + PyThreadState *thread_state; + memmove(c->data, c->data + c->last, c->position + c->remaining - c->last); c->position -= c->last; c->last = 0; @@ -165,6 +167,8 @@ chunker_fill(Chunker *c) return 1; } if(c->fh >= 0) { + thread_state = PyEval_SaveThread(); + offset = c->bytes_read; // if we have a os-level file descriptor, use os-level API n = read(c->fh, c->data + c->position + c->remaining, n); @@ -177,6 +181,7 @@ chunker_fill(Chunker *c) c->eof = 1; } else { + PyEval_RestoreThread(thread_state); // some error happened PyErr_SetFromErrno(PyExc_OSError); return 0; @@ -211,6 +216,8 @@ chunker_fill(Chunker *c) posix_fadvise(c->fh, offset & ~pagemask, length - overshoot, POSIX_FADV_DONTNEED); #endif + + PyEval_RestoreThread(thread_state); } else { // no os-level file descriptor, use Python file object API From 55e0c43c531a68577ea64a9ff5ff373a5698344a Mon Sep 17 00:00:00 2001 From: Marian Beermann Date: Sat, 29 Jul 2017 11:55:26 +0200 Subject: [PATCH 2/2] add zeromq dependency --- docs/global.rst.inc | 1 + docs/installation.rst | 15 ++++++++++++++- setup.py | 9 ++++++--- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/docs/global.rst.inc b/docs/global.rst.inc index 88c659a36..b6b98ab71 100644 --- a/docs/global.rst.inc +++ b/docs/global.rst.inc @@ -16,6 +16,7 @@ .. _libattr: https://savannah.nongnu.org/projects/attr/ .. _liblz4: https://github.com/Cyan4973/lz4 .. _libb2: https://github.com/BLAKE2/libb2 +.. _ZeroMQ: http://zeromq.org/ .. _OpenSSL: https://www.openssl.org/ .. _`Python 3`: https://www.python.org/ .. _Buzhash: https://en.wikipedia.org/wiki/Buzhash diff --git a/docs/installation.rst b/docs/installation.rst index de7a582aa..353254c38 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -142,6 +142,7 @@ following dependencies first: * OpenSSL_ >= 1.0.0, plus development headers. * libacl_ (which depends on libattr_), both plus development headers. * liblz4_, plus development headers. +* ZeroMQ_ >= 4.0.0, plus development headers. * some Python dependencies, pip will automatically install them for you * optionally, the llfuse_ Python package is required if you wish to mount an archive as a FUSE filesystem. See setup.py about the version requirements. @@ -169,6 +170,7 @@ Install the dependencies with development headers:: libssl-dev openssl \ libacl1-dev libacl1 \ liblz4-dev liblz4-1 \ + libzmq3-dev libzmq3 \ build-essential sudo apt-get install libfuse-dev fuse pkg-config # optional, for FUSE support @@ -179,6 +181,8 @@ group, log out and log in again. Fedora / Korora +++++++++++++++ +.. todo:: Add zeromq + Install the dependencies with development headers:: sudo dnf install python3 python3-devel python3-pip python3-virtualenv @@ -192,6 +196,8 @@ Install the dependencies with development headers:: openSUSE Tumbleweed / Leap ++++++++++++++++++++++++++ +.. todo:: Add zeromq + Install the dependencies automatically using zypper:: sudo zypper source-install --build-deps-only borgbackup @@ -207,6 +213,8 @@ Alternatively, you can enumerate all build dependencies in the command line:: Mac OS X ++++++++ +.. todo:: Add zeromq + Assuming you have installed homebrew_, the following steps will install all the dependencies:: @@ -222,7 +230,10 @@ FUSE for OS X, which is available as a pre-release_. FreeBSD ++++++++ -Listed below are packages you will need to install |project_name|, its dependencies, + +.. todo:: Add zeromq + +Listed below are packages you will need to install Borg, its dependencies, and commands to make FUSE work for using the mount command. :: @@ -253,6 +264,8 @@ Cygwin Running under Cygwin is experimental and has only been tested with Cygwin (x86-64) v2.5.2. Remote repositories are known broken, local repositories should work. +.. todo:: Add zeromq + Use the Cygwin installer to install the dependencies:: python3 python3-devel python3-setuptools diff --git a/setup.py b/setup.py index dd85db6a1..92bcaac4f 100644 --- a/setup.py +++ b/setup.py @@ -22,9 +22,12 @@ if my_python < min_python: # Are we building on ReadTheDocs? on_rtd = os.environ.get('READTHEDOCS') -# msgpack pure python data corruption was fixed in 0.4.6. -# Also, we might use some rather recent API features. -install_requires = ['msgpack-python>=0.4.6', ] +install_requires = [ + # msgpack pure python data corruption was fixed in 0.4.6. + # Also, we might use some rather recent API features. + 'msgpack-python>=0.4.6', + 'pyzmq', +] # note for package maintainers: if you package borgbackup for distribution, # please add llfuse as a *requirement* on all platforms that have a working