wendelin.core:024c246c54534bb238533a0ab47997fef6c98bd8 commitshttps://lab.nexedi.com/nexedi/wendelin.core/-/commits/024c246c54534bb238533a0ab47997fef6c98bd82017-01-16T18:01:10+03:00https://lab.nexedi.com/nexedi/wendelin.core/-/commit/024c246c54534bb238533a0ab47997fef6c98bd8bigfile/py/loadblk: Resort to pybuf unpinninf, if nothing helps2017-01-16T18:01:10+03:00Kirill Smelkovkirr@nexedi.com
There are situations possible when both exc_traceback and frame objects are
garbage-collected, but frame's f_locals remains not collected because e.g. it
was explicitly added to somewhere. We cannot detect such cases (dicts are not
listed in referrers).
So if nothing helped, as a last resort, unpin pybuf from its original
memory and make it point to zero-sized NULL.
In general this is not strictly correct to do as other buffers &
memoryview objects created from pybuf, copy its pointer on
initialization and thus pybuf unpinning won't adjust them.
However we require BigFile implementations to make sure not to use
such-created objects, if any, after return from loadblk().
Finally fixes <a href="https://lab.nexedi.com/nexedi/wendelin.core/issues/7" data-original="https://lab.nexedi.com/nexedi/wendelin.core/issues/7" data-link="false" data-link-reference="true" data-project="21" data-issue="85" data-reference-type="issue" data-container="body" data-placement="top" data-html="true" title="wendelin.core can kill a zope process" class="gfm gfm-issue has-tooltip">#7</a>https://lab.nexedi.com/nexedi/wendelin.core/-/commit/3a8e1bebc32506bc519e5d9ae8451e0d692d643fbigfile/py: Factor out code to "unpin" a buffer to separate functions2017-01-16T17:10:28+03:00Kirill Smelkovkirr@nexedi.com
This code was added in <a href="/nexedi/wendelin.core/-/commit/6da5172e3c087324b0fffdb1e373407e1066c4f8" data-original="6da5172e" data-link="false" data-link-reference="false" data-project="21" data-commit="6da5172e3c087324b0fffdb1e373407e1066c4f8" data-reference-type="commit" data-container="body" data-placement="top" data-html="true" title="bigfile/py: Teach storeblk() how to correctly propagate traceback on error" class="gfm gfm-commit has-tooltip">6da5172e</a> (bigfile/py: Teach storeblk() how to
correctly propagate traceback on error) to unpin a storeblk pybuf to not
care whether its refcount == 1 - this way to be able to propagate python
error upper not caring whether pybuf is still referenced or not.
<a href="/nexedi/wendelin.core/-/commit/9aa6a5d7d1cfb7d2cb573bdc2d87db9de43c9dd7" data-original="9aa6a5d7" data-link="false" data-link-reference="false" data-project="21" data-commit="9aa6a5d7d1cfb7d2cb573bdc2d87db9de43c9dd7" data-reference-type="commit" data-container="body" data-placement="top" data-html="true" title="bigfile/py: Teach loadblk() to automatically break reference cycles to pybuf" class="gfm gfm-commit has-tooltip">9aa6a5d7</a> (bigfile/py: Teach loadblk() to automatically break reference
cycles to pybuf) adds a note that such unpinning is not strictly
correct: becuase of other buffer objects were created from pybuf - they
are copying pointers on initialization and unpinning pybuf won't adjust
them.
However for loadblk codepath it turned out (see next patch) it is not
completely possible to unreference pybuf in all cases. For this reason
loadblk will be falling back to unpinning too.
As a preparatory step move common code to shared functions.https://lab.nexedi.com/nexedi/wendelin.core/-/commit/61b18a40aba7742c671e8fe76cdb70baf03a61b6bigfile/py/loadblk: Replace pybuf with a stub object in calling frame in case...2017-01-16T17:06:48+03:00Kirill Smelkovkirr@nexedi.com
It turns out some code wants to store tracebacks e.g. for further
logging/whatever. This way GC won't help to free up references to pybuf.
However if pybuf remain referenced only from calling frames, we can
change there reference to pybuf to a stub object "<pybuf>" and this way
remove the reference.
With added test but without loadblk changes the failure would be as:
pybigfile_loadblk WARN: pybuf->ob_refcnt != 1 even after GC:
pybuf (ob_refcnt=2): <read-write buffer ptr 0x7fae4911f000, size 2097152 at 0x7fae4998cef0>
pybuf referrers: [<frame object at 0x556daff41aa0>] <-- NOTE
bigfile/_bigfile.c:613 pybigfile_loadblk BUG!https://lab.nexedi.com/nexedi/wendelin.core/-/commit/f01b27d21a99d5b9b5a859d6b863cb29c65b72b7bigfile/py/test_basic: Rework exception testing codepath so it is active on p...2017-01-16T17:03:37+03:00Kirill Smelkovkirr@nexedi.com
As comments being removed states "on python3 exception state is cleared
upon exiting from `except`" - so let's move exc_* fetching under except
clause - this way we'll get correct exception objects on both py2 and py3.https://lab.nexedi.com/nexedi/wendelin.core/-/commit/ca7c1b6d1859948ad39a273457014e0ea281c5d1bigfile/py: Factor outcode to get list of objects that refer to obj to XPyObj...2017-01-12T18:26:32+03:00Kirill Smelkovkirr@nexedi.com
We'll need it in next patch to get and analyze this list.https://lab.nexedi.com/nexedi/wendelin.core/-/commit/20b41a5a526a9c2f360c0836b80b171529a580d6bigfile/py: Dump pybuf referrers if pybuf->ob_refcnt != 1 before dying in loa...2017-01-12T16:57:16+03:00Kirill Smelkovkirr@nexedi.com
Instead of only printing "BUG" let's print information about objects
which still refer to pybuf - to help debugging.
For example with the following artificial pybuf leak
```
diff --git a/bigfile/tests/test_basic.py b/bigfile/tests/test_basic.py
index c737621..f5e057a 100644
--- a/bigfile/tests/test_basic.py
+++ b/bigfile/tests/test_basic.py
@@ -126,6 +126,7 @@ def test_basic():
# test that python exception state is preserved across pagefaulting
def test_pagefault_savestate():
+ zzz = []
class BadFile(BigFile):
def loadblk(self, blk, buf):
# simulate some errors in-between to overwrite thread exception
@@ -154,6 +155,7 @@ def loadblk(self, blk, buf):
# which result in holding additional ref to buf, but loadblk caller
# will detect and handle this situation via garbage-collecting
# above cycle.
+ zzz.append(buf)
self.loadblk_run = 1
```
it dies this way:
bigfile/_bigfile.c:567 pybigfile_loadblk WARN: pybuf->ob_refcnt != 1 even after GC:
pybuf (ob_refcnt=2): <read-write buffer ptr 0x7f08d3e88000, size 2097152 at 0x7f08d48b7070>
pybuf referrers: [[<read-write buffer ptr 0x7f08d3e88000, size 2097152 at 0x7f08d48b7070>]]
bigfile/_bigfile.c:573 pybigfile_loadblk BUG!https://lab.nexedi.com/nexedi/wendelin.core/-/commit/9aa6a5d7d1cfb7d2cb573bdc2d87db9de43c9dd7bigfile/py: Teach loadblk() to automatically break reference cycles to pybuf2017-01-11T17:03:07+03:00Kirill Smelkovkirr@nexedi.com
Because otherwise we bug on pybuf->ob_refcnt != 1.
Such cycles might happen if inside loadblk implementation an exception
is internally raised and then caught even in deeply internal function
which does not receive pybuf as argument or by some other way:
After
_, _, exc_traceback = sys.exc_info()
there is a reference loop created:
exc_traceback
| ^
| |
v .f_localsplus
frame
and since exc_traceback object holds reference to deepest frame, which via f_back
will be holding reference to frames up to frame with pybuf argument, it
will result in additional reference to pybuf being held until the above
cycle is garbage collected.
So to solve the problem while leaving loadblk, if pybuf->ob_refcnt !=
let's first do garbage-collection, and only then recheck left
references. After GC reference-loops created by exceptions should go
away.
NOTE PyGC_Collect() (C way to call gc.collect()) always performs
GC - it is not affected by gc.disable() which disables only
_automatic_ garbage collection.
NOTE it turned out out storeblk logic to unpin pybuf (see
<a href="/nexedi/wendelin.core/-/commit/6da5172e3c087324b0fffdb1e373407e1066c4f8" data-original="6da5172e" data-link="false" data-link-reference="false" data-project="21" data-commit="6da5172e3c087324b0fffdb1e373407e1066c4f8" data-reference-type="commit" data-container="body" data-placement="top" data-html="true" title="bigfile/py: Teach storeblk() how to correctly propagate traceback on error" class="gfm gfm-commit has-tooltip">6da5172e</a> "bigfile/py: Teach storeblk() how to correctly propagate
traceback on error") is flawed, because when e.g. creating memoryview
from pybuf internal pointer is copied and then clearing original buf
does not result in clearing the copy.
NOTE it is ok to do gc.collect() from under sighandler - at least we are
already doing it for a long time via running non-trivial python code
which for sure triggers automatic GC from time to time (see also
<a href="/nexedi/wendelin.core/-/commit/786d418d27ce2077d2a84bb2be9f852a055f9940" data-original="786d418d" data-link="false" data-link-reference="false" data-project="21" data-commit="786d418d27ce2077d2a84bb2be9f852a055f9940" data-reference-type="commit" data-container="body" data-placement="top" data-html="true" title="bigfile: Simple test that we can handle GC from-under sighandler" class="gfm gfm-commit has-tooltip">786d418d</a> "bigfile: Simple test that we can handle GC from-under
sighandler" for the reference)
Fixes: <a href="https://lab.nexedi.com/nexedi/wendelin.core/issues/7" data-original="https://lab.nexedi.com/nexedi/wendelin.core/issues/7" data-link="false" data-link-reference="true" data-project="21" data-issue="85" data-reference-type="issue" data-container="body" data-placement="top" data-html="true" title="wendelin.core can kill a zope process" class="gfm gfm-issue has-tooltip">#7</a>https://lab.nexedi.com/nexedi/wendelin.core/-/commit/b4c269eb834942acb7fe6debef44ac1af8824a38bigfile/py: Factor exception state clearing code to XPyErr_FullClear()2017-01-11T16:49:15+03:00Kirill Smelkovkirr@nexedi.com
In the next patch we will need to use this from several places.https://lab.nexedi.com/nexedi/wendelin.core/-/commit/e73e22eaed0ac018fbd89b000d40ccbfb03b311bwendelin.core v0.82016-09-28T15:25:15+03:00Kirill Smelkovkirr@nexedi.comhttps://lab.nexedi.com/nexedi/wendelin.core/-/commit/0effd9dc3a139043fc4b40dd0a3575c8a7852c483rdparty/ccan: Update2016-09-28T14:53:16+03:00Kirill Smelkovkirr@nexedi.com
Just update to latest CCAN for it to be a fresh one.https://lab.nexedi.com/nexedi/wendelin.core/-/commit/542917d1382a14415914bc22877d6571a04b6f3cbigfile/zodb/ZBlk1: Don't miss to deactivate/free internal .chunktab buckets ...2016-08-14T19:26:05+03:00Kirill Smelkovkirr@nexedi.com
<a href="/kirr/wendelin.core/-/commit/13c0c17c287dfd0f7f422918f8108ee45c2675ec" data-original="13c0c17c" data-link="false" data-link-reference="false" data-project="20" data-commit="13c0c17c287dfd0f7f422918f8108ee45c2675ec" data-reference-type="commit" data-container="body" data-placement="top" data-html="true" title="bigfile/zodb: Format #1 which is optimized for small changes" class="gfm gfm-commit has-tooltip">13c0c17c</a> (bigfile/zodb: Format #1 which is optimized for small changes)
used BTree to organize ZBlk1 block's chunks and for loadblkdata() added
"TODO we are missing to free internal BTree structures on data load".
<a href="https://lab.nexedi.com/nexedi/wendelin.core/issues/3" data-original="https://lab.nexedi.com/nexedi/wendelin.core/issues/3" data-link="false" data-link-reference="true" data-project="21" data-issue="60" data-reference-type="issue" data-container="body" data-placement="top" data-html="true" title="NEO / w.c test -> RAM leak" class="gfm gfm-issue has-tooltip">nexedi/wendelin.core#3</a> besides other
things showed that even when we deactivate ZData objects, we are still
keeping them as ghosts occupying memory and the same for IOBucket
objects.
This all happens because there is no proper way to deactivate whole
btree - including internal buckets objects. And since internal buckets
are not deactivated, they stay in picklecache and thus hold a reference
to ZData objects and ZData objects in turn, even if explicitly
deactivated, stay in memory.
We can fix this all via implementing whole-btree deactivation procedure.
To do so we need to iterate over all btree buckets recursively, but
unfortunately there is no BTree API to access/iterate btree's buckets.
We can however still get reference to first top-level buckets via
gc.get_referents(btree) and then scan buckets further without hacks.
gc.get_referents(btree) is a hack, but
- it works in O(1) (we only get pointers from btree, not scanning all
gcable objects and deducing them)
- it works reliable if we filter out non-interesting objects.
So in the end it works.
Before the patch loading more and more ZBlk1 data with objgraph
instrumentation was showing itself like
# Nobj δ
wendelin.bigfile.file_zodb.ZData 7168 +512
BTrees.IOBTree.IOBucket 238 +17
BTrees.IOBTree.IOBTree 14 +1
and after this patch we now have
BTrees.IOBTree.IOBTree 14 +1
we cannot remove that "IOBTree + 1", since ZBlk1 is holding direct
reference on it (via .chunktab) and we have to keep ZBlk1 live with
._v_zfile and ._v_zblk set for invalidation to work. "+1 IOBtree" is
however small - 144 bytes per 2M (= 0.006%) so we can neglect that the
same way we neglect keeping ZBlk1 staying live for each block.https://lab.nexedi.com/nexedi/wendelin.core/-/commit/f7803634112d9c63c603c02f1f1a711fef9e4f3dwendelin.core v0.72016-07-14T20:33:27+03:00Kirill Smelkovkirr@nexedi.comhttps://lab.nexedi.com/nexedi/wendelin.core/-/commit/d9d6409f3071fea8e9479a60e43669a2c9219c8cbigfile/virtmem: usleep() needs unistd.h2016-07-14T20:32:34+03:00Kirill Smelkovkirr@nexedi.com
The following started to appear after recent gcc upgrade on my host:
bigfile/virtmem.c: In function `vma_on_pagefault':
bigfile/virtmem.c:696:9: warning: implicit declaration of function `usleep' [-Wimplicit-function-declaration]
usleep(10000); // XXX with 1000 uslepp still busywaitshttps://lab.nexedi.com/nexedi/wendelin.core/-/commit/8f624957feba1907b446081913e8bf583968a737setup: Propagate only setuptools, not whole sys.path2016-07-14T20:32:33+03:00Kirill Smelkovkirr@nexedi.com
This updates and fixes <a href="/kirr/wendelin.core/-/commit/487e522615cc20a1ae0d861522509c5b6d760a89" data-original="487e5226" data-link="false" data-link-reference="false" data-project="20" data-commit="487e522615cc20a1ae0d861522509c5b6d760a89" data-reference-type="commit" data-container="body" data-placement="top" data-html="true" title="setup: specify setuptools location explicitly when calling make." class="gfm gfm-commit has-tooltip">487e5226</a> (setup: specify setuptools location
explicitly when calling make.) to use <a href="/kazuhiko" data-user="5" data-reference-type="user" data-container="body" data-placement="top" data-html="true" class="gfm gfm-project_member" title="Kazuhiko Shiozaki">@kazuhiko</a> original idea to
propagate only setuptools location. The reason is - when propagating
whole sys.path things break under tox tests:
---- 8< ----
========================================================================== test session starts ===========================================================================
platform linux2 -- Python 2.7.12, pytest-2.9.2, py-1.4.31, pluggy-0.3.1
rootdir: /home/kirr/src/wendelin/release/wendelin.core, inifile:
collected 33 items
bigarray/tests/test_arrayzodb.py .......
bigarray/tests/test_basic.py ........
bigfile/tests/test_basic.py ....
bigfile/tests/test_filefile.py .
bigfile/tests/test_filezodb.py ........
bigfile/tests/test_thread.py ....
lib/tests/test_calc.py .
======================================================================= 33 passed in 14.14 seconds =======================================================================
x86_64-linux-gnu-gcc -pthread -g -Wall -D_GNU_SOURCE -std=gnu99 -fplan9-extensions -Wno-declaration-after-statement -Wno-error=declaration-after-statement -Iinclude -I3rdparty/ccan -I3rdparty/include bigfile/tests/tfault.c lib/bug.c lib/utils.c 3rdparty/ccan/ccan/tap/tap.c -o bigfile/tests/tfault.t
t/tfault-run bigfile/tests/tfault.t faultr on_pagefault
ok 1 - !pagefault_init()
Fatal Python error: Py_Initialize: Unable to get the locale encoding
File ".../wendelin.core/.tox/py27-ZODB3-zblk0-fs-numpy110/lib/python2.7/encodings/__init__.py", line 123
raise CodecRegistryError,\
^
SyntaxError: invalid syntax
Current thread 0x00007f9b80024780 (most recent call first):
t/tfault-run: line 28: 21521 Аварийный останов (core dumped) gdb -q -batch $tfault core > core.info
E: can't gdb(core)
Makefile:189: ошибка выполнения рецепта для цели «faultr.tfault»
make: *** [faultr.tfault] Ошибка 1
rm bigfile/tests/test_virtmem.t bigfile/tests/test_ram.t bigfile/tests/tfault.t bigfile/tests/test_pagemap.t
error: Failed to execute `make test`
ERROR: InvocationError: '.../wendelin.core/.tox/py27-ZODB3-zblk0-fs-numpy110/bin/python setup.py test'
________________________________________________________________________________ summary _________________________________________________________________________________
ERROR: py27-ZODB3-zblk0-fs-numpy110: commands failed
---- 8< ----
What happens here is:
- gdb is used in automated tests
- gdb is linked with libpython3.5
- tox is currently running tests with python27
- setup.py sets PYTHONPATH to whole path from python27
- gdb, upon starting, initializes python runtime, which tries to load
py27 modules under py35 -> oops.
So propagating only setuptools location practically solves the issue for
now, but still there is potential risk that in future, there will be
other modules put in the same location as setuptools (location is parent
dir of a module/package) which python tries to load on startup and which
might be incompatible between 2 & 3.
Thus not setting PYTHONPATH at all - e.g. creating environments
virtualenv way - would be better, but buildout fundamentally works the
other way. We can not also use -c 'buildout sys.path hack' in $PYTHON
itself, as $PYTHON is used in general way inside Makefile.
So let the hack with setuptools location in PYTHONPATH stay there until
it practically works.https://lab.nexedi.com/nexedi/wendelin.core/-/commit/487e522615cc20a1ae0d861522509c5b6d760a89setup: specify setuptools location explicitly when calling make.2016-07-14T17:48:47+03:00Kazuhikokazuhiko@fdiary.net
If wendelin.core is built under buildout and setuptools exists only in
buildout environment, 'python setup.py' called inside make will fail
without this change.
Building 'wendelin.core'
Running easy_install:
"/path/to/python2.7" "-c" "import sys; sys.path[0:0] = ['/path/to/setuptools-19.6.2-py2.7.egg']; from setuptools.command.easy_install import main; main()"...
path_list=['/path/to/setuptools-19.6.2-py2.7.egg']
...
<<< setup.py: os.system('make %s PYTHON="%s"' % (target, sys.executable))
...
make[1]: Leaving directory '/tmp/xxx/wendelin.core-0.6/3rdparty/ccan'
/path/to/python2.7 setup.py ll_build_ext --inplace
Traceback (most recent call last):
File "setup.py", line 18, in <module>
from setuptools import setup, Extension, Command, find_packages
ImportError: No module named setuptools
Makefile:40: recipe for target 'bigfile/_bigfile.so' failed
make: *** [bigfile/_bigfile.so] Error 1
error: Setup script exited with error: Failed to execute `make all`
[ <a href="/kirr" data-user="14" data-reference-type="user" data-container="body" data-placement="top" data-html="true" class="gfm gfm-project_member" title="Kirill Smelkov">@kirr</a>: as a solution we are propagating whole python path via make.
This should cover both setuptools case, and any other future potential
"preloaded-by-buildout" egg. ]
/reviewed-on <a href="https://lab.nexedi.com/nexedi/wendelin.core/merge_requests/1" data-original="https://lab.nexedi.com/nexedi/wendelin.core/merge_requests/1" data-link="false" data-link-reference="true" data-project="21" data-merge-request="575" data-project-path="nexedi/wendelin.core" data-iid="1" data-mr-title="setup: specify setuptools location explicitly when calling make." data-reference-type="merge_request" data-container="body" data-placement="top" data-html="true" title="" class="gfm gfm-merge_request">!1</a>https://lab.nexedi.com/nexedi/wendelin.core/-/commit/e6beab19d2bdc4b040d3a02c1e57ee1aefc505c6Fix build for Python 3.52016-07-06T11:43:43+03:00Kirill Smelkovkirr@nexedi.com
<a href="/kazuhiko" data-user="5" data-reference-type="user" data-container="body" data-placement="top" data-html="true" class="gfm gfm-project_member" title="Kazuhiko Shiozaki">@kazuhiko</a> reports that wendelin.core build is currently broken on Python 3.5.
Indeed it was:
In file included from bigfile/_bigfile.c:37:0:
./include/wendelin/compat_py2.h: In function ‘_PyThreadState_UncheckedGetx’:
./include/wendelin/compat_py2.h:66:28: warning: implicit declaration of function ‘_Py_atomic_load_relaxed’ [-Wimplicit-function-declaration]
return (PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current);
^
./include/wendelin/compat_py2.h:66:53: error: ‘_PyThreadState_Current’ undeclared (first use in this function)
return (PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current);
^
./include/wendelin/compat_py2.h:66:53: note: each undeclared identifier is reported only once for each function it appears in
./include/wendelin/compat_py2.h:67:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
The story here is that in 3.5 they decided to remove direct access to
_PyThreadState_Current and atomic implementations - because that might
semantically conflict with other headers implementing atomics - and
provide only access by function.
Starting from Python 3.5.2rc1 the function to get current thread state
without asserting it is !NULL - _PyThreadState_UncheckedGet() - was added:
<a href="https://github.com/python/cpython/commit/df858591" rel="nofollow noreferrer noopener" target="_blank">https://github.com/python/cpython/commit/df858591</a>
so for those python versions we can directly use it.
After the fix wendelin.core tox tests pass under all python2.7, python3.4 and python3.5.
More context here:
<a href="https://bugs.python.org/issue26154" rel="nofollow noreferrer noopener" target="_blank">https://bugs.python.org/issue26154</a>
<a href="https://bugs.python.org/issue25150" rel="nofollow noreferrer noopener" target="_blank">https://bugs.python.org/issue25150</a>
Fixes: <a href="https://lab.nexedi.com/nexedi/wendelin.core/issues/1" data-original="https://lab.nexedi.com/nexedi/wendelin.core/issues/1" data-link="false" data-link-reference="true" data-project="21" data-issue="53" data-reference-type="issue" data-container="body" data-placement="top" data-html="true" title="wendline.core cannot be build on Python 3.5.1" class="gfm gfm-issue has-tooltip">#1</a>https://lab.nexedi.com/nexedi/wendelin.core/-/commit/20115391981846e562b6999e3f4c610c974fad53bigfile/virtmem: Move _PyThreadState_Current_GET to compat_py2.h2016-07-01T14:28:29+03:00Kirill Smelkovkirr@nexedi.com
_PyThreadState_Current_GET() is a function to get current python thread
state without asserting it is !NULL. It was added as part of <a href="/nexedi/wendelin.core/-/commit/d53271b9230a925ac3d76725968cebbd3b02840e" data-original="d53271b9" data-link="false" data-link-reference="false" data-project="21" data-commit="d53271b9230a925ac3d76725968cebbd3b02840e" data-reference-type="commit" data-container="body" data-placement="top" data-html="true" title="bigfile/virtmem: Big Virtmem lock" class="gfm gfm-commit has-tooltip">d53271b9</a>
(bigfile/virtmem: Big Virtmem lock)
We are going to adapt it to Python 3.5 (see next patch), so before doing
so move it to our compatibility place.
In the new place the name is _PyThreadState_UncheckedGet -- like such
function is named in Python 3.5 (again, see next patch).
Updates: <a href="https://lab.nexedi.com/nexedi/wendelin.core/issues/1" data-original="https://lab.nexedi.com/nexedi/wendelin.core/issues/1" data-link="false" data-link-reference="true" data-project="21" data-issue="53" data-reference-type="issue" data-container="body" data-placement="top" data-html="true" title="wendline.core cannot be build on Python 3.5.1" class="gfm gfm-issue has-tooltip">#1</a>https://lab.nexedi.com/nexedi/wendelin.core/-/commit/66379fe86344688a2eaea84423b6dfa6be336627tox: Limit ZODB4 to be <5.02016-07-01T14:18:13+03:00Kirill Smelkovkirr@nexedi.com
Now that ZODB 5.0 eggs are starting to appear (see e.g. [1] for context)
let's limit ZODB4 test setup to actually install ZODB4, not 5.
[1] <a href="https://groups.google.com/forum/#!topic/zodb/P05S0pyUbAM" rel="nofollow noreferrer noopener" target="_blank">https://groups.google.com/forum/#!topic/zodb/P05S0pyUbAM</a>https://lab.nexedi.com/nexedi/wendelin.core/-/commit/a47d1fbb94e7aecdaa59c41714aafa32f1c76293readme: Merge in wiki content2016-06-27T16:00:56+03:00Kirill Smelkovkirr@nexedi.com
Upon <a href="/jp" data-user="2" data-reference-type="user" data-container="body" data-placement="top" data-html="true" class="gfm gfm-project_member" title="Jean-Paul Smets">@jp</a> request.https://lab.nexedi.com/nexedi/wendelin.core/-/commit/c687102cc6a76aa044e77295f8d306bc360b6299readme: Add link to wiki2016-06-27T14:19:30+03:00Kirill Smelkovkirr@nexedi.com
The link is absolute URL, since the readme can be shown in a lot of
places (on lab.nexedi.com, on pypi, on github, etc...)
We might also change the link to demo_zbigarray.py to be absolute URL
because of pypi case in the future.https://lab.nexedi.com/nexedi/wendelin.core/-/commit/ee9bcd00f56f048b8e60117b9cb65495bc397836bigfile/pagemap: Fix non-leaf page iteration2016-06-24T17:43:26+03:00Kirill Smelkovkirr@nexedi.com
Since the beginning of pagemap (<a href="/nexedi/wendelin.core/-/commit/45af76e6bc622952b4987cff4f63bc32559ec6bd" data-original="45af76e6" data-link="false" data-link-reference="false" data-project="21" data-commit="45af76e6bc622952b4987cff4f63bc32559ec6bd" data-reference-type="commit" data-container="body" data-placement="top" data-html="true" title="bigfile/pagemap: specialized {} uint64 -> void * mapping" class="gfm gfm-commit has-tooltip">45af76e6</a> "bigfile/pagemap: specialized
{} uint64 -> void * mapping") we had a bug sitting in
__pagemap_for_each_leaftab() (non-leaf iterating logic behind
pagemap_for_each):
After entry to stack-down was found, we did not updated tailv[l]
accordingly. Thus if there are non-adjacent entries an entry could be
e.g. emitted many times:
l 3 __down 0x7f79da1ee000
tailv[4]: 0x7f79da1ee000
-> tailv[4] 0x7f79da1ee000 __down 0x7f79da1ed000
l 4 __down 0x7f79da1ed000
tailv[5]: 0x7f79da1ed000
h 5 l 5 leaftab: 0x7f79da1ed000 <--
lvl 5 idx 169 page 0x55aa
ok 9 - pagemap_for_each(0) == 21930
l 5 __down (nil)
tailv[4]: 0x7f79da1ee008
-> tailv[4] 0x7f79da1ee008 __down 0x7f79da1ed000
l 4 __down 0x7f79da1ed000
tailv[5]: 0x7f79da1ed000
h 5 l 5 leaftab: 0x7f79da1ed000 <--
lvl 5 idx 169 page 0x55aa
not ok 10 - pagemap_for_each(1) == 140724106500272
And many-time-emitted entries are not only incorrect, but can also lead
to not-handled segmentation faults in e.g. fileh_close():
<a href="https://lab.nexedi.com/nexedi/wendelin.core/blob/v0.6-1-gb0b2c52/bigfile/virtmem.c#L179">https://lab.nexedi.com/nexedi/wendelin.core/blob/v0.6-1-gb0b2c52/bigfile/virtmem.c#L179</a>
/* drop all pages (dirty or not) associated with this fileh */
pagemap_for_each(page, &fileh->pagemap) {
/* it's an error to close fileh to mapping of which an access is
* currently being done in another thread */
BUG_ON(page->state == PAGE_LOADING);
page_drop_memory(page);
list_del(&page->lru); <-- HERE
bzero(page, sizeof(*page)); /* just in case */
free(page);
}
( because after first bzero of a page, the page is all 0 bytes including
page->lru{.next,.prev} so on the second time when the same page is
emitted by pagemap_for_each, list_del(&page->lru) will try to set
page->lru.next = ... which will segfault. )
So fix it by properly updating tailv[l] while we scan/iterate current level.
NOTE
This applies only to non-leaf pagemap levels, as leaf level is scanned
with separate loop in pagemap_for_each. That's why we probably did not
noticed this earlier - up until now our usual workloads was to change
data in adjacent batches and that means adjacent pages.
Though today <a href="/Tyagov" data-user="15" data-reference-type="user" data-container="body" data-placement="top" data-html="true" class="gfm gfm-project_member" title="Ivan Tyagov">@Tyagov</a> was playing with wendelin.core in some other way and
it uncovered the bug.https://lab.nexedi.com/nexedi/wendelin.core/-/commit/b0b2c52e9acd8332050b50ac2891a59a066db9c0readme: Fix relative URL to demo_zbigarray.py2016-06-13T18:37:27+03:00Kirill Smelkovkirr@nexedi.com
In the time when README.rst was initially introduced (<a href="/nexedi/wendelin.core/-/commit/58279ac777e1d8160ac969012ae53ee3b4cb65ef" data-original="58279ac7" data-link="false" data-link-reference="false" data-project="21" data-commit="58279ac777e1d8160ac969012ae53ee3b4cb65ef" data-reference-type="commit" data-container="body" data-placement="top" data-html="true" title="readme: Initial draft" class="gfm gfm-commit has-tooltip">58279ac7</a> "readme:
Initial draft") GitLab was not handling relative links well and it was
necessary to construct them properly by hand.
Nowdays GitLab automatically adds namespace and project and blob/ref/
prefix to relative URL link, so there is no need to specify them
manually.
Actually specifying the prefix manually makes URL invalid, as it becomes
something like
<a href="https://lab.nexedi.com/nexedi/wendelin.core/blob/master/wendelin.core/blob/master/demo/demo_zbigarray.py">https://lab.nexedi.com/nexedi/wendelin.core/blob/master/wendelin.core/blob/master/demo/demo_zbigarray.py</a>
Fix it.https://lab.nexedi.com/nexedi/wendelin.core/-/commit/7464644e0e35c4ecd670d111e97c5c675005a747wendelin.core v0.62016-06-13T14:24:28+03:00Kirill Smelkovkirr@nexedi.comhttps://lab.nexedi.com/nexedi/wendelin.core/-/commit/1b4ca907df61b4db6f7d63fd6dbe441868e77418changelog: Rename to .rst2016-06-13T14:24:02+03:00Kirill Smelkovkirr@nexedi.com
This continues <a href="/jwolf083/wendelin.core/-/commit/c7750965abcd94f06f7556e629627cb0fcc6f196" data-original="c7750965" data-link="false" data-link-reference="false" data-project="1140" data-commit="c7750965abcd94f06f7556e629627cb0fcc6f196" data-reference-type="commit" data-container="body" data-placement="top" data-html="true" title="changelog: Convert it to pretty rst" class="gfm gfm-commit has-tooltip">c7750965</a> (changelog: Convert it to pretty rst) - without
.rst extension gitlab shows this file as plain text.https://lab.nexedi.com/nexedi/wendelin.core/-/commit/c25921e2530ae9fda44627c739a6baa4d14b2350tox: Bump NEO to explicit >= 1.6.22016-06-13T14:21:58+03:00Kirill Smelkovkirr@nexedi.com
>= 1.6 was already using latest in 1.6 series, but >= 1.6.2 is more explicit.
Also: in 1.6.2 NEO switched from MySQL-python to mysqlclient:
<a href="https://lab.nexedi.com/nexedi/neoppod/commit/5f0c93f5" data-original="https://lab.nexedi.com/nexedi/neoppod/commit/5f0c93f5" data-link="false" data-link-reference="true" data-project="72" data-commit="5f0c93f54c336527b971036e4a775626cc7a0e44" data-reference-type="commit" data-container="body" data-placement="top" data-html="true" title="storage: switch to a maintained fork of MySQL-python" class="gfm gfm-commit has-tooltip">nexedi/neoppod@5f0c93f5</a>
so we switch it too.https://lab.nexedi.com/nexedi/wendelin.core/-/commit/79aab289a1252c5b5d00401aa95e99eb3f7f6ba9tox: Bump NumPy to two latest release series2016-06-13T13:02:59+03:00Kirill Smelkovkirr@nexedi.com
Namely
1.8.x, 1.9.x -> 1.10.x -> 1.11.xhttps://lab.nexedi.com/nexedi/wendelin.core/-/commit/89d099afdca90e65f1d6f4145b8aecbdf761c6693rdparty/ccan: Update2016-06-12T22:52:28+03:00Kirill Smelkovkirr@nexedi.com
Just update to latest CCAN for it to be a fresh one.
Throught the modules we use there are no real updates, just a fix for
one warning in array_size.https://lab.nexedi.com/nexedi/wendelin.core/-/commit/6773fda0e7aee831b435748968b55a341fd284e9bigfile/zodb: Don't write ZBlk to DB if it was not changed2016-04-20T19:57:07+03:00Kirill Smelkovkirr@nexedi.com
For ZBlk1 we already compare ZData content about whether it was changed
compared to data already stored to DB, and do not store it twice if data
is the same.
However ZBlk itself is always marked as changed, if corresponding memory
page was dirtied. This results in transactions like
Trans #33915309 tid=03b6944919befeee time=2016-04-17 22:01:06.034237 offset=140320105842
status=' ' user='...' description='...'
# ... other parts, but no ZData here
data #00002 oid=000000000026fc4c size=79 class=wendelin.bigfile.file_zodb.ZBlk1
where ZBlk1 is committed the same without necessity.
NOTE we cannot avoid committing ZBlk in all cases, because it is used to signal
other DB clients that a ZBlk needs to be invalidated and this way associated
fileh pages are invalidated too.
This cannot work via ZData, because ZData don't have back-pointer to
ZBlk1 or to corresponding zfile.https://lab.nexedi.com/nexedi/wendelin.core/-/commit/2ce96a76421f942e8416ceeebf5088352b5fa1c7Fix develop install for setuptools >= 19.42016-04-05T14:05:00+02:00Kirill Smelkovkirr@nexedi.com
Starting from setuptools 19.4, more concrete from the following commit:
<a href="https://github.com/pypa/setuptools/commit/ebc54982" rel="nofollow noreferrer noopener" target="_blank">https://github.com/pypa/setuptools/commit/ebc54982</a>
setuptools sorts namespaced packages .__path__ to be in sync with sys.path .
That however breaks for wendelin.core used from in-tree or installed in
development mode, because we are doing tricks in top-level import redirector
(see <a href="/kirr/wendelin.core/-/commit/e870781d4c030e2eb7022ee72d57985697d34fb4" data-original="e870781d" data-link="false" data-link-reference="false" data-project="20" data-commit="e870781d4c030e2eb7022ee72d57985697d34fb4" data-reference-type="commit" data-container="body" data-placement="top" data-html="true" title="Top-level in-tree import redirector" class="gfm gfm-commit has-tooltip">e870781d</a> "Top-level in-tree import redirector"):
(z+numpy.v2)kirr@teco:~/tmp/trashme/wendelin.core$ python -c 'import wendelin'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "wendelin.py", line 39, in <module>
__import__('pkg_resources').declare_namespace(__name__)
File "/home/kirr/src/wendelin/venv/z+numpy.v2/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2081, in declare_namespace
_handle_ns(packageName, path_item)
File "/home/kirr/src/wendelin/venv/z+numpy.v2/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2026, in _handle_ns
_rebuild_mod_path(path, packageName, module)
File "/home/kirr/src/wendelin/venv/z+numpy.v2/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2050, in _rebuild_mod_path
orig_path.sort(key=position_in_sys_path)
File "/home/kirr/src/wendelin/venv/z+numpy.v2/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2045, in position_in_sys_path
return sys_path.index(_normalize_cached(os.sep.join(parts)))
ValueError: '/home/kirr/tmp/trashme' is not in list
Here wendelin.py added /home/kirr/tmp/trashme/wendelin.core to .__path__ and
setuptools' _handle_ns() wants to order that dir's parent in correspondence
with sys.path, but parent path is not there - oops.
We can workaround the problem, by first not initializing .__path__ and letting
__import__('pkg_resources').declare_namespace(__name__)
fully handle and initialize it, and only after it is done we make the
correction for wendelin modules located not under .../wendelin.core/wendelin/
but under .../wendelin.core/ .
Importing was tested to work with the fix with both setuptools 20.6.7 and older
setuptools 17.1.1, i.e. here we should not be breaking backward compatibility.
/reported-by <a href="/tatuya" data-user="22" data-reference-type="user" data-container="body" data-placement="top" data-html="true" class="gfm gfm-project_member" title="Tatuya Kamada">@tatuya</a>, <a href="/Camata" data-user="35" data-reference-type="user" data-container="body" data-placement="top" data-html="true" class="gfm gfm-project_member" title="Douglas">@Camata</a>, <a href="/Tyagov" data-user="15" data-reference-type="user" data-container="body" data-placement="top" data-html="true" class="gfm gfm-project_member" title="Ivan Tyagov">@Tyagov</a>
/reviewed-on <a href="https://lab.nexedi.com/kirr/wendelin.core/merge_requests/1" data-original="https://lab.nexedi.com/kirr/wendelin.core/merge_requests/1" data-link="false" data-link-reference="true" data-project="20" data-merge-request="422" data-project-path="kirr/wendelin.core" data-iid="1" data-mr-title="Fix develop install for setuptools >= 19.4" data-reference-type="merge_request" data-container="body" data-placement="top" data-html="true" title="" class="gfm gfm-merge_request">!1</a>https://lab.nexedi.com/nexedi/wendelin.core/-/commit/2ca0f076567c0d9206f21897acd309194153d19fZBigArray: Compatibility fix to read arrays from DB that were previously save...2015-12-18T15:36:14+03:00Kirill Smelkovkirr@nexedi.com
Commit <a href="/tatuya/wendelin.core/-/commit/ab9ca2df5d55cbd5b73dd8281d54cae516b2d0ff" data-original="ab9ca2df" data-link="false" data-link-reference="false" data-project="310" data-commit="ab9ca2df5d55cbd5b73dd8281d54cae516b2d0ff" data-reference-type="commit" data-container="body" data-placement="top" data-html="true" title="bigarray: Add support for FORTRAN ordering" class="gfm gfm-commit has-tooltip">ab9ca2df</a> (bigarray: Add support for FORTRAN ordering) added
ability to define array order, but there I made a mistake of not caring
about how previously-saved to DB arrays would be read back.
The thing is BigArray gained new data member ._order which is
automatically saved to DB thanks to ZBigArray inheriting from
Persistent; on load-from-db path we just read object state from DB,
which for ZBigArray is dict, and restore object attributes from it.
But for previously-saved data, obviously, there is no 'order' entry and thus
this way restored objects are restored not in full to current code expectations
and it can boom e.g. this way:
zarray.resize((new_one,old_shape[1]))
Module wendelin.bigarray, line 190, in resize
self._init0(new_shape, self.dtype, order=self._order)
AttributeError: 'ZBigArray' object has no attribute '_order'
Solution to fix is: on restore-from-DB path, see if a data member is not
present on restored object, and if it has default value in BigArray set it to
that.
( code to get function defaults is from
<a href="http://stackoverflow.com/questions/12627118/get-a-function-arguments-default-value" rel="nofollow noreferrer noopener" target="_blank">http://stackoverflow.com/questions/12627118/get-a-function-arguments-default-value</a> )
/cc <a href="/Tyagov" data-user="15" data-reference-type="user" data-container="body" data-placement="top" data-html="true" class="gfm gfm-project_member" title="Ivan Tyagov">@Tyagov</a>, <a href="/klaus" data-user="7" data-reference-type="user" data-container="body" data-placement="top" data-html="true" class="gfm gfm-project_member" title="Klaus Wölfel">@klaus</a>https://lab.nexedi.com/nexedi/wendelin.core/-/commit/18b40b188eaa3405810b97bd91265f63b5d31734tox: Bump NEO to 1.62015-12-15T18:50:47+03:00Kirill Smelkovkirr@nexedi.comhttps://lab.nexedi.com/nexedi/wendelin.core/-/commit/f49c11a3ab57ec8eed0e4cf0a4b92615051b8762bigfile/virtmem: Do loadblk() with virtmem lock released2015-12-15T18:50:40+03:00Kirill Smelkovkirr@nexedi.com
loadblk() calls are potentially slow and external code that serve the cal can
take other locks in addition to virtmem lock taken by virtmem subsystem. If
that "other locks" are also taken before external code calls e.g.
fileh_invalidate_page() in different codepath a deadlock can happen, e.g.
T1 T2
page-access invalidation-from-server received
V -> loadblk
Z <- ClientStorage.invalidateTransaction()
Z -> zeo.load
V <- fileh_invalidate_page
The solution to avoid deadlock is to call loadblk() with virtmem lock released
and upon loadblk() completion recheck virtmem data structures carefully.
To make that happen:
- new page state is introduces:
PAGE_LOADING (file content loading is in progress)
- virtmem releases virt_lock before calling loadblk() when serving pagefault
- because loading is now done with virtmem lock released, now:
1. After loading completes we need to recheck fileh/vma data structures
The recheck is done in full - vma_on_pagefault() just asks its driver (see
VM_RETRY and VM_HANDLED codes) to retry handling the fault completely. This
should work as the freshly loaded page was just inserted into fileh->pagemap
and should be found there in the cache on next lookup.
On the other hand this also works correctly, if there was concurrent change
- e.g. vma was unmapped while we were loading the data - in that case the
fault will be also processed correctly - but loaded data will stay in
fileh->pagemap (and if not used will be evicted as not-needed
eventually by RAM reclaim).
2. Similar to retrying mechanism is used for cases when two threads
concurrently access the same page and would both try to load corresponding
block - only one thread issues the actual loadblk() and another waits for load
to complete with polling and VM_RETRY.
3. To correctly invalidate loading-in-progress pages another new page state
is introduced:
PAGE_LOADING_INVALIDATED (file content loading was in progress
while request to invalidate the page came in)
which fileh_invalidate_page() uses to propagate invalidation message to
loadblk() caller.
4. Blocks loading can now happen in parallel with other block loading and
other virtmem operations - e.g. invalidation. For such cases tests are added
to test_thread.py
5. virtmem lock now becomes just regular lock, instead of being previously
recursive.
For virtmem lock to be recursive was needed for cases, when code under
loadblk() could trigger other virtmem calls, e.g. due to GC and calling
another VMA dtor that would want to lock virtmem, but virtmem lock was
already held.
This is no longer needed.
6. To catch double faults we now cannot use just on static variable
in_on_pagefault. That variable thus becomes thread-local.
7. Old test in test_thread to "test that access vs access don't overlap" no
longer holds true - and is thus removed.
/cc <a href="/Tyagov" data-user="15" data-reference-type="user" data-container="body" data-placement="top" data-html="true" class="gfm gfm-project_member" title="Ivan Tyagov">@Tyagov</a>, <a href="/klaus" data-user="7" data-reference-type="user" data-container="body" data-placement="top" data-html="true" class="gfm gfm-project_member" title="Klaus Wölfel">@klaus</a>https://lab.nexedi.com/nexedi/wendelin.core/-/commit/0231a65d408cc688e4b785311a441634436ce230bigfile/virtmem: Factor functionality to unlock/retake GIL into own functions2015-12-15T17:49:12+03:00Kirill Smelkovkirr@nexedi.com
Previously we were doing virt_lock() / virt_unlock() which automatically
were making sure to unlock GIL before locking virtmem, and to restore
GIL state to previous after virtmem lock happened. virt_unlock() was
unlocking just the virtmem lock without touching GIL at all - that works
because the running code would eventually release GIL as python
regularly does so to allowing multiple threads to run.
In the next patch however, we'll need to wait for in-progress-loading
page to complete, and that wait has to be done with GIL released (so
other python threads could run), and for doing so we'll need
functionality to make sure GIL is unlocked and retake it back, not tied
to virt_lock().
So factor it out.https://lab.nexedi.com/nexedi/wendelin.core/-/commit/99cd1f03cbc6f91dfa4a0b159a7159d1f5fa6938bigfile/tests: move NotifyChannel to test_thread.py2015-12-15T17:48:12+03:00Kirill Smelkovkirr@nexedi.com
NotifyChannel was introduced in <a href="/kirr/wendelin.core/-/commit/c7c01ce4771b2915a08c6b38068365053e620d70" data-original="c7c01ce4" data-link="false" data-link-reference="false" data-project="20" data-commit="c7c01ce4771b2915a08c6b38068365053e620d70" data-reference-type="commit" data-container="body" data-placement="top" data-html="true" title="bigfile/zodb: ZODB.Connection can migrate between threads on close/open and we have to care" class="gfm gfm-commit has-tooltip">c7c01ce4</a> (bigfile/zodb: ZODB.Connection
can migrate between threads on close/open and we have to care) to test
thread interaction specific to ZODB.
We'll however need NotifyChannel to do more threading test of virtmem
core, and this way the proper place for NotifyChannel is test_thread.py
itself.
Move it.https://lab.nexedi.com/nexedi/wendelin.core/-/commit/81bf620c2aa4e7aafb052d6616c3ca7b991a63f9bigfile/virtmem: Remove obsolete XXX about locking2015-12-15T16:10:18+03:00Kirill Smelkovkirr@nexedi.com
Both comments are from the beginning - from <a href="/jwolf083/wendelin.core/-/commit/9a293c2d0e87d35bcd826828720ac7c8ccb83a22" data-original="9a293c2d" data-link="false" data-link-reference="false" data-project="1140" data-commit="9a293c2d0e87d35bcd826828720ac7c8ccb83a22" data-reference-type="commit" data-container="body" data-placement="top" data-html="true" title="bigfile/virtmem: Userspace Virtual Memory Manager" class="gfm gfm-commit has-tooltip">9a293c2d</a> (bigfile/virtmem:
Userspace Virtual Memory Manager) - but <a href="/jwolf083/wendelin.core/-/commit/d53271b9230a925ac3d76725968cebbd3b02840e" data-original="d53271b9" data-link="false" data-link-reference="false" data-project="1140" data-commit="d53271b9230a925ac3d76725968cebbd3b02840e" data-reference-type="commit" data-container="body" data-placement="top" data-html="true" title="bigfile/virtmem: Big Virtmem lock" class="gfm gfm-commit has-tooltip">d53271b9</a> patch (bigfile/virtmem:
Big Virtmem lock) missed to update them.https://lab.nexedi.com/nexedi/wendelin.core/-/commit/997ebacd2e9be05aa9a7722c9a764a7c869dde4abigfile: Plug memory leak in ramh_close()2015-12-15T16:05:22+03:00Kirill Smelkovkirr@nexedi.com
No one was freeing RAMH structure itself, and thus ASAN reports e.g.:
==15935==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 32 byte(s) in 1 object(s) allocated from:
#0 0x7f29c89f1001 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x94001)
#1 0x401da1 in zalloc include/wendelin/utils.h:65
#2 0x408128 in shmfs_ramh_open bigfile/tests/../ram_shmfs.c:202
#3 0x407611 in ramh_open bigfile/tests/../ram.c:81
#4 0x402560 in fileh_open bigfile/tests/../virtmem.c:131
#5 0x427ca1 in test_pagefault_savestate bigfile/tests/test_virtmem.c:1022
#6 0x4281ba in main bigfile/tests/test_virtmem.c:1061
#7 0x7f29c83b8b44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b44)
NOTE similar leak remains open in ram_close(), but it is a bit involved
to fix and the effort will be removed anyway after we switch to kernel
virtual memory manager. Besides ramh are opened and closed all the time
and ram only once.https://lab.nexedi.com/nexedi/wendelin.core/-/commit/e8c05a2265b30b269557e243c4de93ac456d4382bigfile/ram_shmfs: Warn users explicitly if fallocate() is not supported2015-11-05T12:54:32+03:00Kirill Smelkovkirr@nexedi.com
Currently wendelin.core does not work on e.g. Debian 7, because that
distro has too old kernel without support for fallocate on tmpfs.
But the diagnostics of failure is not clear and looks like just being
out of memory:
bigfile/tests/../virtmem.c:845 OOM BUG!
what happens in fact is that
- virtmem tries to allocate a page -> calls shmfs_alloc_page(),
- fallocate() fails with "operation not supported" error code
- virtmem sees this as page allocation failure,
- tries to reclaim pages,
- but there are no allocated pages at all -> OOM
Detect whether fallocate() error is operational error, or simply
"fallocate not supported" and if latter, report to user. Now it looks
like:
bigfile/tests/../ram_shmfs.c:129 shmfs_alloc_page WARN: fallocate() not supported
bigfile/tests/../virtmem.c:845 OOM BUG!
/cc <a href="/Tyagov" data-user="15" data-reference-type="user" data-container="body" data-placement="top" data-html="true" class="gfm gfm-project_member" title="Ivan Tyagov">@Tyagov</a>https://lab.nexedi.com/nexedi/wendelin.core/-/commit/ab9ca2df5d55cbd5b73dd8281d54cae516b2d0ffbigarray: Add support for FORTRAN ordering2015-11-02T17:41:46+03:00Kirill Smelkovkirr@nexedi.com
Until now BigArrays could use only C-style ordering - where major index
is the first one.
Fortran ordering is the opposite - where major index is the last one -
and is used in Fortran world and sometimes by scientists in other areas.
As people keep on asking for Fortran-ordered BigArrays, let's add
support for it. The essential code change is to change 0'th index to
major index in __getitem__ and rest of the code.
For the reference: ndarray memory layout for different orders is
described here:
<a href="http://docs.scipy.org/doc/numpy/reference/arrays.ndarray.html#internal-memory-layout-of-an-ndarray" rel="nofollow noreferrer noopener" target="_blank">http://docs.scipy.org/doc/numpy/reference/arrays.ndarray.html#internal-memory-layout-of-an-ndarray</a>https://lab.nexedi.com/nexedi/wendelin.core/-/commit/c507d9009f59fec2041bac9c31c5b08a48d3897dwendelin.core v0.52015-10-02T16:02:34+03:00Kirill Smelkovkirr@nexedi.comhttps://lab.nexedi.com/nexedi/wendelin.core/-/commit/1895f0ed17c5ef76671330fdd07d6bec5f881848bigfile/zodb/tests: When testing check whole ZBlk content, not only [0]2015-10-02T15:54:23+03:00Kirill Smelkovkirr@nexedi.com
Since <a href="/tatuya/wendelin.core/-/commit/13c0c17c287dfd0f7f422918f8108ee45c2675ec" data-original="13c0c17c" data-link="false" data-link-reference="false" data-project="310" data-commit="13c0c17c287dfd0f7f422918f8108ee45c2675ec" data-reference-type="commit" data-container="body" data-placement="top" data-html="true" title="bigfile/zodb: Format #1 which is optimized for small changes" class="gfm gfm-commit has-tooltip">13c0c17c</a> (bigfile/zodb: Format #1 which is optimized for small
changes) each ZBlk is split into chunks, and the procedure to load/save
blk data collects/disassembles the chunks.
Previously in bigfile/zodb tests, we were testing by verifying only [0]
element in each block, so this way most code for chunks
collection/disassembling was not tested.
Fix this aspect by making sure whole block content is as would-be
expected in tests.