Table oc_cards may have corrupted entries

expert
mysql
oc-internals

#1

Steps to reproduce
1. Check table oc_cards, mine has 1125 entries and a size of 118.1 MiB.
2. Sort table by size and check carddata column for big blobs.

Expected behaviour
Shouldn't the table entries be smaller in size and have only one PHOTO key?

Actual behaviour
Column carddata in some entries have duplicate PHOTO keys increasing the blob size, ~10 MiB.

Server configuration
Operating system: Debian GNU/Linux 8.2 (jessie)
Web server: Apache2 2.4.10-10+deb8u4
Database: MySQL 5.5.44-0+deb8u1
PHP version: 5.6.20+dfsg-0+deb8u1
ownCloud version (see ownCloud admin page): 9.0.0
Updated from an older ownCloud or fresh install: updated from 8.2

Special configuration (external storage, external authentication, reverse proxy, server-side-encryption): IMAP authentication

Info about the table oc_cards:
Table name: oc_cards
Entries: 1125
Size: 118.1 MiB

Some entries are too large, carddata column with a blob of about 10 Mb, inside it there are lots of repeated 'PHOTO' keys.

BEGIN:VCARD
VERSION:3.0
PRODID:-//Sabre//Sabre VObject 3.5.0//EN
UID:***@***
FN:***\, ***
N:***;***\,;***;;
EMAIL;TYPE=OTHER:***@***
CLOUD:***@***@***
PHOTO;ENCODING=b;TYPE=image/jpeg:/9j/4AAQ...
PHOTO;ENCODING=b;TYPE=image/jpeg:/9j/4AAQ...
PHOTO;ENCODING=b;TYPE=image/jpeg:/9j/4AAQ...
...

Some questions I ask myself:
1. Is it normal to have duplicate PHOTO items?
2. Is it safe to empty the table? what side effects may this cause?
3. Which apps read/write on this table?

My guess is some old bug made this and after the upgrade to OC 9.0.0 the corrupted entries were dragged on.

If you need more info, please ask.
The log (set to Error,Warning,Fatal) doesn't have much related info, some Roundcube entries and failed login attempts, that's it.


#2

Please keep this question in this category here. Thats a question most users can't answer.


#3

Sorry, I thought it was my mistake. I'll leave it on Development then.


#4

No problem. Its not always that clear at this forum software. You also can keep the "expert" tag as this needs some one with knowledge of the oC internals.


#5

I edited the post to make it more accurate to the real problem since I found out that the slow query thing was not related.


#6

I did some tests. Steps:

  1. Remove corrupted entry in oc_cards for user X.
  2. As admin: do a trivial "change" in Users to the user X.
  3. Step 2 recreates entry in oc_cards for user X, which is not corrupted.

I had to do this for every user that presented a corruption.

As far as I know, there were no related issues with these users.