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]: Error with composer create-project #591

Closed
blankse opened this issue Jul 4, 2024 · 17 comments · Fixed by #603
Closed

[Bug]: Error with composer create-project #591

blankse opened this issue Jul 4, 2024 · 17 comments · Fixed by #603

Comments

@blankse
Copy link
Contributor

blankse commented Jul 4, 2024

Expected behavior

No error

Actual behavior

Error:
An exception occurred in the driver: SQLSTATE[HY000] [2002] No such file or directory

Steps to reproduce

Execute as described in the README:
COMPOSER_MEMORY_LIMIT=-1 composer create-project pimcore/demo my-project

@blankse blankse added the Bug label Jul 4, 2024
@blankse
Copy link
Contributor Author

blankse commented Jul 4, 2024

After debugging, it seems that the GenericExecutionEngineBundle needs a DB connection. However, the connection will be configured in the step ./vendor/bin/pimcore-install.

In this step an error occurs because the MkdirCacheWarmer was not executed. The temp directory is not created, and the requirement check is failing:
php: ../../magick/exception.c:1121: ThrowMagickExceptionList: Assertion `exception != (ExceptionInfo *) NULL' failed.

So the error should be since this PR #583

@mcop1 Can you look into this?

@fashxp
Copy link
Member

fashxp commented Jul 4, 2024

Hmm ... as far as we understand this, do we have following situation:
Doctrine ORM needs a DB connection during cache:clear when server_version is not known to it - at least sometimes.
Right now, composer create project runs the scripts defined in composer.json, which contains cache:clear the command.

For the tests we solved it like here: https://github.com/pimcore/demo/pull/583/files#diff-d7b672fd527bb6f82ceb3c23b6f417911c595d020f4a14aac07cad73936dbf0cR66-R101

Any better solutions are highly appreciated.

@blankse
Copy link
Contributor Author

blankse commented Jul 22, 2024

@fashxp Can we set a server_version? So that composer create-project is possible again. I think the installer should then set the correct server_version anyway.

@fashxp
Copy link
Member

fashxp commented Jul 22, 2024

If this is working, I have no idea to be honest...

@kmpm
Copy link

kmpm commented Oct 10, 2024

Is there any available workaround to this?
It is somewhat frustrating to not even getting past the installation step of the "Getting started" guide.

@fashxp
Copy link
Member

fashxp commented Oct 10, 2024

Just continue with pimcore installation, should work

@kingjia90
Copy link
Contributor

The workaround is to run the command with "--no-install" and then run "composer install"

@kmpm
Copy link

kmpm commented Oct 11, 2024

--no-install + compose install does not work.
The compose install step generates the same error.
Just continuing after create-project works or running create-project with --no-script seem to work.

@kingjia90
Copy link
Contributor

kingjia90 commented Oct 21, 2024

Wasn't able to find the exact source of the problem other than the fact that the GenericExecutionEngine uses Entities, while it is not used in other "older" bundles.

I've opened a PR #603 that potentially works around this error by doing --no-script as suggested and confirmed by @kmpm

@fashxp Can we set a server_version? So that composer create-project is possible again. I think the installer should then set the correct server_version anyway.

That was a viable alternative, probably for the demo, we could put a placeholder value since we kind of have "control" over which image will be used and which server_version would likely be

@kingjia90 kingjia90 added this to the 2024.3.1 milestone Oct 21, 2024
@brusch
Copy link
Member

brusch commented Oct 22, 2024

@blankse when setting server_version in config, there's no auto-detection anymore, afaik.

Basically it's caused by bundles using the doctrine db service, instead of Pimcore\Db::get() that we used as a workaround in the past (see https://github.com/search?q=org%3Apimcore+Db%3A%3Aget%28%29&type=code&p=2) .
But to be honest, I'd prefer to separate out cache:clear or maybe even remove all scripts from composer.json and ask the user to run the commands manually. I'd assume this also makes debugging easier in case something goes wrong, when the commands are not wrapped / triggered by another one.

@blankse
Copy link
Contributor Author

blankse commented Oct 22, 2024

@brusch @kingjia90 But you cannot run pimcore-install without first running cache:clear (because you need the temp directory from the MkdirCacheWarmer). Otherwise, I get this error: php: ../../magick/exception.c:1121: ThrowMagickExceptionList: Assertion 'exception != (ExceptionInfo *) NULL' failed. However, cache:clear requires the database, but the database is configured by pimcore-install. It's a classic chicken-and-egg problem.

@kingjia90
Copy link
Contributor

kingjia90 commented Oct 22, 2024

@blankse Thank you for the feedback, but weird, i don't encounter that mentioned issue with magick

docker run -u `id -u`:`id -g` --rm -v `pwd`:/var/www/html pimcore/pimcore:php8.3-latest composer create-project --no-scripts pimcore/demo:dev-workaround-create-project my-temp-project

and

cd my-temp-project/; docker compose up -d;
docker compose exec php bin/console assets:install --symlink --relative;docker compose exec php vendor/bin/pimcore-install --mysql-host-socket=db --mysql-username=pimcore --mysql-password=pimcore --mysql-database=pimcore

Image

@blankse
Copy link
Contributor Author

blankse commented Oct 22, 2024

@kingjia90 Ok, than it is a Imagick specific error. I use ddev and there the docker image. There this imagick version is used:
Image

This error is also reported in Gitter:
https://matrix.to/#/!gdGFKKpLPNuNeXpFJY:gitter.im/$tAb2heXgAIaIS88qZacuZ9hncla7pY_yDcJMFdIU5qE?via=gitter.im&via=matrix.org&via=matrix.freyachat.eu

@kingjia90
Copy link
Contributor

kingjia90 commented Oct 22, 2024

Ah i see, tried ddev (btw didn't about it, and now i love it 😄 ) and could reproduce the same situation, after ddev . mkdir ./var/tmp, the pimcore-install would work, then i'd say that the installer should be creating these folder from the warmup, if they are somehow required for the Tools/Requirement check or skip it for imagick on install (as it's optional and not mandatory)? 🤔

@brusch
Copy link
Member

brusch commented Oct 23, 2024

@kingjia90 agree, the installer should tackle this as well and should create all necessary directories👍

@kingjia90
Copy link
Contributor

With pimcore/pimcore#17767 seems working fine

Tested by running

mkdir ddevtest;
cd ddevtest/;
ddev config --auto;
ddev composer create --no-scripts  pimcore/demo:dev-createproject;
ddev . vendor/bin/pimcore-install --mysql-host-socket=db --mysql-username=db --mysql-password=db --mysql-database=db;

@kingjia90
Copy link
Contributor

Closing as resolved by #603
The other issue related to imagick will be resolved in the Core

Thank you all again

@kingjia90 kingjia90 linked a pull request Oct 28, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants