Flamenco Render via Blender Cloud Add-on causes Python crash on Windows #52161

Closed
opened 2017-07-23 16:39:08 +02:00 by Stefan Grassberger · 8 comments

System Information
System 1: Windows 10 64-bit GeForce GTX 660
System 2: Windows 10 64-bit GeForce 940MX

Blender Version
Broken: 2.78b 3c04373 (System 1) and 2.78c e92f235283 (System 2)
Blender Cloud Add-on 1.7.2

Short description of error

After clicking on "Render on Flamenco",
I get "Flamenco is packing your files + dependencies" and after a few seconds, "Python has stopped working"
Command prompt output is:

    INFO:THREE:Executing 'C:\Program Files\Blender Foundation\Blender\2.78\python\bin\python.EXE' -m bam.pack --input 'C:\Projects\BlenderRenderTests\test123.flamenco.blend' --output 'C:\rendertest\storage\2017-07-23-120254.010332-stefan.grassberger-test123.flamenco\test123.flamenco.blend' --mode FILE
    INFO:THREE:Using wheel C:\Users\StevyGee\AppData\Roaming\Blender Foundation\Blender\2.78\scripts\addons\blender_cloud\wheels\blender_bam-1.1.7-py3-none-any.whl to run BAM-Pack
    INFO:THREE:  Fatal Python error: Failed to initialize Windows random API (CryptoGen)
    INFO:THREE:The process stopped with status code 3221226505
    ERROR:THREE:Unable to execute BAM pack
    Traceback (most recent call last):
      File "C:\Users\StevyGee\AppData\Roaming\Blender Foundation\Blender\2.78\scripts\addons\blender_cloud\flamenco\__init__.py", line 341, in bam_pack
        missing_sources = await bam_interface.bam_copy(filepath, outfile, exclusion_filter)
      File "C:\Users\StevyGee\AppData\Roaming\Blender Foundation\Blender\2.78\scripts\addons\blender_cloud\flamenco\bam_interface.py", line 122, in bam_copy
        raise CommandExecutionError('Process stopped with status %i' % proc.returncode)
    blender_cloud.flamenco.bam_interface.CommandExecutionError: Process stopped with status 3221226505
    DEBUG:THREE:Stopping async task
    INFO:THREE:Signalling that we want to cancel anything that's running.
    Error: Unable to execute BAM pack: Process stopped with status 3221226505

This happens with any scene.

Possible fix

After some googling, I found out it's apparantly a Windows specific issue related to the SYSTEMROOT variable that needs to be set.
Inspired by this fix , I came up with my own (starting at line 79 in bam_interface.py of Blender Cloud add-on):

    env = {
        str('PYTHONPATH'): pythonpath,
        # Needed on Windows because http://bugs.python.org/issue8557
        str('PATH'): os.environ['PATH'],
    }
    if 'SYSTEMROOT' in os.environ:  # Windows http://bugs.python.org/issue20614
        env[str('SYSTEMROOT')] = os.environ['SYSTEMROOT']

    proc = await asyncio.create_subprocess_exec(
        *args,
        env=env,
        stdin=subprocess.DEVNULL,
        stdout=subprocess.PIPE,
        stderr=subprocess.STDOUT,
    )

and also on line 59:

    import os

The packing then seems to work! Note that I haven't coded Python before today, but figured maybe I can help.

Exact steps for others to reproduce the error

  • Configure Blender Cloud Add-on (select Manager, Project, as well as Storage and Output directories)
  • Open attached scene

In Render Window click Render on Flamenco

test123.blend

**System Information** System 1: Windows 10 64-bit GeForce GTX 660 System 2: Windows 10 64-bit GeForce 940MX **Blender Version** Broken: 2.78b 3c04373 (System 1) and 2.78c e92f235283 (System 2) Blender Cloud Add-on 1.7.2 **Short description of error** After clicking on "Render on Flamenco", I get "Flamenco is packing your files + dependencies" and after a few seconds, "Python has stopped working" Command prompt output is: ``` INFO:THREE:Executing 'C:\Program Files\Blender Foundation\Blender\2.78\python\bin\python.EXE' -m bam.pack --input 'C:\Projects\BlenderRenderTests\test123.flamenco.blend' --output 'C:\rendertest\storage\2017-07-23-120254.010332-stefan.grassberger-test123.flamenco\test123.flamenco.blend' --mode FILE INFO:THREE:Using wheel C:\Users\StevyGee\AppData\Roaming\Blender Foundation\Blender\2.78\scripts\addons\blender_cloud\wheels\blender_bam-1.1.7-py3-none-any.whl to run BAM-Pack INFO:THREE: Fatal Python error: Failed to initialize Windows random API (CryptoGen) INFO:THREE:The process stopped with status code 3221226505 ERROR:THREE:Unable to execute BAM pack Traceback (most recent call last): File "C:\Users\StevyGee\AppData\Roaming\Blender Foundation\Blender\2.78\scripts\addons\blender_cloud\flamenco\__init__.py", line 341, in bam_pack missing_sources = await bam_interface.bam_copy(filepath, outfile, exclusion_filter) File "C:\Users\StevyGee\AppData\Roaming\Blender Foundation\Blender\2.78\scripts\addons\blender_cloud\flamenco\bam_interface.py", line 122, in bam_copy raise CommandExecutionError('Process stopped with status %i' % proc.returncode) blender_cloud.flamenco.bam_interface.CommandExecutionError: Process stopped with status 3221226505 DEBUG:THREE:Stopping async task INFO:THREE:Signalling that we want to cancel anything that's running. Error: Unable to execute BAM pack: Process stopped with status 3221226505 ``` This happens with any scene. **Possible fix** After some googling, I found out it's apparantly a Windows specific issue related to the SYSTEMROOT variable that needs to be set. Inspired by [this fix ](https://github.com/django/django/commit/cef3f805c21c029d017e6704565f9f2f5746a1e5), I came up with my own (starting at line 79 in bam_interface.py of Blender Cloud add-on): ``` env = { str('PYTHONPATH'): pythonpath, # Needed on Windows because http://bugs.python.org/issue8557 str('PATH'): os.environ['PATH'], } if 'SYSTEMROOT' in os.environ: # Windows http://bugs.python.org/issue20614 env[str('SYSTEMROOT')] = os.environ['SYSTEMROOT'] proc = await asyncio.create_subprocess_exec( *args, env=env, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, ) ``` and also on line 59: ``` import os ``` The packing then seems to work! Note that I haven't coded Python before today, but figured maybe I can help. **Exact steps for others to reproduce the error** - Configure Blender Cloud Add-on (select Manager, Project, as well as Storage and Output directories) - Open attached scene # In Render Window click Render on Flamenco [test123.blend](https://archive.blender.org/developer/F676359/test123.blend)

Changed status to: 'Open'

Changed status to: 'Open'

Added subscriber: @stevygee

Added subscriber: @stevygee

Added subscribers: @fsiddi, @dr.sybren, @Sergey

Added subscribers: @fsiddi, @dr.sybren, @Sergey

@fsiddi or @dr.sybren, mind having a look? Thanks!

@fsiddi or @dr.sybren, mind having a look? Thanks!

Added subscriber: @FrankMees

Added subscriber: @FrankMees

Removed subscriber: @FrankMees

Removed subscriber: @FrankMees

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Sybren A. Stüvel self-assigned this 2017-08-08 15:05:52 +02:00

Solved in 66ddc7b47b94 and released as version 1.7.3 this morning.

Solved in 66ddc7b47b94 and released as version 1.7.3 this morning.
Sign in to join this conversation.
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#52161
No description provided.