Redis unserialize error setupdeploy
In Adobe Commerce, running the setup:static-content:deploy command triggers a Redis unserialize error when parallel processes interfere with the Redis connection during static content deployment. This issue interrupts deployment and returns unserialize and Redis connection errors. To fix this issue, run static content deployment in single-thread mode to prevent parallel Redis access conflicts.
Description description
Affected versions
- Adobe Commerce on-premises: 2.1.2 and later
- Adobe Commerce on cloud infrastructure 2.1.2 and later
- Redis, any version
Issue/Symptoms
Running the setup:static-content:deploy command causes the Redis error:
)
[ 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
Cause
The issue is caused by parallel interfering processes on the Redis connection.
Here, a process in App/Config/Type/System.php was expecting a response for system_cache_exists that was made by a different process. See the detailed explanation in Jason Woods’ post.
Resolution resolution
Disable parallelism and run setup:static-content:deploy in a single-thread mode by setting the following environment variable:
STATIC_CONTENT_THREADS=1
You may also run the setup:static-content:deploy command followed by the -j 1 (or --jobs=1) argument.
Note: In the single-thread mode, the static content deployment process may take four times longer.
Related reading
In our developer documentation: