Skip to content

Add COMPOSER_MEMORY_LIMIT support to Symfony\Flex\ScriptExecutor #899

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

Closed
PabloKowalczyk opened this issue Apr 23, 2022 · 1 comment · Fixed by #911
Closed

Add COMPOSER_MEMORY_LIMIT support to Symfony\Flex\ScriptExecutor #899

PabloKowalczyk opened this issue Apr 23, 2022 · 1 comment · Fixed by #911

Comments

@PabloKowalczyk
Copy link
Contributor

Hello, this change will allow to define same memory limit for Composer and sub-processes run by ScriptExecutor. Any interest in this?
I can provide PR if you are interested.

@nicolas-grekas
Copy link
Member

Please send a PR if you are interested (that's how OSS work ;) )

theofidry added a commit to theofidry/flex that referenced this issue Oct 20, 2023
> [!WARNING]
> Note: this PR is more of draft. I am not confident I understand fully
the issue neither that this is the right fix (and I could not test it).
Do NOT assume this code just works.

After a lot of digging in box-project/box#988,
@maartendekeizer could identify the root of the issue.

My understanding is that Flex tries to detect if the current PHP process
was restarted by Composer and forwards its restarted settings to the
sub-processes it is going to launch. There is currently two things done:

- symfony#91 which if took code from SensioDistributionBundle.
- symfony#899 which kind of followed the suite.

    I suspect the mentioned code predates `composer/xdebug-handler`. Now
with this package, there is two things to take into account:

- The `composer/xdebug-handler` API is likely much safer, more robust
  and a lot less hacky to use.
- There is other applications that can restart a PHP process. As an
  example Box restarts the PHP process to be able to correct the
`phar.readonly` setting that cannot be changed at runtime. It matters as
the restarted process by be executing a Composer command.

As mentioned in the warning, I could not test this, not even run the
tests locally, so I would be careful about this PR. I just wanted to
give a base about a potential fix with context about the original issue
encountered.

On my side to not have to wait on Flex and avoid the users to have to
update it to have the fix, Box launches its Composer commands with
`COMPOSER_ORIGINAL_INIS=''` to avoid Flex to trigger this bad piece of
code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants