summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-02-25 12:23:38 -0500
committerBen Gamari <ben@smart-cactus.org>2021-03-01 10:11:39 -0500
commit2628d61fb84674b8b891f4ad79837e61d7c65421 (patch)
treea88c2b353b60e7c887d6a2c63dc33fb830370e57
parent915daf51357175fcc31a37c0aaf2347875560269 (diff)
downloadhaskell-2628d61fb84674b8b891f4ad79837e61d7c65421.tar.gz
rts/eventlog: Ensure that all capability buffers are flushed
The previous approach performed the flush in yieldCapability. However, as pointed out in #19435, this is wrong as it idle capabilities will not go through this codepath. The fix is simple: undo the optimisation, flushing in `flushEventLog` by calling `flushAllCapsEventsBufs` after acquiring all capabilities. Fixes #19435.
-rw-r--r--rts/Capability.c2
-rw-r--r--rts/eventlog/EventLog.c1
2 files changed, 2 insertions, 1 deletions
diff --git a/rts/Capability.c b/rts/Capability.c
index c3ef3929d9..136a62a71e 100644
--- a/rts/Capability.c
+++ b/rts/Capability.c
@@ -982,7 +982,7 @@ yieldCapability
break;
case SYNC_FLUSH_EVENT_LOG:
- flushLocalEventsBuf(cap);
+ /* N.B. the actual flushing is performed by flushEventLog */
break;
default:
diff --git a/rts/eventlog/EventLog.c b/rts/eventlog/EventLog.c
index 8aeea789e6..ba374a71a5 100644
--- a/rts/eventlog/EventLog.c
+++ b/rts/eventlog/EventLog.c
@@ -1665,6 +1665,7 @@ void flushEventLog(Capability **cap USED_IF_THREADS)
#if defined(THREADED_RTS)
Task *task = getMyTask();
stopAllCapabilitiesWith(cap, task, SYNC_FLUSH_EVENT_LOG);
+ flushAllCapsEventsBufs();
releaseAllCapabilities(n_capabilities, cap ? *cap : NULL, task);
#endif
flushEventLogWriter();