GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — pipeline5 by normanmaurer · Pull Request #17671 · netty/netty pipeline5 #17671New issueHave 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
Closed
Uh oh!
There was an error while loading. Please reload this page.
Closed
pipeline5 #17671Changes from 1 commit
Commits
File filterConversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page. Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page. Diff viewDiff view
Prev
Port: Don't corrupt the pipeline when a handler context is removed tw…
…ice (#17643) Motivation: `DefaultChannelPipeline.atomicRemoveFromHandlerList(...)` is not idempotent. A removed context keeps its `prev` / `next` pointers, and `replace0(...)` leaves the old context with `prev = next = newCtx`. Unlinking such a context a second time writes its stale neighbours back into the list. For a replaced context the replacement then points to itself. There are three ways to get there: 1. `remove(handler)` / `replace(handler, ...)` look up the context outside of the pipeline lock. Two threads that remove or replace the same handler can both find the context and both unlink it. In a stress harness (two threads running `remove(x)` and `replace(x -> y)` on a `LocalChannel`), the list was corrupted after a few thousand iterations. 2. `callHandlerAdded0(...)` unlinks the context when `handlerAdded(...)` throws, even if `handlerAdded(...)` already replaced or removed its own handler. The same happens when a handler is replaced before the channel is registered and its deferred `handlerAdded(...)` throws at registration. Afterwards `fireChannelRead(...)` loops forever in `findContextInbound(...)`. 3. `destroyDown(...)` unlinks a context that a `handlerRemoved(...)` callback of a handler further down the pipeline has replaced. `close()` then spins forever in `destroyDown(...)` and pins the event loop. Modification: - `atomicRemoveFromHandlerList(...)` checks under the lock that the context is still linked (`ctx.prev.next == ctx`) and does nothing, returning `false`, if it is not. - `remove(...)` and `replace(...)` throw `NoSuchElementException` when the context was removed or replaced after it was looked up, the same as for a handler that is not in the pipeline. `removeIfExists(...)` returns `null` in that case. - `callHandlerAdded0(...)` and `destroyDown(...)` skip a context that is no longer linked. Whoever unlinked it is already responsible for calling `handlerRemoved(...)`, so it is still called exactly once. - No public API changes. Added tests to `DefaultChannelPipelineTest`: - `testHandlerAddedReplacesItselfAndThrows` (path 2) - `testHandlerReplacedBeforeRegistrationAndHandlerAddedThrows` (path 2, deferred `handlerAdded`) - `testCloseWhenHandlerRemovedReplacesOtherHandler` (path 3) - `testRemoveOfHandlerReplacedConcurrently` (path 1, made deterministic by holding the pipeline lock until the removing thread has looked up the context and is blocked on the lock) - `testHandlerAddedRemovesItselfAndThrows` (the remove-instead-of-replace variant of path 2; this one already passed before, since the list happened to stay consistent, and is added for coverage) The tests check that the list is consistent, that events still reach the replacement handler and the tail, and that `handlerAdded` / `handlerRemoved` are each called once. Without the fix, three of the first four time out and `testRemoveOfHandlerReplacedConcurrently` fails. Result: The pipeline stays consistent when a handler context is removed more than once, and none of the three paths can hang the channel anymore. Behaviour change: when two threads race to remove or replace the same handler, the call that loses now throws `NoSuchElementException` (as documented on `ChannelPipeline.remove(...)` / `replace(...)` for a handler that is not in the pipeline) instead of also "succeeding" and corrupting the list. A call that comes slightly later already got this exception before this change. Also, `PendingHandlerAddedTask`'s rejected-executor path, which unlinks the context, can no longer unlink a context that was removed before registration a second time.
Uh oh!
There was an error while loading. Please reload this page.
commit b7f8b135172cbf61ba35eb89ee3685b6cf803120
There are no files selected for viewing
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
|
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |