Clear cache command breaks deployment process #5864

Closed
opened 2026-01-22 15:20:28 +01:00 by admin · 2 comments
Owner

Originally created by @jkobus on GitHub (Jan 30, 2018).

Hello.

After merging the https://github.com/doctrine/doctrine2/pull/6655 my deployment script fails.
The problem is that the "doctrine:cache:clear-query" returns "1" if no cache entries were deleted.
I'm using deployer, therefore all exit codes > 0 are breaking the deployment process.

Exact cause of this is here:
https://github.com/doctrine/doctrine2/pull/6655/files#diff-6d7b81d245cae44e79534370561f1e5eR109

xxx@api-xxx-test:~$ php /home/xxx/releases/279/bin/console doctrine:cache:clear-query --env=prod --no-interaction

 // Clearing all Query cache entries                                                                                    

                                                                                                                        
 [ERROR] No cache entries were deleted.                                                                                 
                                                                                                                        

xxx@api-xxx-test:~$ echo $?
1

I think that having no cache entries to remove is not an error, therefore the exit code should be set to 0.

@OskarStark what was the reason to add there a non-zero exit code?

Possible workaround would be to supress error code returned from that command during deployment, but then, when a real problem occurs (memcached connection problem for example) I won't be able to see it.

Originally created by @jkobus on GitHub (Jan 30, 2018). Hello. After merging the https://github.com/doctrine/doctrine2/pull/6655 my deployment script fails. The problem is that the "doctrine:cache:clear-query" returns "1" if no cache entries were deleted. I'm using deployer, therefore all exit codes > 0 are breaking the deployment process. Exact cause of this is here: https://github.com/doctrine/doctrine2/pull/6655/files#diff-6d7b81d245cae44e79534370561f1e5eR109 ``` xxx@api-xxx-test:~$ php /home/xxx/releases/279/bin/console doctrine:cache:clear-query --env=prod --no-interaction // Clearing all Query cache entries [ERROR] No cache entries were deleted. xxx@api-xxx-test:~$ echo $? 1 ``` I think that `having no cache entries to remove` is not an error, therefore the exit code should be set to `0`. @OskarStark what was the reason to add there a non-zero exit code? Possible workaround would be to supress error code returned from that command during deployment, but then, when a real problem occurs (memcached connection problem for example) I won't be able to see it.
admin closed this issue 2026-01-22 15:20:29 +01:00
Author
Owner

@jkobus commented on GitHub (Jan 30, 2018):

Well it seems that memcached service was down so the exit code was correct.
After starting the memcached service command works fine.

I think that cache clearing commands could be more verbose about the failure reason.

@jkobus commented on GitHub (Jan 30, 2018): Well it seems that memcached service was down so the exit code was correct. After starting the memcached service command works fine. I think that cache clearing commands could be more verbose about the failure reason.
Author
Owner

@lcobucci commented on GitHub (Feb 17, 2018):

I think that cache clearing commands could be more verbose about the failure reason.

@jkobus please send a PR with your suggestion 👍

@lcobucci commented on GitHub (Feb 17, 2018): > I think that cache clearing commands could be more verbose about the failure reason. @jkobus please send a PR with your suggestion 👍
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5864