Skip to content
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

Fix crashing InMemory.FunctionalTests #59821

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

BrennanConroy
Copy link
Member

InMemory.FunctionalTests has crashed before due to an exception in a background task. When the InMemoryTransportConnection is closed it queues a callback to the threadpool which sets a TaskCompletionSource. If the callback is queued more than once the TCS will be set multiple times which is an error and exceptions in threadpool items will crash the process.

Simple fix is to avoid queuing the threapool item multiple times by making our closed bool set/check an atomic operation.

One test that would hit this is

public async Task ResetsCountWhenConnectionClosed()

where it would dispose the connection from test code, while in parallel the app code would start cleaning up which would call Abort.

@BrennanConroy BrennanConroy added the area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions label Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant