Repository navigation
GROOVY-12459: Failed AsyncChannel producer never closes the channel so for await hangs and the exception is dropped - #2987
daniellansun wants to merge 1 commit into
Conversation
JMH summary — classic (commit
|
| Group | Speedup | Calibrated | n |
|---|---|---|---|
| bench | 0.938 × | 1.015 × | 124 |
| core | 1.084 × | 1.031 × | 108 |
| grails | 1.374 × | 1.173 × | 80 |
⚠️ 1 benchmark at least 1.5× slower than the 90-day baseline:
org.apache.groovy.perf.OperatorBench.spaceshipOperator— 1.56× slower (calibrated)
⚠️ Runner speed differs ≥15% from the historical baseline hardware for: core-hz, grails-ez. Raw speedups are not meaningful for those parts — use the calibrated column.
Runner calibration (this run vs baseline hardware): bench 0.93× (27 rulers) · core-ag 0.96× (3 rulers) · core-hz 1.24× (3 rulers) · grails-ad 0.96× (3 rulers) · grails-ez 1.38× (3 rulers)
Baseline: dev/bench/jmh/<part>/classic/data.js on gh-pages, trailing 90 days. Daily dashboard · Per-suite raw data
JMH summary — indy (commit
|
| Group | Speedup | Calibrated | n |
|---|---|---|---|
| bench | 0.965 × | 1.079 × | 124 |
| core | 2.288 × | 2.475 × | 108 |
| grails | 1.927 × | 1.658 × | 80 |
No benchmark is ≥1.5× slower than its 90-day baseline.
⚠️ Runner speed differs ≥15% from the historical baseline hardware for: grails-ez. Raw speedups are not meaningful for those parts — use the calibrated column.
Runner calibration (this run vs baseline hardware): bench 0.91× (27 rulers) · core-ag 0.92× (3 rulers) · core-hz 0.94× (3 rulers) · grails-ad 0.94× (3 rulers) · grails-ez 1.38× (3 rulers)
Baseline: dev/bench/jmh/<part>/indy/data.js on gh-pages, trailing 90 days. Daily dashboard · Per-suite raw data
…o `for await` hangs and the exception is dropped
0b0e2b3 to
570c912
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2987 +/- ##
==================================================
+ Coverage 72.4166% 72.4314% +0.0147%
- Complexity 40606 40631 +25
==================================================
Files 1643 1643
Lines 142633 142673 +40
Branches 26788 26796 +8
==================================================
+ Hits 103290 103340 +50
+ Misses 29850 29841 -9
+ Partials 9493 9492 -1
🚀 New features to boost your workflow:
|
|
|
Current solution borrows ideas from C#, it looks not very groovy, we can try to find better solution. using System.Threading.Channels;
var channel = Channel.CreateBounded<int>(2);
_ = Task.Run(async () =>
{
try
{
for (var i = 1; i <= 3; i++)
{
if (i == 3)
throw new InvalidOperationException("sensor failed");
await channel.Writer.WriteAsync(i * i);
}
channel.Writer.Complete();
}
catch (Exception failure)
{
channel.Writer.Complete(failure);
}
});
var seen = new List<int>();
try
{
await foreach (var value in channel.Reader.ReadAllAsync())
seen.Add(value);
}
catch (InvalidOperationException e)
{
Console.WriteLine(e.Message); // sensor failed
}
// seen == [1, 4] |
|
Here is the JavaScript solution: let n = 0;
const stream = new ReadableStream({
pull(controller) {
n += 1;
if (n === 3) {
controller.error(new Error('sensor failed')); // close with the cause
return;
}
controller.enqueue(n * n);
}
});
const seen = [];
try {
for await (const value of stream) {
seen.push(value);
}
} catch (failure) {
console.log(failure.message); // sensor failed
} |
✅ All tests passed ✅🏷️ Commit: 570c912 Learn more about TestLens at testlens.app/docs. |




https://issues.apache.org/jira/browse/GROOVY-12459