Open punkyard opened 2 months ago
I stumbled upon a similiar issue and just post my findings here instead of making a new bug report.
The issue is that postgres does not allow NUL bytes in TEXT fields, however, CustomPropertiesBackend uses serialize
to store non scalar values. Sabre's ResourceType has a private field in it, and serialize
documentation states:
Object's private members have the class name prepended to the member name; protected members have a '*' prepended to the member name. These prepended values have null bytes on either side.
Also,
Note that this is a binary string which may include null bytes, and needs to be stored and handled as such. For example, serialize() output should generally be stored in a BLOB field in a database, rather than a CHAR or TEXT field.
The problem now is that we try to store that serialized value as-is, which Postgres doesn't support. One way to fix it would be to store non-text values base64 encoded, or alternatively, change the type of propertyvalue
from TEXT to BLOB (or BYTEA) and store normal text as UTF-8 encoded blob and objects as-is.
Obviously this would require a database migration.
hi @joshtrichards thanks for your reply
I have looked at #37754 and it seems to be about column type when this issue here could be considered as a quantity error what do you think?
Also experiencing this issue. I'm running Nextcloud Hub 9 (30.0.0) though the docker image Nextcloud AIO v9.6.0.
I see the below message spammed a ton of times in my log, right after I added my subscribed to my Nextcloud calendar via URL to a Google calendar.
[PHP] Error: unserialize(): Error at offset 61 of 64 bytes at /var/www/html/apps/dav/lib/DAV/CustomPropertiesBackend.php#560
PROPFIND /remote.php/dav/calendars/[USER_REDACTED]/
from [IP_REDACTED] by [USER_REDACTED] at Oct 10, 2024, 7:13:59 PM
Also experiencing this issue. I'm running Nextcloud Hub 9 (30.0.0) though the docker image Nextcloud AIO v9.6.0.
I see the below message spammed a ton of times in my log, right after I added my subscribed to my Nextcloud calendar via URL to a Google calendar.
[PHP] Error: unserialize(): Error at offset 61 of 64 bytes at /var/www/html/apps/dav/lib/DAV/CustomPropertiesBackend.php#560 PROPFIND /remote.php/dav/calendars/[USER_REDACTED]/ from [IP_REDACTED] by [USER_REDACTED] at Oct 10, 2024, 7:13:59 PM
Same here, also on Hub 9 with Nextcloud AIO. I also have a Google Calendar subscription so that must be it. Calendar entries for that are showing up correctly tho
cc @miaulalala @SebastianKrupinski
Thanks for the heads up @susnux will have a look.
Can confirm this issue: [PHP] Error: unserialize(): Error at offset 61 of 64 bytes at /var/www/html/apps/dav/lib/DAV/CustomPropertiesBackend.php#560 PROPFIND /remote.php/dav/calendars/[USER]/ from [IP] by [USER] at 20 Nov 2024, 22:48:52
Running Hub9 30.0.2 version with Calendar 5.0.5 on TrueNas Scale 24.10 in docker with postgress
Hi @kabatp is there any more details on this error in the Nextcloud log?
@SebastianKrupinski all I can find is
{ "reqId": "jt9TMExds0xZthdCzsbl", "level": 3, "time": "2024-11-21T06:39:52+00:00", "remoteAddr": "REDACTED", "user": "REDACTED", "app": "PHP", "method": "PROPFIND", "url": "/remote.php/dav/calendars/REDACTED/", "message": "unserialize(): Error at offset 61 of 64 bytes at /var/www/html/apps/dav/lib/DAV/CustomPropertiesBackend.php#560", "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:132.0) Gecko/20100101 Firefox/132.0", "version": "30.0.2.2", "data": { "app": "PHP" }, "id": "673ed5b8f05f3" }
As far as I can tell the error started popping up when I tried to set up calendars and contacts. Contacts were manually migrated which means this should not be caused by VCF compatibility issues. Also, I tried to delete all calendars, but the error was still there which I am assuming the problem is with the contacts. The error shows circa every 30 seconds.
The error message points to:
private function decodeValueFromDatabase(string $value, int $valueType) {
switch ($valueType) {
case self::PROPERTY_TYPE_XML:
return new Complex($value);
case self::PROPERTY_TYPE_HREF:
return new Href($value);
case self::PROPERTY_TYPE_OBJECT:
return unserialize($value);
case self::PROPERTY_TYPE_STRING:
default:
return $value;
}
}
specifically to this part
case self::PROPERTY_TYPE_OBJECT:
return unserialize($value);
I have tried to play around in the database but couldn't find any data that could cause the issue. Also, this should not be a setup issue as it occurs only with added contacts - when I delete the contacts the issue is no longer there. All of the contacts have been manually created one by one which indicates bad handling of empty fields - as postgress is not good with handling NUL chars as mentioned in https://github.com/nextcloud/server/issues/37754#issuecomment-1589463097
@SebastianKrupinski I exported contacts from Nextcloud, deleted them and imported them back and it looks like the issue went away. I believe the export contains only fields that are filled which means the issue should be connected to the default fields that are shown in the GUI when creating contacts
@SebastianKrupinski I exported contacts from Nextcloud, deleted them and imported them back and it looks like the issue went away. I believe the export contains only fields that are filled which means the issue should be connected to the default fields that are shown in the GUI when creating contacts
I am taking back this statement as the issue reappeared after one hour after importing the contacts back
⚠️ This issue respects the following points: ⚠️
Bug description
Hi I would like to report a repeated error I can find in NC logs. I'm afraid I can't evaluate its consequences, many errors arrived at the same time: locked files, antivirus, SQL and redis server.
Steps to reproduce
find logs in NC Logging:
Expected behavior
no error
Nextcloud Server version
29
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.2
Web server
Nginx
Database engine version
PostgreSQL
Is this bug present after an update or on a fresh install?
Updated from a MINOR version (ex. 28.0.1 to 28.0.2)
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
Configuration report
No response
List of activated Apps
No response
Nextcloud Signing status
No response
Nextcloud Logs