How to fix Error 3936 on Windows Server 2025 / Windows 11

Troubleshooting Guide: Error 3936 — FILESTREAM Data Flush Failure in SQL Server 2025

Why This Error Happens

Error 3936 occurs when SQL Server’s FILESTREAM filegroup is unable to flush buffered data to disk at the moment a transaction attempts to commit. This typically happens because a file handle to the FILESTREAM BLOB was still open by an external process or application thread, blocking the atomic commit operation. It can also stem from underlying disk I/O failures, insufficient NTFS permissions on the FILESTREAM data container, or antivirus/backup software locking files within the FILESTREAM directory.

Step-by-Step Resolution Guide

Step 1: Verify FILESTREAM File Handles Are Properly Closed

  • Ensure your application code uses SqlFileStream objects within a using block or explicitly calls .Close()/.Dispose() before the transaction commits.
  • Check for long-running System.IO.FileStream references pointing to the FILESTREAM data path (e.g., C:\SQLData\FileStreamStore\) that haven’t been released.
  • Review application logs for any exception swallowing that might prevent stream disposal in a finally block.

Step 2: Check Disk I/O Health and Storage Subsystem

  • Open Event Viewer on Windows Server 2025 and navigate to Windows Logs > System to look for Disk or NTFS warnings (Event ID 7, 11, or 51) around the same timestamp as the SQL error.
  • Run chkdsk C: /f /r (replace C: with the actual volume hosting the FILESTREAM filegroup) during a maintenance window to repair file system errors.
  • If using SAN/NAS storage, validate latency and connectivity using Get-PhysicalDisk | Get-StorageReliabilityCounter in PowerShell.

Step 3: Exclude FILESTREAM Directories from Antivirus and Backup Locks

  • Add an exclusion rule in Windows Defender or your third-party AV software for the FILESTREAM root path (e.g., C:\SQLData\FileStreamStore\*).
  • Disable real-time scanning on the .hdr and data container files used internally by FILESTREAM.
  • Confirm no third-party backup agent is holding an open handle on the filegroup folder during the SQL transaction window.

Step 4: Validate NTFS and Service Account Permissions

  • Right-click the FILESTREAM data folder, go to Properties > Security, and confirm the SQL Server service account has Full Control.
  • Run icacls "C:\SQLData\FileStreamStore" in an elevated Command Prompt to audit current permission entries.
  • Re-apply permissions if needed: icacls "C:\SQLData\FileStreamStore" /grant "NT SERVICE\MSSQLSERVER:(OI)(CI)F".

Step 5: Restart SQL Server and Clear Orphaned Locks

  • Restart the SQL Server service via services.msc or run net stop MSSQLSERVER && net start MSSQLSERVER in an elevated prompt.
  • This clears any orphaned file handles held in memory by the Database Engine’s FILESTREAM provider.

Alternative or Verification Steps

  • Re-run the original transaction that triggered Error 3936 and monitor sys.dm_tran_locks for any FILESTREAM-related lock escalation during the commit.
  • If the error persists, run DBCC CHECKFILEGROUP on the affected FILESTREAM filegroup to rule out corruption, and consider failing over to a standby replica if available to isolate whether the issue is storage-specific.