Commit Graph

2239 Commits (2fdbd0cfcd5357af0745aae8459d0c05f78a6ae4)
 

Author SHA1 Message Date
David Wilson 484d4fdb74 core: fix Latch socket sharing race.
If thread A is about to wake as thread B is about to sleep, and A loses
the GIL at an inopportune moment, it was possible for two latches to
share the same socketpair, causing wakeups routed to the wrong latch.

The pair was returned to the 'idle sockets' list before .recv() had been
called. This manifested as TimeoutError() thrown rarely with many active
threads and the host is heavily loaded (such as Travis CI).

Add more documentation and stop writing single wake bytes. Instead the
recipient's identity is written instead, making it simpler to detect
future bugs.
6 years ago
David Wilson a53f2e7137 Update trove classifiers. 6 years ago
David Wilson a74903d59a docs: update compatibility notice on main page. 6 years ago
David Wilson 18c9cd2365 docs: update supported Python version list. 6 years ago
David Wilson ea5a4ed385 tests: use Ansible 2.5.5 by default 6 years ago
David Wilson bd65e50b2f ansible: reduce() does not exist in 3.x. 6 years ago
David Wilson b92545e61a minify: avoid cStringIO use.
On 2.7 it was "accidentally fine" because the buffer object the StringIO
was initialized from happened to look like ASCII, but in 2.6 either
UCS-2 or UCS-4 is used for that buffer, and so the result was junk.

Just use the io module everywhere if we can, falling back to pure-Python
StringIO for Python<2.6.
6 years ago
David Wilson 29f15c236c core: remove needless size prefix from core_src_fd.
I think this is brainwrong held over from an early attempt to write the
duplicate copy of core_src on stdin.
6 years ago
David Wilson 3e73e6ae11 Reenable all Travis Jobs. 6 years ago
David Wilson b21d51be47 ansible: fix test for 3.x. 6 years ago
David Wilson 34751c38b0 ansible: cStringIO interprets unicode as a buffer obj on 2.x 6 years ago
David Wilson 04e138e060 core: fix serialization of empty bytes() on 3.x. 6 years ago
David Wilson dd62009f70 Record ulimit -a in run_test output. 6 years ago
David Wilson b4f4b66679 tests: make cpu_load.py more random. 6 years ago
David Wilson 46ec0ffcaf tests: log original traceback in assertRaises(). 6 years ago
David Wilson ff2f44b046 core: reduce chance of Latch.read()/write()/close() race.
Previously it was possible for a thread to call Waker.defer() after
Broker has torns its Waker down, and the underlying file descriptor
reallocated by the OS to some other component.

This manifested as latches of a subsequent test invocation receiving the
waker byte (' ') rather than their expected byte '\x7f'.

This doesn't fix the problem, it just significantly reduces the chance
of it occurring. In future Side.write()/read()/close() must be
synchronized with a lock.

Previously the problem could be reliably triggered with:

    while :; do
        python tests/call_function_test.py -vf CallFunctionTest.{test_aborted_on_local_broker_shutdown,test_aborted_on_local_context_disconnect}
    done
6 years ago
David Wilson 3e48f95439 tests: import cpu_load.py. 6 years ago
David Wilson e24eddb1ce core: move Latch docs back inline. 6 years ago
David Wilson 7ff9d573b6 tests: remove stray enable_debug() 6 years ago
David Wilson 42276f158b core: log the data received on the latch file handle. 6 years ago
David Wilson 970f54de85 service: remove stray debug 6 years ago
David Wilson caa648b1ea utils: handle duplicate log_to_file() calls. 6 years ago
David Wilson 8791d40081 parent: tidy up call_async() logging. 6 years ago
David Wilson 1f6c47554a examples: update mitogen-fuse.py for 3.x. 6 years ago
David Wilson 4ff47d6a93 parent: more 2/3x format fixes 6 years ago
David Wilson a52064a24f core: reordered find_module() test was broken (again)
e81b3bd0652b5eb125eb224ceca281b9d540dd5e

The whitelist check must happen /after/ the other checks, otherwise we
unconditionally retunr self for crap like 'ansible.module_utils.json'.
6 years ago
David Wilson 24ecfb3b13 Fix setns.py syntax for 3.x 6 years ago
David Wilson 90f2f823db tests: remove stray hard-coded interpreter. 6 years ago
David Wilson 9e3e02fb65 tokenize must parse under 3.x even if it won't run there
To support 3.x parent 2.x child
6 years ago
David Wilson 6b4e047017 tests: 3.x parent_test fixes. 6 years ago
David Wilson 6cbf34d5fe tests: another smattering of 3.x type/API fixes. 6 years ago
David Wilson 0422a8c263 parent: python_path setting depends on local or remote
For local, we want to default to the same Python version as the current
process. For remote, we want whatever is on offer.
6 years ago
David Wilson db529e8228 core: fix Receiver.__iter__ regression on EOF 6 years ago
David Wilson 0eb77b5f7c utils: always enable microsecond logging.
It's too useful, and the logs are fairly out of control already, may as
well just capture everything in the first pass.
6 years ago
David Wilson 7697861011 tests: skip one test that triggers bug in ancient vendered six.py 6 years ago
David Wilson c141dd10ec master: fix resolve_relpath()
looks like this was just as broken on 2.x, and suddenly we're
finding a bunch more legit Django deps. It seems anywhere
absolute_import appeared in 2.x, we skipped some imports.
6 years ago
David Wilson b0404bef40 tests: fix get_module_via_* encoding issues 6 years ago
David Wilson 9903692811 master: update scan_code_imports to cope with wordcode
Constant-sized opcodes were introduced as an optimization in Python 3.6.
See https://bugs.python.org/issue26647
6 years ago
David Wilson 9fb2371d64 importer: reorder/tweak find_module() tests to cope with six.moves
The old hack on the master side we had is broken for some reason on 3.x.
Instead tweak the client to be more selective: if a request is for a
module within a package, the package must be loaded (in sys.modules),
and its __loader__ must be us. Previously if the module didn't exist in
sys.modules, we'd still try to fetch from the master, which doesn't
appear to ever make sense.
6 years ago
David Wilson 826c477061 tests: built-in exceptions live in a different module in 3.x 6 years ago
David Wilson cbcd8267d1 tests: must decode() zlib result for 3.x. 6 years ago
David Wilson ec176bf1f8 tests: unittest2 import behaviour appears to differ between 2/3.
In 2 the module is loaded as __main__
In 3 it has its actual name.
6 years ago
David Wilson 410016ff47 Initial Python 3.x port work.
* ansible: use unicode_literals everywhere since it only needs to be
  compatible back to 2.6.
* compat/collections.py: delete this entirely and rip out the parts of
  functools that require it.
* Introduce serializable Kwargs dict subclass that translates keys to
  Unicode on instantiation.
* enable_debug_logging() must set _v/_vv globals.
* cStringIO does not exist in 3.x.
* Treat IOLogger and LogForwarder input as latin-1.
* Avoid ResourceWarnings in first stage by explicitly closing fps.
* Fix preamble_size.py syntax errors.
6 years ago
David Wilson 0aba88dd8b docs: promote contributors.rst 6 years ago
dw fca14339bd
Merge pull request #293 from dw/dmw2
docs: update & link in contributors page.
6 years ago
David Wilson e26f3d7907 docs: update & link in contributors page. 6 years ago
dw 87d309c6f1
Merge pull request #292 from dw/dmw2
docs: change install docs to point at stable branch.
6 years ago
David Wilson 6632f682da docs: change install docs to point at stable branch. 6 years ago
David Wilson cb595b30d4 issue #16: rearrange Travis matrix and add Python 3.6 target for core tests 7 years ago
dw 906bc91fab
Merge pull request #287 from dw/issue275
Issue275
7 years ago