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: LongPathsEnabled on Windows seems to be ignored, and results in read/write failure when paths > 256 chars. #84

Open
andymanaws opened this issue Nov 7, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@andymanaws
Copy link

Expected Behaviour

By enabling LongPathsEnabled on Windows you can utilise assets, and render outputs, that have >256 chars.

But renders via Deadline Cloud seem to throw errors regard file lengths exceeding 256 chars.

Current Behaviour

Job attachments assets will result in an error when syncing:

"your file path is longer than what Windows allow."

Output images fail to write in job attachments:

"Found 0 files (Output directory C:\ProgramData\Amazon\OpenJD\session-0fac1829f3cf4e848c2c18f474f8987e8oe..."

Reproduction Steps

Ensure Windows is configured correctly:
https://www.autodesk.com/support/technical/article/caas/sfdcarticles/sfdcarticles/The-Windows-10-default-path-length-limitation-MAX-PATH-is-256-characters.html

Use a texture that has a lot of characters - e.g. include

bobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbobbob

Set the output location to a folder which has >256 chars.

Render from the app - it works.
Render from Deadline - it fails.

Code Snippet

N/A

@andymanaws andymanaws added the bug Something isn't working label Nov 7, 2024
@karthikbekalp
Copy link
Contributor

Hmm, I believe there was a fix explicitly to notify customers when long paths are not enabled in https://github.com/aws-deadline/deadline-cloud/pull/403/files. @AlexTranAmz do you have any ideas why this could happen even if an instance is configured properly?

@karthikbekalp
Copy link
Contributor

Discussed with @AlexTranAmz, looks like we need to enable the long paths in the registry as well as add UNC paths (add \?\ to the start of the path instead of C:\ or D:).

@joel-wong-aws
Copy link
Contributor

I did an initial investigation of this issue. To my understanding, Cinema 4D itself does not support long paths. I have submitted a ticket to Maxon about this.

That said, our Deadline Cloud integration code exacerbates the problem in a couple ways:

  1. [Submitter side] Before submitting a job, we save the job's sticky settings to a file named <c4dfile>.deadline_render_settings.json, yielding
Traceback (most recent call last):
  File "C:\Users\testuser\DeadlineCloudSubmitter\Submitters\Cinema4D\deadline\client\ui\dialogs\submit_job_to_deadline_dialog.py", line 419, in on_submit
    self.on_create_job_bundle_callback(
  File "C:\Users\testuser\DeadlineCloudSubmitter\Submitters\Cinema4D\deadline\cinema4d_submitter\cinema4d_render_submitter.py", line 417, in on_create_job_bundle_callback
    settings.save_sticky_settings(Scene.name())
  File "C:\Users\testuser\DeadlineCloudSubmitter\Submitters\Cinema4D\deadline\cinema4d_submitter\data_classes.py", line 73, in save_sticky_settings
    with open(sticky_settings_filename, "w", encoding="utf8") as fh:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\testuser\\Documents\\C4D_Projects\\physical_textured123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890.deadline_render_settings.json'

The sticky settings file adds 27 characters.

  1. [Submitter side] The default job history directory attempts to save (and then reload) a manifest file, which has a length increase:
Traceback (most recent call last):
  File "C:\Users\testuser\DeadlineCloudSubmitter\Submitters\Cinema4D\deadline\client\ui\dialogs\submit_job_progress_dialog.py", line 386, in _upload_background_thread
    ).upload_assets(
      ^^^^^^^^^^^^^^
  File "C:\Users\testuser\DeadlineCloudSubmitter\Submitters\Cinema4D\deadline\job_attachments\upload.py", line 1286, in upload_assets
    (partial_manifest_key, asset_manifest_hash) = self.asset_uploader.upload_assets(
                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\testuser\DeadlineCloudSubmitter\Submitters\Cinema4D\deadline\job_attachments\upload.py", line 195, in upload_assets
    self._write_local_manifest(
  File "C:\Users\testuser\DeadlineCloudSubmitter\Submitters\Cinema4D\deadline\job_attachments\upload.py", line 253, in _write_local_manifest
    self._write_local_input_manifest(manifest_write_dir, manifest_name, manifest, root_dir_name)
  File "C:\Users\testuser\DeadlineCloudSubmitter\Submitters\Cinema4D\deadline\job_attachments\upload.py", line 274, in _write_local_input_manifest
    with open(local_manifest_file, "w") as file:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\testuser\\.deadline\\job_history\\testuser-test-farm\\2025-01\\2025-01-14-11-Cinema4D-physical_textured123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901\\manifests\\d2b2c3102af5a862db950a2e30255429_input'

This can add 40 or more characters to the file path, depending on the name of your monitor profile and the original file structure.

  1. [Adaptor side] If we get past this issue, the render will fail because the path

C:\Users\testuser\Documents\C4D_Projects\\physical_textured123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890.c4d

is mapped to

C:\ProgramData\Amazon\OpenJD\session-d04e4000a1754907bcb75289655c2a8ff_32sm7o\assetroot-7a6a0443639bf42cdffb\physical_textured123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890.c4d

This adds up to 109 characters to the file path (for mapped drives). In my example, it added ~70 characters.


Given all of this, we can take the following actions:

  1. Submit a ticket to Maxon to support long paths in Cinema 4D. This is the most durable solution, although it's not clear how quickly they could added this. I have submitted a support ticket to Maxon about this!
  2. Shorten the session directory on workers (addresses issue 3): this is a known issue which requires changes to the openjd-adaptor-runtime and possibly the deadline-worker-agent. We are tracking this issue.
  3. Improve the error messaging for long path errors (addresses issues 1 and 2).

@joel-wong-aws
Copy link
Contributor

Added two fixes:

I'm in communication with Maxon about adding support for long paths.

@joel-wong-aws
Copy link
Contributor

Here is the public Maxon forum post about long paths: https://developers.maxon.net/forum/topic/15966/cinema-4d-python-on-windows-long-path-errors/2

@joel-wong-aws
Copy link
Contributor

As described in point 2, shortening the session directory on workers is one way to help alleviate the long path issue. A PR has just been merged to make the session directory configurable, after which it can be shortened. For this to be used:

  1. deadline-cloud-worker-agent needs to be released
  2. A configuration change needs to be made:
    a) For service-managed fleets, we have backlogged a ticket to make a configuration change in Deadline Cloud to use a shorter session directory
    b) For customer-managed fleets, customers will have to manually make the configuration change

Note that while this will reduce the path length, it still won't fully solve the issue - the assets directory will still prefix C:\<shortdir>\session-d04e4000a1754907bcb75289655c2a8ff_32sm7o\assetroot-7a6a0443639bf42cdffb

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

3 participants