Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KUDU-2686 python: remove multiprocessing
The python multiprocessing library doesn't play very nicely when creating Pools after initializing complex state (e.g. the KuduClient). Because of how it forks, the library may even copy lock states, and lead to odd situations, like multiple threads waiting on a lock that isn't held by any thread in the process. This was the case in KUDU-2686, which resulted in a hang in test_scantoken.py. Upon inspection[1], there appeared to be multiple threads in a process waiting on the same sys_futex, but none of them held it. [2] tips some pieces to make it more reproducible (tested on Ubuntu 14.04, where the issue was first reported). Starting with python3.4, there is supposedly a way around this, which is to use a different process-startup pattern, though this isn't available in python2. This patch removes usage of multiprocessing entirely. While it can be argued that multiprocessing provides extra test coverage, given that multiprocessing is known to have such issues[3][4], that this isn't the first time we've been bitten by this forking issue, that it's test-only, and that scan tokens are tested in the C++ client as well, "dumbing" down the test doesn't seem unreasonable. [1] https://gist.github.com/andrwng/d2d21c551362ddd564926c2a4ec406ae [2] https://gist.github.com/andrwng/cc6c211c62b1235cc58944d513ba6655 [3] pytest-dev/pytest#958 [4] https://codewithoutrules.com/2018/09/04/python-multiprocessing/ Change-Id: Ia9aa91191d54801731da27e5f132b3c96af0efa1 Reviewed-on: http://gerrit.cloudera.org:8080/12494 Tested-by: Kudu Jenkins Reviewed-by: Jordan Birdsell <[email protected]> Reviewed-by: Alexey Serbin <[email protected]>
- Loading branch information