microsoft / microsoft/windows-container-tools

[BUG] Access Violation (Exception code: 0xc0000005) when running LogMonitor.exe

Open
#199 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
277
Forks
77
PR merge metrics
No merged PRs in 30d

Description

Description:

The application LogMonitor.exe crashes with an Access Violation (Exception code: 0xc0000005) when executed. The issue prevents the application from running properly, and it exits with exit code 3221225477 or 3221225786.

Steps to Reproduce:
1. Use the following Dockerfile to build the Windows Container image:

FROM mcr.microsoft.com/dotnet/framework/sdk:4.8.1-20240709-windowsservercore-ltsc2022 AS build-env
...
...
# Install IIS Management Service
RUN powershell -Command "Install-WindowsFeature -name Web-Mgmt-Service"

# Set necessary folder permissions so that error logs can go into this folder
RUN powershell.exe -Command \
    $path = 'C:\\inetpub\\wwwroot\\App_Data'; \
    if (!(Test-Path $path)) { New-Item -Path $path -ItemType Directory }; \
    icacls $path /grant 'IIS_IUSRS:(OI)(CI)F' /T;

# Set necessary folder permissions because the app uses this folder to save files
RUN powershell.exe -Command \
    $path = 'C:\\inetpub\\wwwroot'; \
    if (!(Test-Path $path)) { New-Item -Path $path -ItemType Directory }; \
    icacls $path /grant 'IIS_IUSRS:(OI)(CI)F' /T;

# Set permission to the App folder for IIS_IUSRS and ISS_APPPOOL
RUN powershell.exe -Command \
    $path = 'C:\\inetpub\\wwwroot'; \
    icacls $path /grant 'IIS_IUSRS:(OI)(CI)F' /T; \
    icacls $path /grant 'IIS APPPOOL\DefaultAppPool:(OI)(CI)F' /T

# Configure logging to stdout
RUN powershell.exe -Command \
    $path = 'C:\\LogMonitor'; \
    if (!(Test-Path $path)) { New-Item -Path $path -ItemType Directory }; \
    Invoke-WebRequest -Uri https://github.com/microsoft/windows-container-tools/releases/download/v2.1.0/LogMonitor.exe -OutFile C:\\LogMonitor\\LogMonitor.exe

COPY OFIS/LogMonitorConfig.json C:\\LogMonitor\\LogMonitorConfig.json

# Ensure that LogMonitor has appropriate permissions
RUN powershell.exe -Command \
    icacls C:\\LogMonitor\\LogMonitor.exe /grant 'IIS_IUSRS:F' /T; \
    icacls C:\\LogMonitor\\LogMonitorConfig.json /grant 'IIS_IUSRS:F' /T

ENTRYPOINT  ["C:\\LogMonitor\\LogMonitor.exe", "powershell.exe"]

CMD ["powershell.exe -ExecutionPolicy Bypass -File C:\\inetpub\\wwwroot\\run.ps1"]

EXPOSE 80
2.	Build the Docker image and push it to your container registry:
3. 	Deploy the container to an ECS EC2 cluster with the following settings:
•	Use a Windows Server AMI.
•	Configure the ECS task to run the container with the exposed port 80.
4.	Observe the behavior. The container fails to start and exits with an Access Violation (Exception code: 0xc0000005), as shown in the Event Viewer logs.

Expected Behavior:

The application should run without crashing and perform its intended functionality.

Actual Behavior:

The application crashes immediately with an Access Violation (Exception code: 0xc0000005). Below is the relevant Event Viewer log:

Faulting application name: LogMonitor.exe, version: 2.1.0.0, time stamp: 0x66c8553b
Faulting module name: LogMonitor.exe, version: 2.1.0.0, time stamp: 0x66c8553b
Exception code: 0xc0000005
Fault offset: 0x000000000007a34d
Faulting process id: 0x1424
Faulting application start time: 0x01db67141733791b
Faulting application path: C:\LogMonitor\LogMonitor.exe
Faulting module path: C:\LogMonitor\LogMonitor.exe
Report Id: 768f00eb-5314-4a69-a91d-3b72fb83d76c

Environment :
• OS: Windows Server Core 2022 (64-bit)
• Application Version: LogMonitor.exe v2.1.0.0
• Runtime Dependencies:
• .NET Framework 4.8
• C++ Redistributable (2015-2022)
• System Specifications:
• CPU: Intel Xeon E5-2678 v4
• RAM: 16 GB
• Disk Space: 50 GB free

Additional Context:
• Crash dump: A crash dump was generated for this issue and can be shared if needed.
• Steps attempted to resolve the issue:
1. Reinstalled the application.
2. Verified dependencies (all runtime libraries are installed and up-to-date).
3. Ran the application with administrative privileges.
4. Checked for corrupted files or missing permissions in the application directory.

If additional logs or crash dumps are required, I can provide them upon request.

Attachments:
1. Screenshot of the Event Viewer log.

Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the crash with the provided Dockerfile and LogMonitor.exe v2.1.0 on Windows Server Core 2022, then inspect the Event Viewer details and available crash dump. Compare the container configuration and runtime dependencies with the failing startup path. Done means the container starts and LogMonitor.exe no longer exits with an access violation.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, docker
Domain
operating-systems, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.