schedule-bundle icon indicating copy to clipboard operation
schedule-bundle copied to clipboard

Multiple CommandTask memory issue

Open kbond opened this issue 5 years ago • 2 comments

I have found when multiple CommandTask's are due at the same time it can hit your PHP memory limit. I'm not sure what the best way to combat this is. Maybe running tasks in another process somehow?

There are two workarounds I have found:

  1. Wrap the commands in a process:

    # instead of
    - task: my:command
    
    # use
     - task: 'bash:bin/console my:command'
    

    This works but removes the ability to catch exceptions (task will still fail if an exception in the command is thrown).

    Also, your environment isn't passed to the command automatically like when running an actual CommandTask. You would need to pass it as an argument:

     - task: 'bash:bin/console my:command --env=prod'
    
  2. Ensure CommandTask's do not run at the same time. Even one minute difference in frequency solves the issue. The cron hash expressions can help with this. If using a CompoundTask to ensure tasks run in a specific order this gets more complex, you need split up the CompoundTask and schedule the tasks after each other giving enough time for the previous to complete.

kbond avatar Feb 14 '20 18:02 kbond

Hi Kevin I am not that good of a programmer but if I can test something or think with you no problem

parijke avatar Jul 15 '20 07:07 parijke

Thanks Paul, I don't have any ideas that don't require breaking architecture changes. I plan to revisit for 2.0.

I think the workarounds described above solve the problem but if you run into it and they don't, let me know!

kbond avatar Jul 16 '20 11:07 kbond