Repository navigation
Fix race in Naming_Tools.Register when contexts are created concurrently - #35
Open
gdepacetest wants to merge 1 commit into
Open
gdepacetest wants to merge 1 commit into
gdepacetest wants to merge 1 commit into
Conversation
When two servers register names under the same new naming context at the same time (e.g. "Parks/North" and "Parks/South"), both may find the context missing in Retrieve_Context and call bind_new_context. The second call raises AlreadyBound, which propagated out of Retrieve_Context into the AlreadyBound handler of Register. With Rebind => True, that handler then called rebind on a nil Context, raising INV_OBJREF; with Rebind => False it re-raised a misleading AlreadyBound for a name that was never bound. Retrieve_Context now resolves the context again when bind_new_context raises AlreadyBound, and Register only handles AlreadyBound raised by its own bind. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
PolyORB.CORBA_P.Naming_Tools.Registerfails when two processes register names under the same, not yet existing, naming context at the same time. For example, two servers registerDogPark/NorthandDogPark/Southagainst onepo_cos_naming.Retrieve_Context, both getNotFoundfromresolve, and both callbind_new_contextforDogPark.bind_new_contextraisesAlreadyBound.Retrieve_Contextdoesn't handle it, so it propagates intoRegister.Registerhas anAlreadyBoundhandler around the whole procedure, meant for its ownbind. It catches this exception whileContextis still nil:Rebind => True, it callsrebindon the nil context and raisesCORBA.INV_OBJREF;Rebind => False, it re-raisesAlreadyBoundfor a name that was never bound.How to reproduce
Start
po_cos_naming, then start two servers at the same moment that each call:PolyORB.CORBA_P.Naming_Tools.Register ("Parks/<unique name>", Ref, Rebind => True);In our test (two PolyORB servers on one machine, started together), one of them failed with
CORBA.INV_OBJREFfromCosNaming.NamingContext.Rebindin about 7 of 10 runs:Fix
Retrieve_Context: ifbind_new_contextraisesAlreadyBound, another client created the context in the meantime, so resolve it again and use that context.Register: theAlreadyBoundhandler now covers onlybind (Context, N, Ref), so it only runs when the name itself is already bound.Testing
-gnaty -gnatwae).