-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Contact has 161 MB because of (automated) social media avatar #2743
Comments
Oh wow - 161 MB! 😱 |
Of course I was intelligent enough to delete this contact :(, but I checked on other contacts with pictures (those are smaller, around 5 to 10MB). And yes, already in the first contact I found two About the social network type. I am not sure how the download works. The only thing I provided for the 161MB contact is a Gmail address. When I click on the contact picture, I have "Get from Gravatar". |
I should say that this contact was the first on the "All contacts" list with a social media profile picture. Maybe the social media scraper was going down the list and always adding another avatar to this first contact before failing. Because all other contacts wiht social media pictures were much smaller (5-10MB). |
So every time you download a new gravatar picture for your contact, a picture is added and not replaced for that person? Can you try the following?
For me, using contacts 4.0.1 there is never more than one PHOTO tag. |
We'll need a repair step in server too |
Thanks for looking into this, and sorry for the late reply. I followed the steps of @call-me-matt and indeed, only one PHOTO tag is in the contact file, even when changing the email address. When trying to download the avatar a second time, a toast informs me about the avatar already being up to date. So the problem happened already some time ago. This particular avatar that caused a contact to have 161MB has around 1MB, so it was downloaded 150 times in the course of the last months, I guess :-). |
Just to be sure, when changing the address a new photo should be downloaded, the picture should not be up to date anymore and a green toast should state a successful download. And then, still only one photo tag should be attached to the contacts VCF fille because hopefully the picture has been updated, not added. |
Yes, this was the case! |
Is your desire for all contact-avatars to be lossilly compressed? I desire the opposite, because if my contacts are to contain avatars, I want them to be of the best resolution that is possible. This problem is primarily the fault of the database that is unable to store that picture. |
For now we don't compress pictures, just resizing them to 256x256 maximum (keeping ratio), since most contact apps won't make use of higher sizes. |
I don't have any opinion about that. I think this issue is more about duplicate PHOTO tags, and I think it has been solved already. Is this the case? What has not been solved is: Maybe others were also (unknowingly) hit by this problem, and then the server has to repair duplicate tags. |
I encountered the same problem. @dschrempf described "out of memory errors on my phone related to DavX5 synchronization." I, too, have that problem. It results in an oom kill (Out Of Memory) event on the phone. In addition, I encountered problems in the the nextcloud web interface in a browser. The web interface spins, spins, spins and then shows something like "No contacts yet. Would you like to create a contact?" In other words, cannot access ANY contacts in the nextcloud web interface because of one faulty vcard / contact. On the server side, apache2 error log has:
The specific value of "Allowed memory size" shown above depends on the php config setting for memory_limit. In my case, memory_limit = 1024M. When I change to memory_limit = -1, the server php script consumes over 4GB of server memory before finally completing. Crazy. If you have a lot of contacts, just finding the faulty vcard(s) / contact(s) is challenging. I have about 2,500 contacts. I used the following postgresql SQL query to find the problematic vcards / contacts. Maybe there's a better way: From the results of the above SQL query, grab the value of "id". Let's say its "1234". Use that as "cardid" in the following SQL query: The result should give you the information you need to track down the faulty vcard / contact using the nextcloud web interface. One can then save / download / export the faulty vcard / contact to a local file before deleting it from the nextcloud server using the nextcloud web interface. You may need to repeat this process for multiple faulty vcards / contacts. Some observations that may or may not be relevant: Looking at the 'lastmodified' tag, it seems the problem did not happen as soon as the image was added. By "added" I mean when it was retrieved from social media. Days (maybe a week or two?) went by after the image was added before getting oom (out of memory) errors. Is there some sort of faulty lazy post-processing that happens? But I could be wrong. The faulty image is a PNG. Most images are JPG and are not a problem. Again, not sure if this is relevant or a red herring. The PHOTO tag is slightly different. For the faulty vcard, the photo tag is
A non-faulty vcard has this:
I'm just wondering what the "VALUE=BINARY" is all about. My knowledge of vcard tag syntax is zero, so may be totally irrelevant. But what definitely is relevant and is a problem is the number of times the PHOTO tag (and its encoded data) appears in the faulty vcard. Once I found the offending faulty vcard / contact using the SQL queries outlined above, and set php config memory_limit = -1 so that the nextcloud web interface would load, I was able to find and to save / download / export the faulty vcard / contact to a vcf file using the nextcloud web interface in a browser. The downloaded vcf file -- containing one, single, faulty contact -- is 322 MB, and the PHOTO tag (with its encoded data) repeats 323 times. |
Hi, I downloaded one vcard, it contains 45 pictures, all the same, all of them: PHOTO;ENCODING=b;TYPE=JPEG;VALUE=BINARY My questions:
|
@pongraczi, that's probably best asked on the forum, I think, since you're asking about sanitizing an export of the database rather than trying to fix the database importing images. |
In case there is a follow up in the forum, I am interested and would be happy if you could post the link here. |
My bad, I used wrong words, sorry.
|
Unfortunately that's not easily possible. We'll need a repair step in server as said before. #2743 (comment) |
I finally found a contact with the same behavior and took a look
while my other contacts are
Note: These values are from the
I tried to fix the broken 3.0 contact, but did not manage to. Here is what I tried:
So my conclusion is that there must be a bug in the update-picture routine for v3.0 cards (the one for social updates, but also the one for manual image uploads). How to reproduce with manual image uploads:
|
Describe the bug
I noticed out of memory errors on my phone related to DavX5 synchronization (Nextcloud <-> Android). After digging around for a few hours, I saw that one of my Nextcloud contacts has 161MB because of an avatar that was downloaded automatically. The VCF file shows
and then endless lines of photo data.
Has this been an issue for other users? Did you already encounter such a problem?
Thanks for looking into this!
Steps to reproduce
I didn't do anything special. Just added the contact a while ago. (Email, and name).
Expected behavior
Avatars are small.
Actual behavior
Avatar has 161MB.
Contact version
No response
Operating system
No response
PHP engine version
No response
Web server
No response
Database
No response
Operating system
No response
List of activated Apps
Nextcloud Signing status
No response
Configuration report
No response
Additional info
No response
The text was updated successfully, but these errors were encountered: