dotnet/runtime · warning
WARNING: [Logger::LogVprintf] Failed to flush log file. GetL
Error message
WARNING: [Logger::LogVprintf] Failed to flush log file. GetLastError()=%u\n
What it means
In SuperPMI's shared Logger::LogVprintf, after a log line is written with WriteFile the logger calls FlushFileBuffers(s_logFile) to force it to disk. If the flush fails the logger only emits this WARNING with GetLastError() and continues; logging is best-effort and never throws. It signals that subsequent log lines may be buffered or lost.
Source
Thrown at src/coreclr/tools/superpmi/superpmi-shared/logging.cpp:294
const char* timeStr = "";
#endif // TARGET_UNIX
const char logEntryFmtStr[] = "%s - %s [%s:%d] - %s - %s\r\n";
size_t logEntryBuffSize = sizeof(logEntryFmtStr) + strlen(timeStr) + strlen(function) + strlen(file) + /* line number */ 10 +
strlen(logLevelStr) + strlen(fullMsg);
char* logEntry = new char[logEntryBuffSize];
sprintf_s(logEntry, logEntryBuffSize, logEntryFmtStr, timeStr, function, file, line, logLevelStr, fullMsg);
size_t logEntryLen = strlen(logEntry);
DWORD bytesWritten;
if (!WriteFile(s_logFile, logEntry, (DWORD)logEntryLen, &bytesWritten, nullptr))
fprintf(stderr, "WARNING: [Logger::LogVprintf] Failed to write to log file. GetLastError()=%u\n",
GetLastError());
if (!FlushFileBuffers(s_logFile))
fprintf(stderr, "WARNING: [Logger::LogVprintf] Failed to flush log file. GetLastError()=%u\n",
GetLastError());
delete[] logEntry;
#ifndef TARGET_UNIX
free((void*)timeStr);
#endif // !TARGET_UNIX
}
#ifndef TARGET_UNIX
CleanUp:
#endif // !TARGET_UNIX
minipal_mutex_leave(&s_critSec);
delete[] fullMsg;
}
//View on GitHub (pinned to 60108ba66e)
Solutions
- Point SuperPMIShimLogPath at a local disk with ample free space.
- Free disk space / raise quota on the log volume and restart the SuperPMI run.
- Disable or move antivirus/backup that locks the log file during the run.
- If warnings are non-fatal, ignore them but re-run on a healthy disk to get complete logs.
Defensive patterns
Strategy: validation
Validate before calling
// Before a SuperPMI run, check the log path is healthy.
#include <sys/statvfs.h>
static bool LogPathHealthy(const char* dir) {
struct statvfs s;
if (statvfs(dir, &s) != 0) return false;
unsigned long freeMb = (s.f_bavail * (s.f_frsize ?: 1)) >> 20;
return freeMb > 100; // require >100MB free
} Prevention
- Point SuperPMIShimLogPath at a local disk with generous free space.
- Monitor disk usage during long SuperPMI runs; .mch files grow large.
- Exclude the log directory from AV/backup scans that lock handles.
- Treat the WARNING as non-fatal but re-run on a healthy disk for complete logs.
When it happens
Trigger: The SuperPMI log file lives on a volume that fails FlushFileBuffers: disk full/quota hit, removable/network drive disconnected, file truncated/deleted underneath the handle, or the handle became invalid after an I/O error. Windows reports the reason via GetLastError.
Common situations: Logging to a network share that dropped; /tmp filled by a large .mch method-context file while SuperPMIShimLogPath points at the same volume; antivirus/backup locking the log handle; running on a CI agent whose workspace is cleaned mid-run.
Related errors
- Unable to find MinGit asset for arch '{arch}'. Available ass
- Comparison failed for the following files(s): {}
- Couldn't determine current git hash
- Couldn't determine newest 'main' git hash
- Couldn't determine baseline git hash
AI-assisted analysis of dotnet/runtime@60108ba66e (2026-08-10).
Data as JSON: /api/errors/5152b69175e7c59d.
Report an issue: GitHub.