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

Error When Removing Static Content Area Frontend #69

Closed sprankhub closed 4 years ago

sprankhub commented 4 years ago

With version 1.0.20, I get an error when pressing F in order to remove the static content area frontend:

16:16:18 Key pressed: F
16:16:18 Removing static content area frontend
/var/www/shop/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:400
Kk.vb=!0,Kk.cb="cljs.core.async.impl.ioc-helpers/t_cljs$core$async$impl$ioc_helpers11717",Kk.Mb=function(a){return H(a,"cljs.core.async.impl.ioc-helpers/t_cljs$core$async$impl$ioc_helpers11717")};return new Kk(a,ue)}function Mk(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 Nk(a,b,c){c=Fk(c,Lk(function(c){a[2]=c;a[1]=b;return Mk(a)}));return t(c)?(a[2]=G(c),a[1]=b,oh):null}
                                                                                                                                                                                                                                                                                                                       ^

Error: ENOTEMPTY: directory not empty, rmdir '/var/www/shop/pub/static/frontend/shop/theme/de_DE/js'
    at Object.rmdirSync (fs.js:752:3)
    at Ii (/var/www/shop/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:348:269)
    at /var/www/shop/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:320:277
    at ed (/var/www/shop/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:103:138)
    at Xd.f.fa (/var/www/shop/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:126:104)
    at jb (/var/www/shop/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:104:349)
    at Fg (/var/www/shop/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:320:240)
    at Hi (/var/www/shop/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:348:222)
    at Ii (/var/www/shop/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:348:253)
    at /var/www/shop/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:320:277 {
  errno: -39,
  syscall: 'rmdir',
  code: 'ENOTEMPTY',
  path: '/var/www/shop/pub/static/frontend/shop/theme/de_DE/js'
}
Vinai commented 4 years ago

Thanks for finding another issue! Interesting, I can't easily reproduce the problem. Is there some other process that might be regenerating static assets while the watcher process recursively deletes them? Maybe a running browser request, or static content compilation, or a grunt/gulp/wtf process compiling css?

Vinai commented 4 years ago

Notes to myself: a possible solution would be to remove only files and keep directories in place. Then it wouldn't matter if a file is created (again) by another process at the same time.

Vinai commented 4 years ago

Implemented in release 1.0.21. Can you please check if you can still reproduce the issue after upgrading?

sprankhub commented 4 years ago

Sorry for bugging you again :-) And thanks again for the quick update!

To be honest, I also can't reproduce it right now. I was able to reproduce it once again, but not regularly. So it really seems to be somehow timing-related. However, no other process like gulp, grunt, whatever is running. Weird :/

Sorry that I cannot give you a clear confirmation, but I would consider it fixed for the time being. If I can reproduce it with the latest version again, I will let you know!

Vinai commented 4 years ago

Thanks for the feedback. In any way, it should no longer occur, since now only files are removed and directories remain empty (except for sub directories).

seyuf commented 3 years ago

Hi there, I just ran into similar issue on the latest version of the module v1.0.42 . I have not idea what's going on, i'll try to reproduce the error later in the mean time @Vinai could you reopen this? Or may be should i open a new issue being that my case is not related to to static assets, let me know

17:20:48 Cleaning cache type(s) config
fs.js:114
    throw err;
    ^

Error: ENOTEMPTY: directory not empty, rmdir '/var/www/magento/mad-shop/magento/var/cache/mage--8'
    at Object.rmdirSync (fs.js:684:3)
    at dj (/var/www/magento/mad-shop/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:348:269)
    at /var/www/magento/mad-shop/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:321:275
    at ud (/var/www/magento/mad-shop/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:101:186)
    at me.g.ea (/var/www/magento/mad-shop/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:124:104)
    at tb (/var/www/magento/mad-shop/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:102:350)
    at Rg (/var/www/magento/mad-shop/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:321:238)
    at cj (/var/www/magento/mad-shop/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:348:222)
    at Ck.g.jb (/var/www/magento/mad-shop/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:385:433)
    at Uj (/var/www/magento/mad-shop/magento/vendor/mage2tv/magento-cache-clean/bin/cache-clean.js:367:43)