summaryrefslogtreecommitdiff
path: root/kazoo
Commit message (Collapse)AuthorAgeFilesLines
* feat(core): make DNS resolution error retriable (#631)krishna2021-01-201-1/+1
| | | DNS resolution errors were previously not retriable, this commit allows it by changing the value returned when the DNS resolution fails.
* fix(core): do not allow responses to choke request and ping processingDamien Diederen2020-12-131-10/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | Without this patch, a single select event is processed by iteration in the 'ConnectionHandler' event loop. In a scenario where the client issues a large number of async requests with an important amplification factor, e.g. 'get_children_async' on a large node, it is possible for the 'select' operation to almost always return a "response ready" socket--as the server is often able to process, serialize and ship a new reponse while Kazoo processes the previous one. That response socket often (always?) ends up at the beginning of the list returned by 'select'. As only 'select_result[0]' is processed in the loop, this can cause the client to ignore the "request ready" FD for a long time, during which no requests or pings are sent. In effect, asynchronously "browsing" a large tree of nodes can stretch that duration to the point where it exceeds the timeout--causing the client to lose its session. This patch considers both descriptors after 'select', and also arranges for pings to be sent in case it encounters an "unending" stream of responses to requests which were sent earlier.
* chore: 2.8.0 release and changelog (backport missed 2.7.0) (#624)Stephen SORRIAUX2020-07-211-1/+1
|
* fix(core): handle SSL_WANT_READ/WRITE errors (#619)James E. Blair2020-06-271-2/+17
| | | | | | | | | | | This adds a simple recovery path in case an SSL connection receives an SSL_WANT_READ or WRITE error. Either error can occur while reading or writing. The error indicates that the underlying operation should be retried after the socket is once again readable or writable (per the error code). Closes #618 Co-authored-by: James E. Blair <jeblair@redhat.com>
* perf(core): Use chain.from_iterable in threading.py (#614)Ram Rachum2020-06-211-1/+1
| | | | | | This is a faster and more idiomatic way of using itertools.chain. Instead of computing all the items in the iterable and storing them in memory, they are computed one-by-one and never stored as a huge list. This can save on both runtime and memory space.
* fix(core): '"is" with a literal' syntax errors (#609)Reid D McKenzie2020-05-181-2/+2
| | | | | | As of Python 3.8, "is" with a literal is a syntax warning because of the confusion between equality and instance identity it represents. Issue #607
* feat(core): Use strict regex to identify lock contenders.Charles-Henri de Boysson2020-04-242-70/+93
|
* feat(core): Support additionaal lock contenter patternsCharles-Henri de Boysson2020-04-242-67/+125
| | | | | Allows configurable multi-implementations cooperations in locks (e.g. Zookeeper python & go clients contending for the same lock).
* [lock] interoperate with go clientPablo Mazzini2020-04-242-4/+20
|
* fix(core): sync() return should be unchrootedCharles-Henri de Boysson2020-04-152-9/+26
| | | | Resolves #601
* feat(test): Move to pytestCharles-Henri de Boysson2020-04-1424-1003/+1104
|
* fix(core): allow requests to be queued in CONNECTING state (#374) (#588)Damien Diederen2020-03-092-9/+106
| | | | | | | | | | | | | | With this patch, requests issued while the client is in the 'CONNECTING' state get queued instead of raising a misleading 'SessionExpiredError'. This fixes https://github.com/python-zk/kazoo/issues/374, and brings Kazoo more in line with the Java and C clients. See the 'kazoo.client.KazooClient.state' documentation as well as these discussions for more details: https://github.com/python-zk/kazoo/pull/570#issuecomment-554798550 https://github.com/python-zk/kazoo/pull/583#issuecomment-586422386
* fix(tests): Disable JAAS isInitiator for ServerCharles-Henri de Boysson2020-02-233-46/+47
| | | | | Satisfy new Hound style/lint checks Upgrade to latest 3.5.6/3.4.14 Zookeeper releases.
* feat(core): run SASL Kerberos tests as part of buildCharles-Henri de Boysson2020-02-234-164/+303
| | | | | | | | | | | | * Install debian packages for KDC as part of Travis init. * Setup a loopback mini KDC for running tests. * Run SASL tests as part of Travis builds. * Improve harness cluster to support: * Reconfiguration when environment changes. * Different JAAS configurations (DIGEST/GSSAPI). * Moved SASL tests into own module, with specially configured harness. * Bumped default timeout to 15 sec to mitigate false negatives on Travis.
* feat(core): Add create2 supportCharles-Henri de Boysson2020-02-183-13/+78
|
* fix(tests): specify -Dfile.encoding=UTF-8 when starting the ZK JVMDamien Diederen2020-02-102-1/+17
|
* fix(core): Implement proper retry backoff logic with jitter.Charles-Henri de Boysson2020-02-071-21/+17
| | | | | | | | | | | | | | | | | | New retry logic takes a maximum percentage off the canonical backoff, ensure gradual predictable retries timings while still having a controlable amount of jitter (re-introducing the `max_jitter` parameter) to avoids swarming client retries. Fix regression introduced in 60366d2c7910fc833991fad8e04bbe33817c0544 where retry/backoff logic produced only whole second (integer) retry delays. This produced inadequate retries on first retry and would generally not work on fast network where sub miliseconds retries are desired. Additionally, with high `max_delay` setting, as the range was always spanning from 0 until the last delay, it would also produce extremely random results with short delays following longer ones which is contrary to the expected backoff logic.
* fix(core): when connection fails, close the ConnectionHandler (#577) (#579)Jean-Marc Saffroy2019-11-101-0/+1
| | | | | | | | | When connection attempts fail repeatedly (e.g. all ZK servers are unavailable), eventually the socketpair in the ConnectionHandler fills up, and the Client gets stuck trying to write a single byte to the socketpair. Avoid this by ensuring we close the socketpair on a failed connection attempt.
* feat(CI): Keep only Python 3.{6,7} to CI and bump ZK versions to latests (#574)Stephen SORRIAUX2019-10-092-3/+9
| | | | | | | | | | | | | | * Switching to xenial distrib to make python 3.7 available * Testing against 3.5.5 instead of 3.5.4-beta and deploying new version for python 3.7 and zk 3.5.5 * Testing against zk 3.4.14 instead of 3.4.13 * Change pattern for slf4j-log4j lib * Since ZOOKEEPER-3156 it is now required to be authed to access ACLs * Drop support for ZK 3.3.x and Python 3.{4,5}
* feat(core): closed states instead of lost states (#573)David Bouchare2019-10-041-5/+5
| | | In order to be better in sync with the official documentation (https://zookeeper.apache.org/doc/r3.5.5/zookeeperProgrammers.html#ch_zkSessions) it is better to rename those variables to `close` instead of `lost`.
* fix(recipe): crash if None in znode (#569)Kurganov2019-10-011-1/+2
| | | | | | | | Avoid ``` File "/home/tests/kazoo/recipe/lock.py", line 341, in contenders contenders.append(data.decode('utf-8')) AttributeError: 'NoneType' object has no attribute 'decode' ```
* feat(utils): extend create_tcp_connection utility (#568)Paweł Szulik2019-08-061-3/+11
| | | | | | | | | | Add parameters to setup SSL context options and ciphers when playing with secure connection. It can be set via a handler: ``` class MySequentialThreadingHandler(SequentialThreadingHandler): def create_connection(self, *args, **kwargs): return create_tcp_connection(socket, options=MY_OPTIONS, ciphers=MY_CIPHERS, *args, **kwargs) ```
* feat(recipe): add support for curator SharedCount recipe (#559)BrianEaton12019-05-072-5/+48
| | | | | | | | | | | | | | | | | | * feat(recipe): add support for curator SharedCount recipe This feature allows Java clients using curator's SharedCount recipe and python clients using kazoo's Counter recipe to read and write from the same path without receiving type errors. example use: counter = zk.Counter("/curator", support_curator=True) counter += 2 counter -= 1 counter.value == 1 counter.pre_value == 2 counter.post_value == 1 Closes #558
* feat(core): improve SASL interface (#546)Charles-Henri de Boysson2019-02-125-117/+264
| | | | | | | | | | | | | | | | | | | | | | | Move SASL configuration out of auth_data into its own dictionary which exposes more SASL features (e.g. server service name, client principal...). Legacy syntax is still supported for backward compatibilty. Remove SASL from auth_data and place it between 'connection' and 'zookeeper protocol level authentication' to simplify connection logic and bring code in line with the protocol stack (SASL wraps Zookeeper, not the other way around). Consistent exception, `AuthFailedError`, raised during authentication failure between SASL and ZK authentication. New 'SASLException' exception raised in case of SASL intrisinc failures. Add support for GSSAPI (Kerberos). Example connection using Digest-MD5: client = KazooClient( sasl_options={'mechanism': 'DIGEST-MD5', 'username': 'myusername', 'password': 'mypassword'} ) Example connection using GSSAPI (with some optional settings): client = KazooClient( sasl_options={'mechanism': 'GSSAPI', 'service': 'myzk', # optional 'principal': 'clt@EXAMPLE.COM'} # optional )
* chore: 2.6.1 release and changelogStephen2019-01-291-1/+1
|
* fix(handlers): make AsyncResult call all registered callbacks instantly if ↵laura-surcel2019-01-154-16/+49
| | | | | | the handler has stopped running (#549) This avoids zombie thread to appear when creating and closing the client right after. A new unit case is added.
* fix(client): add missing paren (#550)Tristan de Cacqueray2019-01-131-1/+1
|
* fix(core): support deprecated KazooRetry argument (#545)Charles-Henri de Boysson2018-12-111-1/+10
| | | | Accept kazoo<=2.5.0 KazooRetry 'max_jitter' argument and display a warning for backward compatibility.
* fix(recipe): No more memory leak when ChildrenWatch was stopped (#543)kulallwang2018-12-062-0/+36
| | | | | | | This ensures that the watcher is removed from the client listener when the func given to ChildrenWatch returns False. Previously, the watcher was never removed so the ChildrenWatch object would endlessly grow in memory. A unit test is added to ensure this case never happen again. Fix #542
* fix(core): reduce timeout for the first Connect() request (#540)Florian Margaine2018-11-271-1/+1
| | | | | In the case of a zookeeper server under pressure, it will typically try to maintain the quorum rather than handling client requests. In this kind of case, the quorum is maintained, the connection works, but the client is frozen there. Retrying after a shorter timeout means we can reconnect to another server before losing the session altogether.
* fix(recipe): No more memory leak once TreeCache was closed (#524)Jiangge Zhang2018-11-215-15/+169
| | | | | | | | | | fix(recipe): Fix memory leak of TreeCache recipe. Fix memory leak on idle handler and on closed TreeCache. Add new memory tests for TreeCache recipe that uses objgraph and other tests for various handler on TreeCache. Let TreeCache start in a safe way. The doc now suggest to close unused TreeCache.
* chore: 2.6.0 release and changelog2.6.0Stephen2018-11-141-1/+1
|
* fix(core): ensure timeout argument is positive (#534)Chris Donati2018-11-092-1/+84
| | | | | | | | | Previously, a gap between calls to `time.time()` could lead to a situation where the current time was less than `end` during the `while` condition, but it was greater than `end` when assigning a value to `timeout_at`. Add tests to ensure a socket.error is raised instead of passing a nonpositive value as a timeout to socket.create_connection.
* fix(core): get_children with include_data=True uses GetChildren2 types (#514)Jean-Marc Saffroy2018-10-081-1/+2
|
* feat(tests): update Zookeeper 3.5.2-alpha to 3.5.4-betaStephen2018-10-083-16/+60
| | | | | | | | | | Version of Zookeeper is upgraded from 3.5.2-alpha to 3.5.4-beta for automated tests. Reconfig now needs superuser authentification, a test is added to cover this feature. Additionnal configuration and jvm parameters can be added when initializing ManagedZookeeper. This is needed to ensure reconfig's tests to pass and can be used in the future for similar needs. Closes #477
* fix(core): allow authentification in RO and RW modesStephen2018-10-081-48/+56
| | | | | | | | | Fixes the bug introduced by PR #512 where it is not possible to connect in RO mode using authentication. Since the SASL authentification feature, the _session_fallback method should be called only after the SASL authentification is done. A new method is added to the ConnectionHandler class in order to correctly use KeeperState.CONNECTED or KeeperState.CONNECTED_RO.
* fix(core): Use a copy of auth data when reconnecting (#509)arushiagg2018-10-061-2/+8
| | | It is possible to race between processing a new addAuth request(which updates the client.auth_data set) and iterating through it during reconnect. To avoid set changes during iteration, make a copy.
* feat(core): add SASL DIGEST-MD5 supportStephen2018-10-065-9/+152
| | | | | | | | This adds the possibility to connect to Zookeeper using DIGEST-MD5 SASL. It uses the pure-sasl library to connect using SASL. In case the library is missing, connection to Zookeeper will be done without any authentification and a warning message will be displayed. Tests have been added for this feature. Documentation also has been updated.
* fix(core): change KazooRetry to uniformly jitter over the whole backoff ↵Andreas Guðmundsson2018-09-262-10/+3
| | | | | | | | | | interval (#521) The previous implementation would add a fixed amount of jitter around the calculated back-off time. Retry attempts were thus clustered around the exponentially spaced backoff points. This patch does exponential backoff but uniformly spreads the retries over an interval [0, backoff**attempt]
* feat(core): Added SSL support (#513)Stephen SORRIAUX2018-09-253-23/+98
| | | | | | | | | | | | | | | | | | * client: Allow SSL use when communicating with Zookeeper, fixes #382 Zookeeper 3.5 supports SSL for client communications, this commit adds support for it on the Kazoo side. Note that you need to give the client the key, certificate and CA files. Co-Authored-By: Monty Taylor <mordred@inaugust.com> * Added keyfile password for ssl connection * Added a way to bypass ssl certification validation * Added a timeout when using SSL connection
* fix(recipe): Delete lock node in queue recipe if entry already consumedKhaled Basbous2018-09-251-2/+11
| | | | | | | Delete lock node if already entry already consumed Fix #366 Related: #347 / #373
* chore: 2.5.0 release and changelog2.5.0release/2.5Ben Bangert2018-06-011-1/+1
|
* fix(core): Fix gevent 1.3b1+ timeout importCarson Ip2018-05-111-2/+2
| | | | | gevent.event.Timeout is undocumented and will break when using gevent 1.3b1+. Use gevent.Timeout as suggested in gevent docs.
* fix(core): Correctly fire multiple callbacksPatrick White2018-03-262-3/+19
| | | | | | Due to the use of unbound lambdas in AsyncResult, multiple callbacks wouldn't actually get called, it would only call the final callback N times, where N is the number of registered callbacks.
* Update states.pyWei-Ming Yang2018-03-241-3/+3
| | | | fix a typo.
* feat(recipe): allow non ephemeral lockingRaghu Udiyar2018-03-232-4/+28
| | | | | | | | | | Right now if the program taking the lock exits, the lock is also released implicitly as the zk node is ephemeral. In some usecases its desirable to make the lock release explicit. For example, in scripting multiple programs that contend for a lock, or purposeful failing lock acquirers to detect issues. The ephemeral flag in acquire() allows for this behavior.
* fix(recipe): conn hangs when TreeCache refreshingJiangge Zhang2018-03-231-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | The previous implementation of session watcher triggers blocked operations. If there is a huge tree in ZooKeeper, reconnecting event will lead an initialized TreeCache into a bad performance state, because the connection routine was blocked by the session watcher of TreeCache. This commit put those blocked operations into a background queue to fix this. There is an example code snippet: from kazoo.client import KazooClient from kazoo.recipe.cache import TreeCache client = KazooClient() client.start() cache = TreeCache(client, '/a-huge-tree') cache.start() # Wait the cache be initialized and trigger a connection lost event. client.get_children('/') # The connection is still broken The patch of this commit has been used in the production environment of https://github.com/eleme.
* fix(recipe): Unexpected exceptions break TreeCacheJiangge Zhang2018-03-232-14/+30
|
* perf(recipe): Give TreeCache standalone queueJiangge Zhang2018-03-231-1/+16
| | | | This commit lets TreeCache do not use queue of connection routine any more.
* refactor: Unify queue factory in various handlersJiangge Zhang2018-03-232-7/+9
| | | | Then every handlers have queue_impl and queue_empty as their attributes.