Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tag: release/1.2.9
Fetching contributors…

Cannot retrieve contributors at this time

293 lines (194 sloc) 12.131 kb
v1.2.7 further lock adjustments, deadlock risk reduction
* Refactor ZookeeperBase to not hold onto the mutex while waiting
for the dispatch thread to exit and the CZookeeper instance to close.
Instead, lock, nil out @czk, and unlock (which will cause all calls to
raise NotConnected), and then carry on with the shutdown procedure, greatly
reducing the chances of a deadlock. Also add a hardcoded 30 second timeout
to the join of the shutdown thread, that way we won't hang indefinitely in
the case of an unforseen condition.
* Improve the CZookeeper#wait_until_connected to use a deadline approach
to waiting for both running and connected states. Also, handle the
'nil' (wait forever) timeout properly.
* Wake all waiting threads on all ConditionVariables when CZookeeper#shut_down!
is called
v1.2.6 fix build on fedora
v1.2.5 cleanup locking in ZookeeperBase
* There were several situations where we would hold the lock before calling
a method on CZookeeper (inquisitors and #create in particular). This
exposed us to deadlocks in situations where an async event would be
delivered (probably a SESSION_EXPIRED event), but the callback block could
not be called because the dispatch thread would block on the mutex being
held by the caller of create.
This version cleans up that usage, and ensures that the only time we hold
the mutex is during startup/shutdown (when the value of @czk may be changing),
and in all other cases we grab the mutex, dereference, and unlock then perform
whatever action on the reference.
* Add a safety net to Continuation (which will soon be called 'Promise' or
'Future' at the request of @eric). If any operation takes more than 30s
an exception will be raised in the calling thread. The session timeout
setting makes it so that no operation should take more than 20s, so we know
if we haven't received a reply in *longer* than that, something has gone
awry.
v1.2.4 fix buffer overflow in CZookeeper client_id code
* the 'passwd' part of the struct is a char[16], but isn't null terminated.
use rb_str_new with an explicit length, rather than rb_str_new2 which
uses strlen().
v1.2.3 ensure that all threads are woken up on shutdown
* There was an edge case where a call would be queued up and its thread
sleeping waiting for a response, but that response would never come because
the connection was shut down. This version includes a patch for that case
to ensure that if a call is in 'pending' state, and shutdown time arrives
that all pending threads will receive a Zookeeper::Exceptions::NotConnected
exception.
v1.2.2 avoid race while waiting for connection
* There was a possible race in CZookeeper#wait_until_connected where if we
couldn't connect to the port specified (localhost:28271) then we wound up
burning 100% CPU and spinning. This solution fixes that by hooking into the
event delivery and keeping track of what the current state is. When there's
a change, we use a ConditionVariable to wake up threads that were waiting
until the connection was connected. Additionally, we now respect the
timeout parameter again.
v1.2.1 simplify assert_open
* The client methods were all calling assert_open before performing an
action. This was meant as a fail-early lightweight check of the connection
state and it worked well when we were running against the mt code. Now this
requires us to use a Continuation and make our way through the event loop.
There is a possible deadlock this release should solve that was caused by
the assert_open code holding a lock while making an async call through
the event loop. This is no longer the case. The assert_open call only checks
that the current handle hasn't been closed, the connection-state checking
now occurs before submitting a request on the event iteration thread, and
the behavior should be the same as it was before. If the underlying
connection is not in the 'connected' state, an exception will be raised.
v1.2.0 Stop the World, I Wanna fork()
* changed pause/resume methods to pause_before_fork_in_parent
and resume_after_fork_in_parent to match their ZK counterparts
* replaced the Queue in QueueWithPipe (really have to change that name)
with an Array and Mutex/ConditionVariable pair. This allows us to
have better control over the shutdown signaling, and lets us resume
operations after a pause.
v1.1.1 Cleanup after code review (h/t @eric)
* While hunting down this bug: https://bugs.ruby-lang.org/issues/6438
Eric Lindvall made a number of helpful catches.
* Reduce syscall overhead by not using an unnecessary pipe in the event_lib.c
implementation
* More careful use of rb_raise, don't longjmp past necessary free() calls.
* More careful malloc in the get() implementation (we need to allocate 1MB
to hold the data in a znode, but only in the SYNC cases).
v1.1.0 Rewrite C backend to use zookeeper_st, the async library
* In order to ensure fork safety, a rewrite of the backend was necessary.
It was impossible to guarantee with the mt lib that a lock would not
be held by a thread when fork() was called, which opened up the possibility
for corruption and other badness.
This version contains a Continuation class, which allows us to present a
synchronous front-end to the asynchronous backend. All features are still
supported, no special action is necessary to prepare for a fork, and the
post-fork procedure is the same as before: call reopen() in the child,
continue on in the parent like nothing happened.
v1.0.6 Only include backports if RUBY_VERSION is 1.8.x
* 'backports' pollutes too much, use sparingly
v1.0.5 Minor cleanup
* Fix the InheritedConnectionError message
* Clean up the module includes
v1.0.3 Linux: Fix hang on reopen after fork
* Linux users relying on fork() should upgrade to 1.0.3, as it
fixes a bug in the reopen code that would cause a hang in the child.
If you're running on linux, you *really* should upgrade
v1.0.0 Single Zookeeper namespace
* The top level Zookeeper class is now a module, the former Zookeeper
class is now Zookeeper::Client
* Consolidate the 6 top-level namespaces into one, Zookeeper module
ZookeeperCommon -> Zookeeper::Common
ZookeeperCallbacks -> Zookeeper::Callbacks
ZookeeperConstants -> Zookeeper::Constants
ZookeeperExceptions -> Zookeeper::Exceptions
ZookeeperACLs -> Zookeeper::ACLs
CZookeeper -> Zookeeper::CZookeeper
* Added a 'zookeeper/compatibility' file that will define the old names
and look up the new constants for users, and print a warning telling them
the change has occurred and that they should update their code
* Added scripts/upgrade-1.0-sed-alike.rb which will basically do a
find-and-replace, changing the old names to the new names (worked on
both the Zookeeper and ZK codebases).
* Java and C now use different names for the base class, to avoid the
possibility of error. Java is now JavaBase, C remains ZookeeperBase.
* All client methods are defined in the ClientMethods module and mixed
into the constructed Client class.
* Fix all requires, no longer monkey with $LOAD_PATH, use require_relative
* Bugfix for C client.
Because we release the GIL, there's the possibilty that in the middle of a
synchronous C call, ruby will have switched thread contexts and one of
those threads will call close. It seems that during normal operation, this
is not a problem, but during shutdown, this causes CPU to spike to 100% and
a deadlock. This fix essentially wraps every call to the C layer in a
mutex. There may be a slightly less heavyweight optimization in the future,
but this is the safest option at the moment.
v0.9.3 Event thread shutdown fix, Windows compatibility fix
* Use a 'shutdown thread' to coordinate cleanup if close is called from the
event thread (prevents deadlock)
* Default Logger now uses $stderr instead of opening /dev/null [#16]
* Gemfile/gemspec/Rakefile refactoring.
v0.9.2 More efficient and simpler wrappers for GIL release
* After a code review by Andrew Wason (rectalogic), use a much simpler
technique for creating the arg structs and passing them to the
zkrb_gvl_* functions. No malloc(), no free(), no problem.
v0.9.1 see v0.8.4 notes, same patch
v0.9.0 RELEASE THE KRAK..er, GIL!!
* In >= 1.9.2 the ruby interpreter allows you to release the GIL when
calling into native code, sounds like a good idea.
This release makes use of that code by parsing the zookeeper.h header file
and extracting the method signatures of all relevant zoo_* functions, then
generating boilerplate that allows us to call those functions via the
rb_thread_blocking_region function.
1.8.7 compatibility is maintained by stubbing out that functionality if built
under 1.8.7.
* 1.8.7 is deprecated! I will continue to support 1.8.7 for the near future
but sometime soon, you're gonna have to upgrade.
v0.8.4 fix NameError, require 'forwardable'
* Really not sure why this didn't come up in tests
* issue here https://github.com/slyphon/zk/issues/22
v0.8.3 fix NonLocalJump exception in event delivery thread shutdown code
* hit a corner case where we're waiting for the zkc handle setup
and the user decides to shutdown, but before we've had a chance
to enter the delivery loop.
* Cleaned up some nasty code in ZookeeperConstants
* removed ZookeeperConstants#print_events and ZookeeperConstants#print_states
* changed EVENT_TYPE_NAMES and EVENT_STATE_NAMES in ZookeeperConstants
to use string values instead of symbols
v0.8.2 fix close after a fork()
* The dispatch thread will be dead in this situation, so we need to
check to see if it's already dead before waiting on it to exit.
v0.8.1 Java client fix, silence warnings
v0.8.0 Refactor C implementaion, EventMachine client
* separated CZookeeper and ZookeeperBase implementation
This solves issues with reopen not working properly, makes for a much
cleaner event delivery implementation. ZookeeperBase controls the lifecycle
of the event dispatch thread now, rather than it being tied to CZookeeper.
* added support for the 'sync' API call
* Refactored zookeeper_c.c and zookeeper_lib.c
More error checking in zookeeper_lib.c and restructure some things to make
logic easier to follow
Fix bug in method_get_next_event that made the shutdown case so complicated
* Massively simplified EMClient implementation
Rather than trying to hook the IO used by zookeeper_lib to notify zookeeper_c
about event availabiltiy directly into EventMachine, use the same event delivery
thread, but wrap the dispatch call in EM.schedule.
* Improve implementation of spin-lock-esque code that waits for the connection to be
established before returning.
This cut the test runtime down from 1m 20s to 2s.
* Java client refactoring, similar correctness changes
* Change ZookeeperException base class to StandardError instead of Exception
v0.4.5 Upgrade to ZooKeeper 3.3.3
v0.4.4 Fix race condition on close, possible data corruption on async get.
v0.4.3 Fix a handful of memory-related bugs, fix SIGSEGV on master change, reduce latency of event handling, fix compilation on OSX.
v0.4.2 Add options to Zookeeper#initialize, silence most Zookeeper logs.
v0.4.1 Upgrade to ZooKeeper 3.3.2
v0.4.0. More attr-readers (StarvingMarvin) and 1.9 compatibility (tsuraan)
v0.3.2. Handle close, closed connections and expired sessions a little more gracefully.
v0.3.1. ACL bugfix.
v0.3.0. Wickman's rewrite, breaks dependencies from myelin/emaland port.
v0.2.2. Fix compatibility with stock Leopard fat-binary Ruby.
v0.2.1. No more camelcase classname.
v0.2. Bundle C dependencies, like memcached.gem.
v0.1. First release.
# vim:ft=text:ts=2:sw=2:et
Jump to Line
Something went wrong with that request. Please try again.