drivers: stop the ttl fiber in rw mode as well - #265
Open
maksimuimin wants to merge 1 commit into
Open
maksimuimin wants to merge 1 commit into
maksimuimin wants to merge 1 commit into
Conversation
fifottl and limfifottl used an unbuffered channel to stop the ttl fiber, but the fiber read it only in ro mode. So stop() blocked forever in rw mode and drop() did not stop the fiber at all, leaking one fiber per dropped tube. utubettl used a buffered channel: stop() returned, but the fiber kept running and crashed on the dropped space. Now the fiber works while it is the fiber registered in the tube: stop() deregisters it, wakes it up and joins it, and fifottl got a drop() which stops the fiber before dropping the space. limfifottl forwards start()/stop()/drop() to the parent driver so that the registration lives in a single object. Closes tarantool#262 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Sep 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #262
Problem
fifottl/limfifottlstop the ttl fiber through an unbufferedfiber.channel()that the fiber reads only in thebox.info.robranch. So while the instance is rw:tube.raw:stop()blocks the caller forever;tube:drop()never stops the fiber (fifottlhas nodrop()), leaking one fiber per dropped tube;utubettl(buffered channel) returns fromstop(), but the fiber keeps running and crashes on the dropped space.Repro and details in #262.
Fix
The fiber now works while it is the fiber registered in
self.fiber:stop()deregisters the fiber, wakes it up and joins it, so it is guaranteed to be gone whenstop()/drop()return, in rw and ro mode alike;cond:wait(), so a stop request that arrives mid-iteration is not lost;start()usesfiber.new()so the fiber cannot observe itself as unregistered beforeself.fiberis assigned;fifottlgot adrop()that stops the fiber before dropping the space;limfifottlforwardsstart()/stop()/drop()to the parent object, otherwiseself.fiber = nilin the wrapper would shadow the parent's registration and the fiber would never stop;sync_chanis removed, the ro branch waits on the samecondwith a 100 ms timeout as before.New test
t/260-ttl-fiber-stop.tcovers stop/start/drop for all three drivers. Full suite passes locally (Tarantool 3.8, memtx and vinyl).