Fix "System.Runtime.Remoting.RemotingException: Object /<identifier1>/<identifier2>.rem has been disconnected or does not exist at the server."#822
Merged
Conversation
…>/<identifier2>.rem' has been disconnected or does not exist at the server." When building Datadog.Trace for net45, we simulate AsyncLocal storage (needed for correct scope management) by storing the current Scope in the Logical Call Context. This uses the remoting infrastructure which sets default leases on objects stored in the Logical Call Context. If execution happens in another AppDomain and the lease expires, we get the above exception. This PR See issue serilog/serilog#987 and the corresponding fix serilog/serilog#992
Contributor
|
Thanks for the PR. Do you know why they are not suffering from this problem? Perhaps we should file an issue so that they can consider also applying a similar change? |
macrogreg
reviewed
Jul 28, 2020
…the lease expires
…once, just to be on the safe side.
lucaspimentel
approved these changes
Aug 5, 2020
kevingosse
reviewed
Aug 6, 2020
kevingosse
approved these changes
Aug 7, 2020
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.
When building Datadog.Trace for net45, we simulate AsyncLocal storage (needed for correct scope management) by storing the current Scope in the Logical Call Context. This uses the remoting infrastructure which sets default leases on objects stored in the Logical Call Context. If execution happens in another AppDomain and the lease expires, we get the above exception.
This PR follows the solution laid out by Serilog when they previously encountered this error. See issue serilog/serilog#987 and the corresponding fix serilog/serilog#992. When adding objects to the Logical Call Context, add logic so they always have an object claiming a lease on them from the host AppDomain so they never get removed from the "remote client" (Logical Call Context).
@DataDog/apm-dotnet