Repository navigation
Description
Windows Version
10.0.26300.9818
WSL Version
3.0.4.0 (WSLC also reports 3.0.4.0)
Are you using WSL 1 or WSL 2?
WSL 2
Kernel Version
6.18.54.1-microsoft-standard-WSL2
Distro Version
Ubuntu-26.04 for the native WSL comparison; the failing reproduction runs in WSLC.
Other Software
- Image:
mongo:9.0 - MongoDB version observed in WSLC reproduction:
9.0.4 - Docker Desktop succeeds in the comparison below; its version and backend were not captured.
Repro Steps
MongoDB fails during initialization when /data/db is bind-mounted to a Windows directory using WSLC. The equivalent Docker Desktop command succeeds using the same Windows directory and image tag.
Run in PowerShell:
$dir = [System.IO.Directory]::CreateTempSubdirectory('mongodb-repro-').FullName
# Fails
wslc run --rm --mount "type=bind,src=$dir,target=/data/db" mongo:9.0
# Works
docker run --rm --mount "type=bind,src=$dir,target=/data/db" mongo:9.0The Docker command runs until stopped manually. The failure reproduces without Aspire, authentication, TLS, published ports, custom MongoDB arguments, or entrypoint overrides.
Both commands select mongo:9.0; the exact image digests across the two runtimes were not compared.
Expected Behavior
MongoDB initializes successfully with the Windows-directory bind mount, as it does under Docker Desktop.
Actual Behavior
WSLC's MongoDB container fails during WiredTiger initialization:
/data/db/: directory-sync: fdatasync
Invalid argument (22)
WT_PANIC: WiredTiger library panic (-31804)
WSLC exits with code 139.
Additional isolation
A syscall probe shows that directory fdatasync() fails specifically on the WSLC Windows bind mount:
| Environment/storage | Directory fsync() |
Directory fdatasync() |
MongoDB |
|---|---|---|---|
| WSLC Windows bind mount, virtiofs | Succeeds | EINVAL | Fails |
| WSLC Linux-backed named volume, ext4 | Succeeds | Succeeds | Works |
| Native WSL2 Windows directory, 9p/DrvFs | Succeeds | Succeeds | Works |
| Docker Desktop Windows bind mount | Not independently probed | Not independently probed | Works |
Regular-file fdatasync() succeeds on the WSLC bind mount; the observed failure concerns directory handles.
The WSLC bind mount appears in /proc/mounts as:
drvfs /probe virtiofs rw,relatime 0 0
A minimal directory syscall probe, run with Python inside the environment being tested, is:
import os
fd = os.open('/probe', os.O_RDONLY)
try:
os.fdatasync(fd)
finally:
os.close(fd)Here /probe is the Windows-directory bind-mount destination. In WSLC it raises OSError: [Errno 22] Invalid argument; os.fsync(fd) succeeds on the same directory. Both calls succeed on an ext4 named volume and on the ordinary WSL2 9p Windows-drive mount.
The same MongoDB 9.0.4 executable also starts successfully when run natively in Ubuntu-26.04 with data under /mnt/c/temp, where the Windows drive uses 9p/DrvFs. Initial startup and a second startup against the same database directory both answer a MongoDB hello command successfully and shut down with exit code 0. This uses the same WSL kernel as the WSLC reproduction.
Related reports
- Mongodb fdatasync wrong in 20H1 #5207: historical WSL1 report of the identical directory
fdatasyncerror. - Operation not permitted on NTFS volumes docker-library/mongo#243 (comment): historical Docker-on-Windows report of the identical error.
These are historical precedents, not confirmed duplicates. Current Docker Desktop succeeds in the comparison above.
Workaround
Use a Linux-backed named volume for MongoDB data in WSLC instead of a Windows-directory bind mount.
Diagnostic Logs
The standalone WSLC reproduction emitted:
2026-11-01T20:19:14.090+00:00
WiredTiger error message
error: 22
msg: int __posix_sync(WT_SESSION_IMPL *, int, const char *, const char *):203:/data/db/: directory-sync: fdatasync
error_str: Invalid argument
error_code: 22
WiredTiger error message
error: -31804
msg: int __posix_sync(WT_SESSION_IMPL *, int, const char *, const char *):203:the process must exit and restart
error_str: WT_PANIC: WiredTiger library panic
error_code: -31804
WSL diagnostic tracing has not yet been collected.
Activity
github-actions commentedon Nov 1, 2026
Logs are required for review from WSL team
If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.
How to collect WSL logs
Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:
The script will output the path of the log file once done.
If this is a networking issue, please use
.\collect-wsl-logs.ps1 -LogProfile networkinginstead, following the instructions in Collect WSL logs for networking issuesOnce completed please upload the output files to this GitHub issue.
See Collect WSL logs (recommended method).
If you choose to email these logs instead of attaching them to the bug, please send them to [email protected] with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.
Support WSLc image publishing and finalize Windows test gates
afscrome commentedon Nov 1, 2026
WslLogs-2026-11-01_20-49-12.tar.gz
mongodb-wsl-traced-repro.log
github-actions commentedon Nov 1, 2026
Diagnostic information
shuaiyuanxx commentedon Nov 2, 2026
Thanks for the information. The trace confirms that WSLC’s virtiofs backend returns
EINVALfor directoryfdatasync()requests, while directoryfsync()and regular-filefdatasync()succeed.Source inspection and local reproduction point to the directory-sync handler reusing the regular-file data-only flush path (
NtFlushBuffersFileExwithFLUSH_FLAGS_FILE_DATA_ONLY). That call fails for directory handles on the tested NTFS system; the error is translated to EINVAL, triggering WiredTiger’s panic.The proposed fix is to use a full flush for directory sync requests, leaving regular-file behavior unchanged.
ggarzia-MSFT commentedon Nov 4, 2026
reopening because this is fixed in openvmm but wsl still uses an older build so the bug is still present
lxutil: allow fdatasync on directories on Windows (microsoft#4861)
Add WSLC test for virtiofs directory fdatasync (#42129) (#42145)
lxutil: allow fdatasync on directories on Windows (microsoft#4861)
Sync main branch and feature/openvmm (#42216)