Web interface text editor error

Issue creating text files from the web interface, editing is ok and everything else works.

Steps to reproduce

  1. login owncloud
  2. go to the “+” sign to create a .txt file

Expected behavior

create a file when going to the “+” text file menu

Actual behavior

error: cannot create file
Sometimes a file is shown afterwards in the files list in owncloud, but there is an error when trying to open it.
Error in the logs:

owncloud_ssl_error.log:4:[Wed May 19 11:19:28.812021 2021] [php7:notice] [pid 8904] [client 192.168.xx.xx:xxxx] 
{"reqId":"xxxxxxxxxxxxxxx","level":1,"time":"May 19, 2021 11:19:28","remoteAddr":"192.168.xxx.xxx","user":"xxxxx","app":"core","method":"PUT","url":"/remote.php/dav/files/xxxxx/test96.txt","message":"cleaning stray exclusive locks for files/xxxxxxxxxxxxxxxxxxxxx"}

And from browser logs:

"client.js?v=xxxxxxxxxxxxxxxxxxxxxx PUT https://xxxxxx/remote.php/dav/files/xxxxxxx/test96.txt 500 (Internal Server Error)"
And
<d:errorxmlns:d="DAV:"xmlns:s="http://sabredav.org/ns">
<s:exception>
Doctrine\DBAL\Exception\DriverException
</s:exception>
<s:message>
An exception occurred while executing 'SELECT "fileid", "storage", "path", "parent", "name", "mimetype", "mimepart", "size", "mtime",
"storage_mtime", "encrypted", "etag", "permissions", "checksum"
FROM "oc_filecache" WHERE "storage" = ? AND "path_hash" = ?' with params [5, "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"]:SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block
</s:message>
</d:error>"

Server configuration

Operating system:
Debian 10
Web server:
Apache 2.4.25
Database:
postgres 9.6
PHP version:
7.3
ownCloud version: (see ownCloud admin page)
10.7
Updated from an older ownCloud or fresh install:
yes from 10.5 deb to 10.7 tgz

Are you using encryption: yes/no
yes
Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/…
openid

Client configuration

Browser:
Safari, Chrome, Firefox, Opera
Operating system:
Linux, OSX

So far I tried to clear the redis cache and checked the files access rights on the server

hi @remd

I can see that your DB send and error:

SQLSTATE[25P02]: In failed sql transaction

I’m not a Postgres expert, but it looks like there is no grant on the tables, could you check your permits in the database?

Thanks for the suggestion!
It seems that the grant rights are fine, user owncloud is granted access on the owncloud db (and everything seems to be working other than creating files from the web interface)

 owncloud   | owncloud | UTF8     | en_US.utf8  | en_US.UTF-8 | =Tc/owncloud           +
            |          |          |             |             | owncloud=CTc/owncloud

And access rights to the table shown in the error:

 public | oc_filecache                             | table    | postgres=xxxxxx/postgres+|                   | 
        |                                          |          | owncloud=xxxxx/postgres |

forgot to mention I also tried to running occ files:scan and occ files:cleanup and reinstall the text editor app but that didnt help

After running the files scan, do you get some errors in the log file?

no errors in the logs after the file scan and same errors when trying to create a text file after the scan

We are using the master key encryption option, it has been working fine and is still working fine for everything except creating text files from the web interface maybe
Some more logs:
"
{“reqId”:“xxxxxxxxxxxxxxxxx”,“level”:0,“time”:“May 17, 2021 15:31:08”,“remoteAddr”:“192.168.xxx.xxx”,“user”:“user”,“app”:“core”,“method”:“PUT”,“url”:"/remote.php/dav/files/user/test2/test33.txt",“message”:“Exception while scanning file “files_encryption/keys/files/test2/test33.txt/OC_DEFAULT_MODULE”: An exception occurred while executing ‘UPDATE “oc_filecache” SET “mimepart” = ?, “mimetype” = ?, “mtime” = ?, “size” = ?, “etag” = ?, “storage_mtime” = ?, “permissions” = ?, “checksum” = ?, “parent” = ?, “path_hash” = ?, “path” = ?, “name” = ?, “storage” = ? WHERE (“storage” = ‘5’) AND (“path_hash” = ‘xxxxxxxxxxxxxxxxxxxxxxxx’)’ with params [3, 8, xxxxx, false, “xxxxxx”, xxxxxx, 27, “”, xxxxx, “xxxxxxxxxxxxxxxxxxxxxxxx”, “files_encryption\/keys\/files\/test2\/test33.txt\/OC_DEFAULT_MODULE”, “OC_DEFAULT_MODULE”, 5]:\n\nSQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: “””}
{“reqId”:“xxxxxxxxxxxxx”,“level”:2,“time”:“May 17, 2021 15:31:08”,“remoteAddr”:“192.168.xxx.xxx”,“user”:“user”,“app”:“core”,“method”:“PUT”,“url”:"/remote.php/dav/files/user/test2/test33.txt",“message”:“ignoring lock release with type 1 for files/xxxxxxxxxxxxxxxxxxxxxxx. Lock hasn’t been acquired before”}
{“reqId”:“xxxxxxxxxxxxxxxxxxxxx”,“level”:4,“time”:“May 17, 2021 15:31:08”,“remoteAddr”:“192.168.xxx.xxx”,“user”:“user”,“app”:“webdav”,“method”:“PUT”,“url”:"/remote.php/dav/files/user/test2/test33.txt",“message”:"Exception: An exception occurred while executing 'SELECT “fileid”, “storage”, “path”, “parent”, “name”, “mimetype”, “mimepart”, “size”, “mtime”,\n\t\t\t\t\t “storage_mtime”, “encrypted”, “etag”, “permissions”, “checksum”\n\t\t\t\tFROM “oc_filecache” WHERE “storage” = ?

{“reqId”:“xxxxxxxxxxxxxxxxxxx”,“level”:4,“time”:“May 17, 2021 15:31:08”,“remoteAddr”:“192.168.xxx.xxx”,“user”:“user”,“app”:“webdav”,“method”:“PUT”,“url”:"/remote.php/dav/files/user/test2/test33.txt",“message”:“Exception: An exception occurred while executing ‘SELECT “fileid”, “storage”, “path”, “parent”, “name”, “mimetype”, “mimepart”, “size”, “mtime”,\n\t\t\t\t\t “storage_mtime”, “encrypted”, “etag”, “permissions”, “checksum”\n\t\t\t\tFROM “oc_filecache” WHERE “storage” = ? AND “path_hash” = ?’ with params [5, “xxxxxxxxxxxxxxxxxxxxxx”]:\n\nSQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block: {“Exception”:“Doctrine\\DBAL\\Exception\\DriverException”,“Message”:“An exception occurred while executing ‘SELECT \“fileid\”, \“storage\”, \“path\”, \“parent\”, \“name\”, \“mimetype\”, \“mimepart\”, \“size\”, \“mtime\”,\n\t\t\t\t\t \“storage_mtime\”, \“encrypted\”, \“etag\”, \“permissions\”, \“checksum\”\n\t\t\t\tFROM \“oc_filecache\” WHERE \“storage\” = ? AND \“path_hash\” = ?’ with params [5, \“xxxxxxxxxxxxxxxxxxx\”]:\n\nSQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block”,“Code”:0,“Trace”:”#0 \/var\/www\/owncloud\/lib\/composer\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/DBALException.php(172): Doctrine\\DBAL\\Driver\\AbstractPostgreSQLDriver->convertException(‘An exception oc…’, Object(Doctrine\\DBAL\\Driver\\PDOException))\n#1 \/var\/www\/owncloud\/lib\/composer\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/DBALException.php(151): Doctrine\\DBAL\\DBALException::wrapException(Object(Doctrine\\DBAL\\Driver\\PDOPgSql\\Driver), Object(Doctrine\\DBAL\\Driver\\PDOException), ‘An exception oc…’)\n#2 \/var\/www\/owncloud\/lib\/composer\/doctrine\/dbal\/lib\/Doctrine\/DBAL\/Connection.php(918): Doctrine\\DBAL\\DBALException::driverExceptionDuringQuery(Object(Doctrine\\DBAL\\Driver\\PDOPgSql\\Driver), Object(Doctrine\\DBAL\\Driver\\PDOException), ‘SELECT \“fileid\”…’, Array)\n#3 \/var\/www\/owncloud\/lib\/private\/DB\/Connection.php(187): Doctrine\\DBAL\\Connection->executeQuery(‘SELECT \“fileid\”…’, Array, Array, NULL)
"