fix(worker): Blender jobs always failed with "Collection was modified"
LogTail was read by the progress loop while the output pumps appended to it. Blender rewrites its status line many times a second, so the first progress report of every job threw; aerender hit the same race only rarely. LogTail now locks internally. The exception also escaped BlenderRunner without ending the process, leaving blender.exe rendering unsupervised on the node on every failed attempt. Any unexpected exception in the monitor loop now kills the process tree. Bump worker to 1.6.2. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -117,4 +117,21 @@ public class LogTailTests
|
||||
for (var i = 1; i <= 5; i++) tail.Add($"line {i}");
|
||||
Assert.Equal("line 3\nline 4\nline 5", tail.ToString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ReadingWhileAnotherThreadWritesDoesNotThrow()
|
||||
{
|
||||
// The Blender runner's output pumps add lines while its progress loop
|
||||
// reads the tail; unsynchronised this threw "Collection was modified".
|
||||
var tail = new LogTail(200);
|
||||
using var stop = new CancellationTokenSource(TimeSpan.FromSeconds(1));
|
||||
var writer = Task.Run(() =>
|
||||
{
|
||||
var i = 0;
|
||||
while (!stop.IsCancellationRequested) tail.Add($"Fra:1001 Sample {i++}/128");
|
||||
});
|
||||
|
||||
while (!stop.IsCancellationRequested) _ = tail.ToString();
|
||||
await writer;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user