Redis未序列化錯誤setup:static-content:deploy
本文提供執行magento setup:static-content:deploy
時Redis非序列化錯誤的修正。
執行magento setup:static-content:deploy
導致Redis錯誤:
[Exception]
Notice: unserialize(): Error at offset 0 of 1 bytes in
/var/www/domain.com/vendor/magento/module-config/App/Config/Type/System.php on line 214
問題是由平行干擾Redis連線上的程式所造成。
若要解決,請設定下列環境變數,以單一執行緒模式執行setup:static-content:deploy
:
STATIC_CONTENT_THREADS =1
或者,執行setup:static-content:deploy
命令,後接-j 1
(或--jobs=1
)引數。
請注意,停用多執行緒會減慢部署靜態資產的程式。
受影響的版本
- Adobe Commerce內部部署: 2.1.2和更新版本
- 雲端基礎結構上的Adobe Commerce 2.1.2和更新版本
- Redis,任何版本
問題
執行setup:static-content:deploy
命令導致Redis錯誤:
)
[2017-06-02 19:57:59] Command:php ./bin/magento setup:static-content:deploy --jobs=3 en_US
[Exception]
Notice: unserialize(): Error at offset 0 of 1 bytes in /app/<domain>/vendor/magento/module-config/App/Config/Type/System.php
on line 214
.....
[CredisException]
read error on connection
[RedisException]
read error on connection
.....
[Exception]
Notice: unserialize(): Error at offset 0 of 1 bytes in /app/<domain>/vendor/magento/module-config/App/Config/Type/System.php
on line 214
.....
[RuntimeException]
Command php ./bin/magento setup:static-content:deploy --jobs=3 en_US returned code 3
原因
此問題是由平行干擾Redis連線上的程式所造成。
在這裡,App/Config/Type/System.php
中的處理程式預期system_defaultweb
的回應,但收到其他處理程式對system_cache_exists
所做的回應。 檢視Jason Woods貼文中的詳細說明。
解決方案
透過設定下列環境變數,停用平行處理並以單一執行緒模式執行setup:static-content:deploy
:
STATIC_CONTENT_THREADS =1
您也可以執行setup:static-content:deploy
命令,後接-j 1
(或--jobs=1
)引數。
NOTE
在單執行緒模式中,靜態內容部署程式可能需要四倍長的時間。
更多資訊
在我們的開發人員檔案中:
recommendation-more-help
8bd06ef0-b3d5-4137-b74e-d7b00485808a