mage2tv / magento-cache-clean

A faster drop in replacement for bin/magento cache:clean with file watcher
BSD 3-Clause "New" or "Revised" License
527 stars 61 forks source link

2.4 Compatibility #77

Closed Stepa4man closed 3 years ago

Stepa4man commented 4 years ago

image Magento CE(2.4-develop)+EE(2.4-develop)+B2B(1.2-develop)+MSI(1.2-develop) Ubuntu 18.04.4 LTS

Vinai commented 4 years ago

Hi @Stepa4man, thanks for opening the issue. Can you please update to the latest version 1.0.27 or newer and see if the issue still persists?

gjportegies commented 4 years ago

I'm running version 1.0.28 on a Magento 2.3.5-p1 instance and getting the same error. Didn't figure out how to fix yet.

Watcher initialized (Ctrl-C to quit)
13:41:48 Flushing all caches
/Users/<name>/Development/<project-name>/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:404
$k.vb=!0,$k.cb="cljs.core.async.impl.ioc-helpers/t_cljs$core$async$impl$ioc_helpers11717",$k.Mb=function(a){return H(a,"cljs.core.async.impl.ioc-helpers/t_cljs$core$async$impl$ioc_helpers11717")};return new $k(a,ve)}function bl(a){try{var b=a[0];return b.a?b.a(a):b.call(null,a)}catch(c){if(c instanceof Object)throw b=c,a[6].ub(null),b;throw c;}}function cl(a,b,c){c=Vk(c,al(function(c){a[2]=c;a[1]=b;return bl(a)}));return t(c)?(a[2]=G(c),a[1]=b,rh):null}
                                                                                                                                                                                                                                                                                                                       ^

TypeError: Cannot read property 'substring' of null
Vinai commented 4 years ago

Thank you to both of you. Can you please run the command with the -vv flag and paste the output into this thread?

Thanks, Vinai

gjportegies commented 4 years ago

Thank you for making this tool!

vendor/bin/cache-clean.js --watch -vv

Watcher initialized (Ctrl-C to quit)
14:46:01 Key pressed: f
14:46:01 Cleaning cache type(s) full_page
14:46:01 Using :page_cache cache backend
Reading app config by shelling out to php
14:46:01 Calculated default cache ID prefix 192_ from /Users/<name>/Development/<project-name>/app/etc/
14:46:01 Cache storage  {:backend \Magento\Framework\Cache\Backend\Redis, :backend_options {:server 127.0.0.1, :port 6379, :database 1, :compress_data 0}, :id_prefix 192_}
/Users/<name>/Development/<project-name>/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:404
$k.vb=!0,$k.cb="cljs.core.async.impl.ioc-helpers/t_cljs$core$async$impl$ioc_helpers11717",$k.Mb=function(a){return H(a,"cljs.core.async.impl.ioc-helpers/t_cljs$core$async$impl$ioc_helpers11717")};return new $k(a,ve)}function bl(a){try{var b=a[0];return b.a?b.a(a):b.call(null,a)}catch(c){if(c instanceof Object)throw b=c,a[6].ub(null),b;throw c;}}function cl(a,b,c){c=Vk(c,al(function(c){a[2]=c;a[1]=b;return bl(a)}));return t(c)?(a[2]=G(c),a[1]=b,rh):null}
                                                                                                                                                                                                                                                                                                                       ^

TypeError: Cannot read property 'substring' of null
gjportegies commented 4 years ago

Hmm found the reason. I'm using the [new redis cache implementation].(https://devdocs.magento.com/guides/v2.3/config-guide/redis/redis-pg-cache.html#new-redis-cache-implementation)

    'cache' => [
        'frontend' => [
            'default' => [
                'backend' => '\\Magento\\Framework\\Cache\\Backend\\Redis',
                'backend_options' => [
                    'server' => '127.0.0.1',
                    'database' => '0',
                    'port' => '6379'
                ]
            ],
            'page_cache' => [
                'backend' => '\\Magento\\Framework\\Cache\\Backend\\Redis',
                'backend_options' => [
                    'server' => '127.0.0.1',
                    'port' => '6379',
                    'database' => '1',
                    'compress_data' => '0'
                ]
            ]
        ]
    ],
Stepa4man commented 4 years ago

Exactly the same reason. I'm using new implementation as well. And yes it's reproducible with 1.0.28

Vinai commented 4 years ago

Thanks for digging that up! Will look into it :)

Vinai commented 4 years ago

Please install release 1.0.29 and see if that fixes the issue for you. I did a quick test and it seems to work with the new Redis cache backend class, but I would appreciate your feedback on this.

composer g require mage2tv/magento-cache-clean:1.0.29
gjportegies commented 4 years ago

@Vinai just tested and it's working again! Big thanks!

Vinai commented 4 years ago

Thanks for letting me know!

pczerkas commented 3 years ago

Hello, the same error shows up when using RemoteSynchronizedCache

'cache' => [
    'frontend' => [
        'default' => [
            'id_prefix' => '061_',
            'backend' => '\\Magento\\Framework\\Cache\\Backend\\RemoteSynchronizedCache',
            'backend_options' => [
                'remote_backend' => '\\Magento\\Framework\\Cache\\Backend\\Redis',
                'remote_backend_options' => [
                    'persistent' => 0,
                    'server' => '127.0.0.1',
                    'port' => '6379',
                    'password' => '',
                    'database' => '11',
                    'compress_data' => '1',
                    'compression_lib' => 'gzip',
                    'preload_keys' => [
                        '061_GLOBAL_PLUGIN_LIST:hash',
                        '061_GLOBAL_WEBAPI_REST_PLUGIN_LIST:hash',
                        '061_GLOBAL__RESOURCESCACHE:hash',
                        '061_EXTENSION_ATTRIBUTES_CONFIG:hash',
                        '061_SYSTEM_DEFAULT:hash',
                        '061_EAV_ENTITY_TYPES:hash',
                        '061_GLOBAL__EVENT_CONFIG_CACHE:hash',
                        '061_SYSTEM_STORES_DEFAULT:hash',
                        '061_DB_IS_UP_TO_DATE:hash'
                    ]
                ],
                'local_backend' => 'Cm_Cache_Backend_File',
                'local_backend_options' => [
                    'cache_dir' => '/dev/shm/',
                    'file_name_prefix' => 'pc'
                ]
            ],
            'frontend_options' => [
                'write_control' => false
            ]
        ],
        'page_cache' => [
            'id_prefix' => '061_',
            'backend' => '\\Magento\\Framework\\Cache\\Backend\\Redis',
            'backend_options' => [
                'server' => '127.0.0.1',
                'port' => '6379',
                'password' => '',
                'database' => '11',
                'compress_data' => '0'
            ],
            'frontend_options' => [
                'write_control' => false
            ]
        ]
    ],
    'type' => [
        'default' => [
            'frontend' => 'default'
        ]
    ]
],
Vinai commented 3 years ago

Hi @pczerkas thanks for your report! Unfortunately I missed it because the issue was already closed. I'm reopening the issue now. Probably best to open a new issue in future... Please expect a new release fixing the problem later today.

Vinai commented 3 years ago

Hi @pczerkas,

I've implemented the backend and gave it a little spin, but since I don't work with the remote synchronized backend during development I would like to ask you to give it a try before I create a release including that feature.

To install the dev build, you can use the following commands (assuming you have installed cache-clean.js globally:

composer g remove --dev mage2tv/magento-cache-clean
composer g require --dev mage2tv/magento-cache-clean:dev-remote-synchronized-backend

After this, you can confirm composer pulled the correct version by running cache-clean.js --version, which should give you

Release 1.0.32 sponsored by https://www.mage2.tv

1.0.32

If you find any issues please let me know. Should there be no response, or in case you don't want to due to reasons, I'll release it in a couple of days nevertheless.

Note to myself for future reference:
https://github.com/mage2tv/magento-cache-clean/blob/remote-synchronized-backend/src/cache/storage/remote_synchronized.cljs

Vinai commented 3 years ago

After working with this release for a few days, everything LGTM. Prepping a release now.

pczerkas commented 3 years ago

Thank you Vinai, it works correctly.

Vinai commented 3 years ago

@pczerkas Thanks for following up on this and letting me know!