Skip to content

Static content deploy - Randomly css files not generated #22880

Closed
@ihor-sviziev

Description

@ihor-sviziev
Contributor

Preconditions (*)

  1. Magento 2.3.x(2.3-develop too)
  2. Configured Build system according to technical details.
  3. Create own theme that extends from Magento/luma
  4. Magento mode is default OR developer

Steps to reproduce (*)

  1. Run php bin/magento setup:static-content:deploy -f -j $(nproc) (-j 8 in my case) with 6 different locales on build system

Expected result (*)

  1. We should NOT have any errors/exceptions during SCD

Actual result (*)

  1. Randomly we have following issue (sometimes from 4-5th time):
  • Some CSS files are missing in pub/static directory
  • Exception somewhere in the middle of SCD

image

This happening really randomly, sometimes with Magento/luma theme, sometimes with our own
File with errors:
errors.txt

Technical details

During SCD - it tries to compile LESS -> CSS files. During working on it - it tries to create lock, add some files and then unlock:

$this->lockerProcess->lockProcess($this->lockName);
$module = $chain->getAsset()->getModule();
/** @var FallbackContext $context */
$context = $chain->getAsset()->getContext();
$chain->setContent($this->processContent($path, $content, $module, $context));
} finally {
$this->lockerProcess->unlockProcess();

Details of these locks:

public function lockProcess($lockName)
{
if ($this->getState()->getMode() == State::MODE_PRODUCTION) {
return;
}
$this->tmpDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::VAR_DIR);
$this->lockFilePath = $this->getFilePath($lockName);
while ($this->isProcessLocked()) {
usleep(1000);
}
$this->tmpDirectory->writeFile($this->lockFilePath, time());
}

and

public function unlockProcess()
{
if ($this->getState()->getMode() == State::MODE_PRODUCTION) {
return;
}
$this->tmpDirectory->delete($this->lockFilePath);
}

As you can see above - locking process doesn't work in production mode, but static contend deploy we're running when env.php file is not present, so by fallback it runs in "default" magento mode.

Also that's not expected to have some lock when we're running SCD in parallel, it might significantly slow down this process.

This issue was discovered during testing #22607

Activity

m2-assistant

m2-assistant commented on May 14, 2019

@m2-assistant

Hi @ihor-sviziev. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
    Information on your environment
    Steps to reproduce
    Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@ihor-sviziev do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • yes
    no

changed the title [-]Static content deploy - Randomly less files not generated[/-] [+]Static content deploy - Randomly css files not generated[/+] on May 14, 2019
added a commit that references this issue on May 24, 2019

magento#22880 Fix random fails during parallel SCD execution

63063bc
added a commit that references this issue on Jul 18, 2019

magento#22880 Fix random fails during parallel SCD execution

0f43b32
m2-assistant

m2-assistant commented on Aug 23, 2019

@m2-assistant

Hi @engcom-Charlie. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

    2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

    3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

    4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

    5. Add label Issue: Confirmed once verification is complete.

    6. Make sure that automatic system confirms that report has been added to the backlog.

11 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Component: Framework/LocaleComponent: ThemeFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @ihor-sviziev@magento-engcom-team@engcom-Charlie

      Issue actions

        Static content deploy - Randomly css files not generated · Issue #22880 · magento/magento2