Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Long paths not working on CMF Windows Worker Agent #520

Open
moorec-aws opened this issue Jan 7, 2025 · 0 comments
Open

Bug: Long paths not working on CMF Windows Worker Agent #520

moorec-aws opened this issue Jan 7, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@moorec-aws
Copy link
Contributor

moorec-aws commented Jan 7, 2025

Describe Behaviour

The Windows Worker Agent on CMF when running in a service context (It's default behaviour) does not support long paths. This is due to pywin32 pythonservice.exe which is used to run the Worker Agent as a service not being long path aware.

Expected Behaviour

Long paths registry key is enabled on the host, and the Worker Agent can access scene files, assets and output files that are long paths.

Current Behaviour

Long paths registry key is enabled on the host, and the Worker Agent cannot access scene files, assets and output files that are long paths.

Here is an example of the Worker trying to do a job attachments sync where a long file path cannot be accessed.

Failed to sync job output attachments for sessionaction-25baa4e656d34dbbb573345667333235-1: [WinError 3] The system cannot find the path specified: 'C:\\ProgramData\\Amazon\\OpenJD\\session-25baa4e656d34dbbb57395ac1304356786746452\\assetroot-6b8e732a578945789643\\output_dir\\longpath_testoutput_4k_fibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibfibbo.exr.f307214C'

Reproduction Steps

Submit a job that uses a scene file, asset or output file that is 250 characters long.

Possible Solution

The path forward to work around this issue is to make the pythonservice.exe long path aware using an application manifest. We will use the mt.exe tool from Windows SDK to embed the longPathAware Windows setting into pythonservice.exe. To do this you need to make an additional modification during AMI creation.

Requirements:

  • Worker Agent is installed
  • Long Paths Registry Key is enabled.

Steps:

  1. Install Windows SDK using the installer.
    • Specifically install Windows SDK for Desktop C++ x86 Apps
  2. Go to the python installation location of your environment where the Worker Agent is installed (Default: C:\Program Files\Python311), there should be an executable there called pythonservice.exe
  3. Create a new file called pythonservice.exe.manifest in the same location and add the following contents:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity type="win32" name="pythonservice" processorArchitecture="x86" version="1.0.0.0"/>
  <application xmlns="urn:schemas-microsoft-com:asm.v3">
    <windowsSettings>
      <longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
    </windowsSettings>
  </application>
</assembly>
  1. Run the following command using command prompt with the path to pythonservice.exe.manifest :
"C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x86\mt.exe" -manifest pythonservice.exe.manifest -outputresource:pythonservice.exe;#1
  1. Expected return value:
Microsoft (R) Manifest Tool
Copyright (c) Microsoft Corporation.
All rights reserved.

The Worker should now be able to access long paths. At this point you can cleanup the pythonservice.exe.manifest file and the SDK installation and proceed with the AMI creation.

Package Version

deadline-cloud-worker-agent 0.22 or later

Language Version

Python 3.*

Dependencies

No response

Operating System

Windows

Other information

Upstream PyWin32 Issue: mhammond/pywin32#2455

@moorec-aws moorec-aws added the bug Something isn't working label Jan 7, 2025
@moorec-aws moorec-aws pinned this issue Jan 7, 2025
@erico-aws erico-aws unpinned this issue Jan 15, 2025
@erico-aws erico-aws pinned this issue Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant