deltachat / deltachat-core-rust

Delta Chat Rust Core library, used by Android/iOS/desktop apps, bindings and bots 📧
https://delta.chat/en/contribute
Other
682 stars 87 forks source link

error in JSONRPC's get_message() #5370

Closed adbenitez closed 6 months ago

adbenitez commented 8 months ago

My bots are sometimes getting an internal JSONRPC error when using API call get_message() it seems related to the "new" info messages shown when some peer changed keys and chat protection is broken, for some reason loading such messages with get_message() results in an exception when get_message() internally tries to load the sender contact (this special messages have no real sender) at least this is my assumption of the cause of the error

link2xt commented 8 months ago

this special messages have no real sender

Info messages have DC_CONTACT_ID_INFO (2) sender, not undefined (0) sender. Could you load corresponding message from msgs table and see what message it is? I made a PR to log msg_id in the error: #5372 But printing msgid in Python should also be possible.

This looks more like an attempt to load trashed message, info messages should be loadable without problems and desktop does it all the time.

adbenitez commented 8 months ago

This looks more like an attempt to load trashed message, info messages should be loadable without problems and desktop does it all the time.

This might be it, I started using more often "delete_device_after" in my bots to not keep private data that is not necessary, it might be that the messages are trashed by the time the bot already fetched the "next messages" IDs in some situations like bot start/resume

link2xt commented 7 months ago

@adbenitez Could you check with the updated core that logs msg_id which message it is?

link2xt commented 6 months ago

With https://github.com/deltachat/deltachat-core-rust/pull/5464 it is not possible to load trashed messages anymore.