Open benbucksch opened 3 months ago
I don't have easy access to an IMAP folder with 10000 deletable messages so I tried with 100 or so messages and although I was unable to reproduce the problem I did trip over this error whatever it means:
SqliteError: NOT NULL constraint failed: emailPersonRel.emailID
at Database.run (/home/neil/github/mustang/e2/out/main/index.js:98176:38)
at JPCWebSocket.funcListener (/home/neil/github/mustang/e2/out/main/index.js:46416:28)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async WSCall._incomingMessage (/home/neil/github/mustang/e2/out/main/index.js:45981:20)
at async WebSocket.
I don't know whether it's relevant but I don't see any logic in IMAPEMail.ts
that actually saves the desired read state in the database, but if you're worried about the email becoming unread while you're executing the command to mark it read on the server, you could always set its read state twice, once before and once after the server call, just in case. Or maybe you want a flag on the message that says you're changing flags and you don't want anyone changing them during the server call?
NOT NULL constraint failed: emailPersonRel.emailID
I see that very rarely, maybe 1-2% of deletes. It seems like it's a race as well. (If you find the cause, please fix it.) But that's not the bug here.
maybe you want a flag on the message that says you're changing flags and you don't want anyone changing them during the server call?
That's a nice idea, and clean to implement in the current function structure. I did that in c2c2ebb .
However, not surprisingly, while testing, that doesn't fix the deleted emails coming back. I didn't touch that, because the folder.deleted
array in IMAPEMail.deleteMessageOnServer()
should already fix that, no? Could you please look into that?
It can fairly easily reproduce that by deleting a bunch of messages, while reading (and automatically marking as read) a bunch of others. The typical actions when going through 20-30 messages and deleting half of them. After 20-30 seconds, a few of them (1 out of 5?) will come back, but not all.
I wasn't able to reproduce deleted emails coming back. I did reproduce what appears to be a front-end issue corrupting the message list. It behaves as follows:
Expected results: A folder with the same emails as the folder "Biggest".
Actual results: The message list becomes corrupt part way though, typically when trying to read the message "Test of ExQuilla on TB 115"; instead, you end up reading a clone (it has the same dbID but it doesn't compare equal) of "Test BCC". Eventually "Test of ExQuilla on TB 115" reappears but of course you haven't read it.
I added logging to try and find out what was mutating the message list but I didn't find anywhere in app/logic
where it might have been happening (we aren't even calling listMessages
for instance).
I've added a HACKish workaround that checks only recent messages for deleted messages.
This is a followup to #105
Actual result:
Expected result: