Bug 501251 - Faces were removed
Summary: Faces were removed
Status: REPORTED
Alias: None
Product: digikam
Classification: Applications
Component: Database-Mysql (other bugs)
Version First Reported In: 8.6.0
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-09 08:25 UTC by Andy
Modified: 2025-05-28 16:37 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Output 20250315_093800 (202.38 KB, text/plain)
2025-03-15 08:55 UTC, Andy
Details
20250414_222301 - Ausgabe (161.64 KB, text/plain)
2025-04-14 20:28 UTC, Andy
Details
20250414_222301 - Bild1 (1.07 MB, image/png)
2025-04-14 20:29 UTC, Andy
Details
20250427_221900 (553.27 KB, text/plain)
2025-04-27 20:32 UTC, Andy
Details
20250509_202001 Ausgabe (72.49 KB, text/plain)
2025-05-09 18:31 UTC, Andy
Details
Ausgabe 20250512_061201 (54.10 KB, text/plain)
2025-05-12 04:17 UTC, Andy
Details
Advisor1 (5.43 KB, text/plain)
2025-05-21 15:18 UTC, Andy
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andy 2025-03-09 08:25:39 UTC
Hello,
I have another strange case.

The MySQL server is running permanently on the Synology. Last night, another face recognition process was carried out on the PC. The PC was not in standby mode.

This morning, I see a lot of recognized faces. I marked and confirmed these 100. In the preview image area, I can see some of the names that have already been assigned below the faces. These have disappeared image by image. The changes have been transferred to the JPGs. The overview of the unconfirmed faces has not otherwise changed.

I now have 100 JPGs that no longer have any face areas.

There still seems to be access to the database. Apparently, the face data was simply not written to the JPG again.

I have now closed digikam and restarted it. The unconfirmed faces from last night are still displayed. If I confirm a face again as before, the areas and names are entered into the JPG. All faces and areas in the photo can be seen again.
The areas are still in the database. That's very good!

I had the same problem a few days ago.

Best regards
Andy
Comment 1 Maik Qualmann 2025-03-09 08:39:47 UTC
Are you sure that the PC has not gone into standby mode or the NAS? It is known that this will interrupt the connection and digiKam is currently not reactivating this connection.

Maik
Comment 2 Andy 2025-03-09 08:46:00 UTC
Yes, that's what I thought too. But I disabled power saving mode or sleep mode completely. Both devices ran through the night.
Could some software disconnect the connection after x hours of inactivity?
Comment 3 caulier.gilles 2025-03-09 08:47:42 UTC
The linux kernel have some mechanism to shutdown the network socket when activity take a while. This can be the problem.
Comment 4 caulier.gilles 2025-03-09 08:51:14 UTC
A paper explaining how to tune the socket keep alive settings on Linux kernel :

https://tldp.org/HOWTO/TCP-Keepalive-HOWTO/usingkeepalive.html
Comment 5 caulier.gilles 2025-03-09 08:54:18 UTC
Also the TCP socket keep alive behavior depend of the OS:

https://forum.qt.io/topic/91397/what-does-qabstractsocket-keepaliveoption-actually-do/5?_=1741510336444&lang=en-US
Comment 6 Andy 2025-03-09 08:57:51 UTC
The question is whether Synology does this too. It can be reached at any time using Quickconnect and Active Insight.
Hmm. To find out, I could run a debug all night.
The paper is too big for me. I don't work with Linux enough.
Comment 7 caulier.gilles 2025-03-09 09:10:53 UTC
Look well in the paper there cat some cat to run in /proc to know the actual keep alive settings from the NAS. Under Windows it's another story...
Comment 8 caulier.gilles 2025-03-09 09:13:17 UTC
The Windows keep alive settings is located in the registery database through this key :

\HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\TCPIP\Parameters

Gilles
Comment 9 Andy 2025-03-09 09:29:23 UTC
This reg entry is more for Windows servers so that the connection is terminated more quickly.
https://www.consic.de/de/einstellung-der-tcp-keepalive-zeit-fuer-windows-server

Could digikam ping the database every x minutes so that the connection remains active? Maybe also look for new entries in the albums after 1 hour of user inactivity?
Comment 10 Andy 2025-03-15 08:55:49 UTC
Created attachment 179417 [details]
Output 20250315_093800

Hello,
Face scanning has been running for all photos for 10 hours. 15% is now complete. The connection to the database is stable. Now I wanted to confirm the faces found. The face tags in the photos have been deleted again. The entries in the database remain.
I've created an output. Three file names are at the beginning for the search so you can find the point more quickly.
There are errors there:
...."Lost connection to MySQL server during query" "2013" 2

Regards
Andy
Comment 11 caulier.gilles 2025-04-11 18:13:57 UTC
Hi,

The 8.7.0 pre-release Windows installer from today have been rebuilt from
scratch with Qt 6.8.3, KDE 6.12, OpenCV 4.11 + CUDA support, Exiv2 0.28.5, ExifTool 13.27, ffmpeg 7, all image codecs updated to last version (jxl, avif, heif, aom, etc.).

Please try with this version to see if your problem still reproducible...

https://files.kde.org/digikam/

Thanks in advance
Best regards

Gilles Caulier
Comment 12 Andy 2025-04-14 20:28:27 UTC
Created attachment 180268 [details]
20250414_222301 - Ausgabe

Hello Gilles,

The PC performed automatic face detection overnight.
This morning, I confirmed a few faces. But instead of adding new faces to the photo, all known markers were removed.
I've created an output. See photo "20230813_100218 - A6000.jpg"
Regards
Andy
Comment 13 Andy 2025-04-14 20:29:01 UTC
Created attachment 180269 [details]
20250414_222301 - Bild1

And here

Andy
Comment 14 Michael Miller 2025-04-14 23:40:38 UTC
(In reply to Andy from comment #12)
> Created attachment 180268 [details]
> 20250414_222301 - Ausgabe
> 
> Hello Gilles,
> 
> The PC performed automatic face detection overnight.
> This morning, I confirmed a few faces. But instead of adding new faces to
> the photo, all known markers were removed.
> I've created an output. See photo "20230813_100218 - A6000.jpg"
> Regards
> Andy

Hi Andy, it looks like digiKam lost connection to the DB.  I see

> "SELECT imageid FROM ImageTagProperties LEFT JOIN Images ON Images.id=ImageTagProperties.imageid  WHERE tagid=? AND property=? AND >Images.status=1 LIMIT 1;" 
>Error messages: "QMYSQL: Der Befehl konnte nicht initialisiert werden" "Lost connection to MySQL server during query" "2013" 2 
>Bound values:  QList()
>digikam.dbengine: Failure executing query:

Over and over in the log file.  Maybe Gilles or Maik can give more information, but that doesn't look like normal operations.

Cheers,
Mike
Comment 15 Andy 2025-04-15 07:56:20 UTC
Hi,

Has the database connection completely crashed?
Because I can still switch to other albums or other people in digiKam and the thumbnails load. 

Regards, Andy
Comment 16 caulier.gilles 2025-04-15 08:03:58 UTC
Andy,

We need to know more about the infrastructure that you use. Network types, computers + OS, databases (local or remote), remote files (NAS or local), shared accounts, anti-virus, etc.

Best

Gilles Caulier
Comment 17 Andy 2025-04-15 08:40:04 UTC
AMD Phenom II 1100T, ASUS M4A88T-V EVO, Windows 10 Pro 
AMD Ryzen™ 7 7800X3D, Prozessor, MSI B650 Board, Windows 10 Pro 
Synology NAS DS918+

1 6-Port Switch, 1GbE LAN-Ports
1 FritzBox 7490

Database: remote
MariaDB-Server: Synology / Docker

No shared accounts.
ESET NOD32 Antivirus on both Windows PCs
Windows Firewall
Comment 18 Michael Miller 2025-04-27 02:00:06 UTC
(In reply to Andy from comment #17)
> AMD Phenom II 1100T, ASUS M4A88T-V EVO, Windows 10 Pro 
> AMD Ryzen™ 7 7800X3D, Prozessor, MSI B650 Board, Windows 10 Pro 
> Synology NAS DS918+
> 
> 1 6-Port Switch, 1GbE LAN-Ports
> 1 FritzBox 7490
> 
> Database: remote
> MariaDB-Server: Synology / Docker
> 
> No shared accounts.
> ESET NOD32 Antivirus on both Windows PCs
> Windows Firewall

Hi Andy,
Is this still an issue?  I've tried and tried, but I can't reproduct the issue.

Cheers,
Mike
Comment 19 Andy 2025-04-27 08:13:51 UTC
Hi Mike, 
I'll run digiKam again tonight. I think it might take 6-8 hours.

Regards
Andy
Comment 20 Andy 2025-04-27 20:32:29 UTC
Created attachment 180714 [details]
20250427_221900

Hello Mike,
digiKam has been detecting new faces for about seven hours. I haven't touched the PC. Now I've confirmed two faces. But instead of adding them, all tags and contacts were deleted from the JPG metadata.
It seems as if only one module of the program is no longer working properly and can no longer access the database.
The JPGs are at the top of the output.
Unfortunately, I don't have a current debug version of digiKam.

Regards
Andy
Comment 21 Michael Miller 2025-05-05 10:23:53 UTC
(In reply to Andy from comment #20)
> Created attachment 180714 [details]
> 20250427_221900
> 
> Hello Mike,
> digiKam has been detecting new faces for about seven hours. I haven't
> touched the PC. Now I've confirmed two faces. But instead of adding them,
> all tags and contacts were deleted from the JPG metadata.
> It seems as if only one module of the program is no longer working properly
> and can no longer access the database.
> The JPGs are at the top of the output.
> Unfortunately, I don't have a current debug version of digiKam.
> 
> Regards
> Andy

Hi Andy,
We think we found the issue.  Please retry with the latest version and let us know if the issue is still happening.

Cheers,
Mike
Comment 22 Andy 2025-05-06 18:41:29 UTC
Hi Mike,

The latest version on the download page is digiKam-8.7.0-20250504T170139-Qt6-Win64.exe. The problem still exists here.
Maybe Gilles still has internet problems.

Regards
Andy
Comment 23 caulier.gilles 2025-05-06 21:21:58 UTC
yes, i'm not at home and i let's my lead computer on to build the bundles.

I go back at home in 3 weeks, not before. I will try to find an alternative here...
Comment 24 Andy 2025-05-08 15:36:39 UTC
Hi Mike!
With version digiKam-8.7.0-20250507T170157-Qt6-Win64, the PC ran face recognition for many hours last night. This morning, the familiar problem occurred again. Metadata was deleted from the file, and no new data was written.
Could a new output help? It gets extremely large.

Regards
Andy
Comment 25 Michael Miller 2025-05-08 19:30:47 UTC
(In reply to Andy from comment #24)
> Hi Mike!
> With version digiKam-8.7.0-20250507T170157-Qt6-Win64, the PC ran face
> recognition for many hours last night. This morning, the familiar problem
> occurred again. Metadata was deleted from the file, and no new data was
> written.
> Could a new output help? It gets extremely large.
> 
> Regards
> Andy

Hi Andy,
yes, I'll beed a new backtrace to see what's going on.  Thank you!

Cheers,
Mike
Comment 26 Andy 2025-05-09 18:31:51 UTC
Created attachment 181113 [details]
20250509_202001 Ausgabe

Hi Mike,
here's the new backtrace.
Started last night at 10 p.m. This morning at 6 a.m., a face was successfully confirmed. (Up to line 171)
Today at 8:15 p.m., another face was confirmed. But with error messages.

Regards
Andy
Comment 27 Andy 2025-05-10 19:32:28 UTC
Hi Mike,

Could it be that the program, or part of it, crashed? It won't close?
I keep noticing that when I install a new version, I get a message saying that digiKam needs to be closed.
In the Task Manager, I see "Advanced digital photo management application" under "Background processes." I can only close it in the Task Manager.

Regards
Andy
Comment 28 Michael Miller 2025-05-11 10:47:51 UTC
(In reply to Andy from comment #27)
> Hi Mike,
> 
> Could it be that the program, or part of it, crashed? It won't close?
> I keep noticing that when I install a new version, I get a message saying
> that digiKam needs to be closed.
> In the Task Manager, I see "Advanced digital photo management application"
> under "Background processes." I can only close it in the Task Manager.
> 
> Regards
> Andy

Hi Andy,
It looks like you're losing the connection to the MySQL Database.

> Error messages: "QMYSQL: Die Abfrage konnte nicht ausgeführt werden" "Lost connection to MySQL server during query" "2013" 2 

I see this error message (or similar ones) over and over in the log.  Maybe Maik or Gilles can add a comment.  I don't know the code very well that manages the connection to the DB.

Gilles?  Maik?  Any ideas?

Cheers,
Mike
Comment 29 caulier.gilles 2025-05-11 11:24:21 UTC
A way to investiguate in-deep with Qt is to enable ALL debug traces. This is very very verbose but it can help to understand some point done by QtSql module in the background.

Try to run digiKam like this : 

export QT_LOGGING_RULES="*qt*=true" && digikam

Gilles Caulier
Comment 30 Andy 2025-05-11 16:56:25 UTC
Hi Gilles,
Was your message addressed to me?
I think your command doesn't work on Windows.

Regards 
Andy
Comment 31 Michael Miller 2025-05-11 17:11:54 UTC
(In reply to Andy from comment #30)
> Hi Gilles,
> Was your message addressed to me?
> I think your command doesn't work on Windows.
> 
> Regards 
> Andy

Hi Andy,
On Windows, you need to update your environment variables in the System Settings to change QT_LOGGING_RULES.  Based on the numerous backtraces you've already sent, I'm assuming you've set this before.  yes?

Cheers,
Mike
Comment 32 Andy 2025-05-11 17:19:06 UTC
Hi Mike,

That's correct.
Name: QT_LOGGING_RULES
Old value: digikam*=true
New value: "*qt*=true"                ???

Regards
Andy
Comment 33 Andy 2025-05-12 04:17:20 UTC
Created attachment 181193 [details]
Ausgabe 20250512_061201

Hi Mike,

Here's the backtrace from last night.
I wasn't sure if the value was correct, so I just let it run.

Regards
Andy
Comment 34 Maik Qualmann 2025-05-13 06:36:40 UTC
The connection to your MySQL server is lost, and this is due to timeouts on your server. There's nothing digiKam can do about it.

Maik
Comment 35 Andy 2025-05-13 09:17:06 UTC
Hi Maik,

That was a good point from you.
https://docs.rackspace.com/docs/how-to-change-the-mysql-timeout-on-a-server
I'll test higher values ​​than 8 hours.

Regards
Andy
Comment 36 Andy 2025-05-13 19:29:23 UTC
Hello Maik,

I'm wondering if it's a good idea to increase the timeout. Eventually, even this time will expire.
I could increase the time to 24 hours or more. Then I'll have a chance to perform an interactive action.
Do you know which timeout you're referring to? wait_timeout or interactive_timeout?
Could digiKam simulate an interactive action after a while so the countdown starts over?

Regards
Andy
Comment 37 Andy 2025-05-20 18:06:10 UTC
Hi!
I've adjusted the values. I'm fine with that.
wait_timeout = 86400
interactive_timeout = 86400

There's an advisor in phpmyadmin. Does it make sense to follow the suggestions?

For example, this recommendation:
This means that joins perform full table scans. Using indexes on the columns used in the join conditions will speed up joins considerably.

Regards
Andy
Comment 38 Michael Miller 2025-05-21 10:33:29 UTC
(In reply to Andy from comment #37)
> Hi!
> I've adjusted the values. I'm fine with that.
> wait_timeout = 86400
> interactive_timeout = 86400
> 
> There's an advisor in phpmyadmin. Does it make sense to follow the
> suggestions?
> 
> For example, this recommendation:
> This means that joins perform full table scans. Using indexes on the columns
> used in the join conditions will speed up joins considerably.
> 
> Regards
> Andy

Hi Andy,
Can you attach the phpmyadmin report?  It would be nice to see all the recommendations.

Cheers,
Mike
Comment 39 Andy 2025-05-21 15:18:51 UTC
Created attachment 181614 [details]
Advisor1

Hi Mike,

Here are the advisor's recommendations

Regards
Andy
Comment 40 Michael Miller 2025-05-28 16:37:16 UTC
(In reply to Andy from comment #39)
> Created attachment 181614 [details]
> Advisor1
> 
> Hi Mike,
> 
> Here are the advisor's recommendations
> 
> Regards
> Andy

Hi Andy,
Thank you!  I'll add this to my 8.8.0 To Do list.

Cheers,
Mike