-
-
Notifications
You must be signed in to change notification settings - Fork 122
SQL errors while trying to move / delete messages #6355
Description
- Operating System: Debian 12 / Android 14
- Delta Chat Version: Desktop 1.50.1 (core 1.152.1) / Android 1.50.2
I noticed Delta Chat was a bit sluggish since the 1.50 update, taking a while to show me new messages, also displaying “updating” constantly on both desktop and mobile.
I started to dig a little bit and noticed that messages were not being deleted on the server (despite having set a deletion timer), the DeltaChat IMAP folder containing around 100000 messages now.
I also noticed that disappearing messages in some groups were in fact not disappearing at all, everything was kept. An example of such is a group where deleted messages were setup on the 7th of september, but everything since then is still there and readable.
Opening the log reveals quite a lot of error messages related to deleting messages, very similar errors on both Android and Desktop clients.
(I had to elide the huge row of question marks in the queries because there were too many to post the issue on github)
On desktop:
2024-12-22T10:13:55.557Z core/event WARNING "" 1 "src/scheduler.rs:728: Failed fetch_idle: fetch_move_delete: move_delete_messages: cannot delete batch of messages \"8220:8221,8227:8228,8230:8231,8291:8293,8298:8299,8301:8303,8311:8344,8351:8395,8402:8823,8825:8960,8965:9010,9013:9096,9110:9113,9124:9145,9166:9203,9210:9211,9213:9214,9217:9677,9680:9681,9684:9690,9693:9694,9697:9714,9717:9912,9917:10473,10477:10601,10608:10611,10614:10615,10617:10830,10847:11106,11109:11413,11416:11510,11513:11615,11620:12137,12140:13372,13375:13422,13425:13885,13890:15763,15765:16203,16206:17670,17672:18406,18408:18843,18846:19245,19247:20282,20285:20387,20389:20409,20411:20549,20551:20796,20799:21185,21189:24521,24526:24954,24959:25005,25010:25226,25231:27870,27873:28846,28851:29120,29122:29603,29605:30377,30379:31531,31535:31536,31540:32123,32126:33966,33971:33973,33975,33977:34731,34734:35007,35012:35325,35330:35627,35629:35632,35637:35640,35643:35913,35917:36715,36718:40765,40770:40810,40814:41725,41730:41846,41851:41856,41861:42182,42185:42255,42260:42519,42522:42721,42725:45432,45435:47152,47157:47234,47237:47780,47784:48510,48512:48533,48535,48537:50852,50856:50879\": cannot remove deleted messages from imap table: too many SQL variables in DELETE FROM imap WHERE id IN (?,?,?,……………?,?,?,?,?,?,?,?,?,?,?,?) at offset 65562: Error code 1: SQL error or missing database"
2024-12-22T10:13:55.557Z core/event WARNING "" 1 "src/imap.rs:309: IMAP got rate limited, waiting for 0h 0m 58s until can connect."
On Android:
12-22 11:18:39.238 5413 5449 🟠 DeltaChat: [accId=1] src/scheduler.rs:728: Failed fetch_idle: fetch_move_delete: move_delete_messages: cannot delete batch of messages "8220:8221,8227:8228,8230:8231,8291:8293,8298:8299,8301:8303,8311:8344,8351:8395,8402:8823,8825:8960,8965:9010,9013:9096,9110:9113,9124:9145,9166:9205,9208:9211,9213:9214,9217:9677,9680:9681,9684:9690,9693:9694,9697:9714,9717:9912,9917:10473,10477:10603,10606:10611,10614:10615,10617:10830,10847:11413,11416:11510,11513:11615,11620:12137,12140:13372,13375:13422,13425:13885,13890:15763,15765:16203,16206:17670,17672:18406,18408:18843,18846:19245,19247:20282,20285:20387,20389:20409,20411:20549,20551:20796,20799:21185,21189:24521,24526:24954,24959:25005,25010:25226,25231:27870,27873:28846,28851:29120,29122:29603,29605:30377,30379:31531,31535:31536,31540:32123,32126:33966,33969:33970,33972,33974,33976,33978:34731,34734:35007,35012:35325,35330:35627,35629:35632,35637:35640,35643:35913,35917:36715,36718:40765,40770:40810,40814:41725,41730:41846,41851:41856,41861:42182,42185:42255,42260:42519,42522:42721,42725:45432,45435:47152,47157:47234,47237:47780,47784:48510,48512:48533,48535,48537:50852,50856:50879": cannot remove deleted messages from imap table: too many SQL variables in DELETE FROM imap WHERE id IN (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,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?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,
12-22 11:18:39.238 5413 5449 🟠 DeltaChat: [accId=1] src/imap.rs:309: IMAP got rate limited, waiting for 0h 0m 59s until can connect.
Seems like something is generating enormous SQLite queries…
I haven’t looked at the code, but maybe creating a temp table with all the IDs and using an IN statement in the WHERE clause would make more sense. Generating SQL queries seems like a big footgun.