Description

When a commandlet is run it successfully completes but does not terminate the engine correctly. It appears that multiple requests are made to terminate the engine process these subsequent engine termination requests result in an access violation and a thrown exception.

To avoid this the following can be added to the constuctor of the Commandlet: ```UseCommandletResultAsExitCode = true;
FastExit = true;```

Steps to Reproduce

1. Create a Commandlet.
2. Package the project for the Windows platform.
3. Create a powershell script to run the commandlet to enable redirection of the standard output pipe.
4. Add the following to the powershell script
`$process = Start-Process -FilePath <Location_to_Packaged_Build.exe> -ArgumentList “-run=<CommandletName>” -Wait -PassThru -RedirectStandardOutput "log.txt"

Write-Host "Process Exit Code: $($process.ExitCode)"
`
3. Execute the powershell script from within a powershell console.
4. Observe the Commandlet console window appear.
5. Wait for the Commandlet to complete and the console window to be dismissed.
6. Observe the exit code -1073741819 printed in the powershell console window.
6. Open the log file from RedirectStandardOutput location.
7. Observe the WindowsPlatformCrashContext.EngineUnhandledExceptionFilter exception messages in the log file.

Callstack

LogIoDispatcher: Display: Reading toc: ../../../SampleApp/Content/Paks/global.utoc
LogIoDispatcher: Display: Toc loaded : ../../../SampleApp/Content/Paks/global.utoc, Id=ffffffffffffffff, Order=0, EntryCount=1, SignatureHash=0000000000000000000000000000000000000000
LogIoDispatcher: Display: Mounting container '../../../SampleApp/Content/Paks/global.utoc' in location slot 0
LogPakFile: Display: Initialized I/O dispatcher file backend. Mounted the global container: ../../../SampleApp/Content/Paks/global.utoc
LogPakFile: Display: Found Pak file ../../../SampleApp/Content/Paks/SampleApp-Windows.pak attempting to mount.
LogPakFile: Display: Mounting pak file ../../../SampleApp/Content/Paks/SampleApp-Windows.pak.
LogIoDispatcher: Display: Reading toc: ../../../SampleApp/Content/Paks/SampleApp-Windows.utoc
LogIoDispatcher: Display: Toc loaded : ../../../SampleApp/Content/Paks/SampleApp-Windows.utoc, Id=227843cbe3f64313, Order=4, EntryCount=1936, SignatureHash=0000000000000000000000000000000000000000
LogIoDispatcher: Display: Mounting container '../../../SampleApp/Content/Paks/SampleApp-Windows.utoc' in location slot 0
LogPakFile: Display: Mounted IoStore container "../../../SampleApp/Content/Paks/SampleApp-Windows.utoc"
LogPakFile: Display: Mounted Pak file '../../../SampleApp/Content/Paks/SampleApp-Windows.pak', mount point: '../../../'
RenderDocPlugin: Display: RenderDoc plugin will not be loaded. Use '-AttachRenderDoc' on the cmd line or enable 'renderdoc.AutoAttach' in the plugin settings.
LogStreaming: Display: AsyncLoading2 - Created: Event Driven Loader: false, Async Loading Thread: true, Async Post Load: true
LogStreaming: Display: AsyncLoading2 - Initialized
LogHAL: Display: Platform has ~ 126 GB [134910402560 / 137438953472 / 126], which maps to Largest [LargestMinGB=32, LargerMinGB=12, DefaultMinGB=8, SmallerMinGB=6, SmallestMinGB=0)
LogCsvProfiler: Display: Metadata set : extradevelopmentmemorymb="0"
LogStreaming: Display: FlushAsyncLoading(1): 1 QueuedPackages, 0 AsyncPackages
[2025.04.08-21.16.44:729][ 0]LogStreaming: Display: FlushAsyncLoading(1): 1 QueuedPackages, 0 AsyncPackages
LogDeviceProfileManager: Display: Deviceprofile LinuxArm64Editor not found.
LogDeviceProfileManager: Display: Deviceprofile LinuxArm64 not found.
[2025.04.08-21.16.44:731][ 0]LogDeviceProfileManager: Display: Deviceprofile LinuxArm64Editor not found.
[2025.04.08-21.16.44:731][ 0]LogDeviceProfileManager: Display: Deviceprofile LinuxArm64 not found.
LogCsvProfiler: Display: Metadata set : deviceprofile="Windows"
[2025.04.08-21.16.44:732][ 0]LogCsvProfiler: Display: Metadata set : deviceprofile="Windows"
LogAudioCaptureCore: Display: No Audio Capture implementations found. Audio input will be silent.
LogAudioCaptureCore: Display: No Audio Capture implementations found. Audio input will be silent.
[2025.04.08-21.16.44:760][ 0]LogAudioCaptureCore: Display: No Audio Capture implementations found. Audio input will be silent.
[2025.04.08-21.16.44:760][ 0]LogAudioCaptureCore: Display: No Audio Capture implementations found. Audio input will be silent.
LogMetaSound: Display: MetaSound Page Target Initialized to 'Default'
[2025.04.08-21.16.44:764][ 0]LogMetaSound: Display: MetaSound Page Target Initialized to 'Default'
LogAudio: Display: Registering Engine Module Parameter Interfaces...
[2025.04.08-21.16.44:929][ 0]LogAudio: Display: Registering Engine Module Parameter Interfaces...
LogStreaming: Display: AsyncLoading2 - NotifyRegistrationComplete: Registered 26778 public script object entries (695.98 KB)
[2025.04.08-21.16.44:942][ 0]LogStreaming: Display: AsyncLoading2 - NotifyRegistrationComplete: Registered 26778 public script object entries (695.98 KB)
LogStreaming: Display: AsyncLoading2 - Thread Started: true, IsInitialLoad: false
[2025.04.08-21.16.44:942][ 0]LogStreaming: Display: AsyncLoading2 - Thread Started: true, IsInitialLoad: false
LogCsvProfiler: Display: Metadata set : largeworldcoordinates="1"
[2025.04.08-21.16.45:081][ 0]LogCsvProfiler: Display: Metadata set : largeworldcoordinates="1"
LogInit: Display: Game Engine Initialized.
[2025.04.08-21.16.45:091][ 0]LogInit: Display: Game Engine Initialized.
LogCommandletPlugin: Display: Hello world!
LogInit: Display:
[2025.04.08-21.16.45:099][ 0]LogCommandletPlugin: Display: Hello world!
LogInit: Display: Success - 0 error(s), 0 warning(s)
[2025.04.08-21.16.45:105][ 0]LogInit: Display:
LogInit: Display:

Execution of commandlet took: 0.01 seconds
[2025.04.08-21.16.45:111][ 0]LogInit: Display: Success - 0 error(s), 0 warning(s)
LogInit: Display: PreExit Game.
[2025.04.08-21.16.45:119][ 0]LogInit: Display:

Execution of commandlet took: 0.01 seconds
[2025.04.08-21.16.45:128][ 0]LogInit: Display: PreExit Game.
FPlatformMisc::RequestExit(1, WindowsPlatformCrashContext.EngineUnhandledExceptionFilter)
FPlatformMisc::RequestExit(1, WindowsPlatformCrashContext.EngineUnhandledExceptionFilter)FPlatformMisc::RequestExitWithStatus(1, 3, WindowsPlatformCrashContext.EngineUnhandledExceptionFilter)
FPlatformMisc::RequestExitWithStatus(1, 3, WindowsPlatformCrashContext.EngineUnhandledExceptionFilter)Engine exit requested (reason: Win RequestExit; note: exit was already requested)
Engine exit requested (reason: Win RequestExit; note: exit was already requested)

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-268607 in the post.

0
Login to Vote

Unresolved
ComponentUE - Foundation
Affects Versions5.5.4
CreatedApr 9, 2025
UpdatedApr 10, 2025
View Jira Issue