Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace HotChocolate.Execution.Processing;

public class OperationFeatureCollectionTests
{
private static readonly TimeSpan s_handshakeTimeout = TimeSpan.FromSeconds(5);
private static readonly TimeSpan s_completionTimeout = TimeSpan.FromSeconds(10);
private static readonly TimeSpan s_handshakeTimeout = TimeSpan.FromSeconds(30);
private static readonly TimeSpan s_completionTimeout = TimeSpan.FromSeconds(60);

[Fact]
public async Task GetOrSetSafe_Should_NotDeadlock_When_FactoryRacesLazySelectionSetCompilation()
Expand Down Expand Up @@ -36,8 +36,14 @@ public async Task GetOrSetSafe_Should_NotDeadlock_When_FactoryRacesLazySelection
// act
// the optimizer of `first` runs while the operation lock is held and writes its selection
// feature only after the feature factory of `second` has started to compile a selection set.
var compilation = Task.Run(() => operation.GetSelectionSet(first), cancellationToken);
var featureFactory = Task.Run(
// both sides run on dedicated threads to keep the handshake independent of thread-pool
// scheduling.
var compilation = Task.Factory.StartNew(
() => operation.GetSelectionSet(first),
cancellationToken,
TaskCreationOptions.LongRunning,
TaskScheduler.Default);
var featureFactory = Task.Factory.StartNew(
() =>
{
if (!compilationStarted.Wait(s_handshakeTimeout, cancellationToken))
Expand All @@ -52,7 +58,9 @@ public async Task GetOrSetSafe_Should_NotDeadlock_When_FactoryRacesLazySelection
return new SelectorFeature(operation.GetSelectionSet(second));
});
},
cancellationToken);
cancellationToken,
TaskCreationOptions.LongRunning,
TaskScheduler.Default);

var deadlocked = false;

Expand Down
Loading