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

Troubleshooting Guide: SQL Server Error 3935 – FILESTREAM Transaction Context Initialization Failure

Why This Error Happens

Error 3935 occurs when the SQL Server Database Engine cannot allocate a transaction context for a FILESTREAM operation, typically due to insufficient system resources such as memory, file handles, or NTFS filesystem contention on the FILESTREAM data container. This can also happen if the underlying volume hosting the FILESTREAM filegroup is low on disk space, experiencing I/O bottlenecks, or if the RPC/FSCTL communication between the SQL Server process and the Windows Filter Driver (RsFx driver) is being blocked or throttled. In some cases, antivirus or backup software locking files in the FILESTREAM container can also trigger this resource contention error.

Step-by-Step Resolution Guide

Step 1: Verify System Resource Availability

  • Open Task Manager or Performance Monitor on Windows Server 2025 / Windows 11 and check available Memory, Handle Count, and Disk Queue Length for the sqlservr.exe process.
  • Confirm the volume hosting the FILESTREAM filegroup (e.g., D:\SQLData\FileStreamContainer) has sufficient free space (at least 15-20% free is recommended).
  • Check Event Viewer under Windows Logs > System for disk or NTFS-related warnings coinciding with the error timestamp.

Step 2: Confirm RsFx Driver and FILESTREAM Configuration

  • Open SQL Server Configuration Manager and navigate to SQL Server Services.
  • Right-click your instance (e.g., MSSQLSERVER) and select Properties, then go to the FILESTREAM tab to confirm “Enable FILESTREAM for Transact-SQL access” and “Enable FILESTREAM for file I/O streaming access” are checked.
  • Run the following T-SQL to confirm the instance-level setting matches:
EXEC sp_configure 'filestream access level';
RECONFIGURE;
  • Ensure the value is set to 2 (full access) if remote client access is required.

Step 3: Exclude Antivirus and Backup Interference

  • Add an exclusion in Windows Defender (or third-party antivirus) for the FILESTREAM data container directory.
  • Use PowerShell to add the exclusion:
Add-MpPreference -ExclusionPath "D:\SQLData\FileStreamContainer"
  • Disable any third-party backup agents that may be actively scanning or locking files in the FILESTREAM folder during database activity.

Step 4: Increase Resource Limits and Restart Services

  • Check the “Max Worker Threads” and “Min Server Memory / Max Server Memory” settings in SQL Server to ensure the engine is not resource-starved:
EXEC sp_configure 'max worker threads';
EXEC sp_configure 'max server memory';
  • Restart the SQL Server service and the SQL Server FILESTREAM driver (RsFx) via Services.msc (SQL Server (MSSQLSERVER) and ensure dependent services restart cleanly).
  • If running in a virtualized environment, confirm the VM has not hit a memory ballooning or CPU ready-time constraint on the hypervisor.

Step 5: Rebuild or Check FILESTREAM Filegroup Integrity

  • Run DBCC CHECKDB with the DATA_PURITY option on the affected database to rule out corruption in the FILESTREAM filegroup:
DBCC CHECKDB ('YourDatabaseName') WITH DATA_PURITY;
  • If corruption is detected, restore from the last known good backup or rebuild the FILESTREAM filegroup container.

Alternative or Verification Steps

  • After applying the fixes, retry the original FILESTREAM transaction (e.g., an INSERT/UPDATE involving a FILESTREAM column) and confirm Error 3935 no longer appears in SQL Server Error Logs or Event Viewer.
  • As an alternative, if the issue persists under high concurrency, consider migrating large object storage to FileTable with a dedicated high-IOPS volume, or increase the TXCTX timeout via trace flag 1807 (test in a non-production environment first).