-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dispatch_init vs. dispatch_accept #238
Comments
Nope. I never particularly thought this through.
My intention was that there's only one connection at once, and you can't establish a new connection until the previous one is finished -- including any in-progress requests. So there shouldn't be "zombies" at any point. (Obviously mux is the exception here since the whole point it exists is to allow multiple incoming connections to share access to a single daemon.) I'm not sure if that clarifies things... |
Ah, perhaps "zombie" wasn't the right term. The point is that kvld's
So if we've allocated a dispatch I'll sketch out a |
At the point immediately after We could record an |
BTW I know that there's a lot of mostly-duplicated code between kivaloo daemons and I'd be happy to have it standardized and/or refactored (the first bit which comes to mind is |
tl;dr: There's an API mismatch between
lbs/dispatch.h
andkvlds/dispatch.h
(which has carried over to all the other programs).lbs/ and mux/ have a
dispatch_init()
, which obviously allocates things; anddispatch_done()
, which unconditionally cleans up and frees the dispatcher. That seems nice and clean to me.By contrast, kvlds/ (and likely other programs) doesn't have a
dispatch_init()
; instead,dispatch_accept()
allocates a new dispatcher. More problematically,dispatch_done()
can only be called ifdispatch_alive(D)
has previously returned zero. In particular, it checks that(D->dying == 1)
, which only happens if it has calleddropconnection()
.are you sure that you want to allocate & free the dispatch object all the time in kvlds? Of course we need to ensure that each connection starts from a known state, but surely that could be restricted to
dispatch_accept()
, while a newdispatch_init()
handles parameters that don't change, such as kmax and vmax.I'm sure that kvlds needs a function to handle cleaning up after a dying connection (including sanity checks), but it's a bit confusing for that to have the same name as the "unconditional clean up"
dispatch_done()
from lbs. Could we rename one or both types of functions? My first thought would be renamedispatch_done()
->dispatch_zombie_cleanup()
in dynamodb-kv, kvlds, lbs-dynamodb, lbs-s3, s3. (I'm not a huge fan of zombies; I'm just trying to be clear about the conditional nature of that clean-up.)And then I'd like to add a
dispatch_done()
which acts the same as lbsdispatch_done()
, namely unconditional clean-up.On the other hand, given that there's only two programs which have unconditional clean-up, maybe it's better to leave the other programs alone, and rename the function in lbs and mux to
dispatch_unconditional_done()
or something like that.The text was updated successfully, but these errors were encountered: