Skip to content

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

Open
@mvn-bachhuynh-dn

Description

@mvn-bachhuynh-dn

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions