PSQL ERROR duplicate key value violates unique constraint : oc_file_locks

I did just install nextcloud on my archlinux server. I am using postgresql and uwsgi. Here is list of installed packages:
nextcloud 15.0.4-1
postgresql 11.1-3
php 7.3.2-1
php-pgsql 7.3.2-1
uwsgi 2.0.18-1
uwsgi-plugin-php 2.0.18-1

Everytime I upload file or files I am getting several error messages in journal. For upload one file I get 4 times following output:

postgres[554]: 2019-02-18 20:07:12.312 CET [5110] ERROR:  duplicate key value violates unique constraint "lock_key_index"
postgres[554]: 2019-02-18 20:07:12.312 CET [5110] DETAIL:  Key (key)=(files/400cc953a3e9981fad972cd0d650dbd3) already exists.
postgres[554]: 2019-02-18 20:07:12.312 CET [5110] STATEMENT:  INSERT INTO "oc_file_locks" ("key", "lock", "ttl") VALUES($1, $2, $3)

Same error I get when deleting or rename file.

Already trying to find what is the problem, but I could not find any help.
Thank you for any tip and help.

I did configure NC to connect to PSQL over unix socket. I did think that it could be a problem.
SO I did change that to (using standart port).

but error is still there

In reality should not change anything because it only defines the database access but doesn’t effect file locking within Nextcloud. Have you searched the issue tracker to find a solution for your problem? Especially the mentioned locking problem has already been reported in one or the other way, like e.g. As far as I can see one recommendation is e.g. to install and use Redis for file locking.

well, I did find several locking problems but not with table oc_file_locks so thank you for pointing me to that thread.

I did disable APC cache and using only opcache. Problem is still there.
now I am getting message “No memory cache has been configured. To enhance performance, please configure a memcache, if available. Further information can be found in the [documentation]”(

OK I will try redis. I assume that I should use redis instead APC not together, right?

thank you

I would use both caches, as described in this example

I did install redis and configure it to used only unix socket.

sudo redis-cli -s /run/redis/redis.sock ping

I did add these line into my config of nextcloud

'filelocking.enabled' => true,
'memcache.local' => '\OC\Memcache\APCu',
//'memcache.distributed' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array (
     'host' => '/run/redis/redis.sock',
     'port' => 0,
     'timeout' => 0.0,

I did restat uwsgi@nextcloud.service but still getting errors from postgresql about duplicate key.

if I am uncomment memcache.distributed option from config
I am getting this error in webbrowser

Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

and I am not know where I am doing a mistake.
thank you for any help and tip

finally I did find a problem, I did enable php-redis modul in uwsgi config

php-set = extension=redis