session-foundation / session-android

A private messenger for Android.
https://getsession.org
GNU General Public License v3.0
32 stars 4 forks source link

Failed to delete message #163

Open NGoedix opened 1 year ago

NGoedix commented 1 year ago

Code of conduct

Describe the bug

Continuous failed attempt to complete SnodeAPI.deleteMessage.

To reproduce

Steps to reproduce the behavior:

In a private conversation, delete a message for both of you, when you delete it the server hash of the message is deleted before calling the messageDataProvider.getServerHashForMessage method, so calling this method will do nothing as you will get nothing. Meanwhile, on the other device the MessageReceiver.handleUnsendRequest method will be called, which will send a request through the SnodeAPI to delete the messages, which always ends in the same ending:

2023-07-06 09:40:04.004 24060-24155 Loki network.loki.messenger E Failed to delete messages
                                                                                                     org.session.libsession.snode.OnionRequestAPI$HTTPRequestFailedAtDestinationException: HTTP request failed
    at destination .destination (Service node) with status code 421.
    at org.session.libsession.snode.OnionRequestAPI.handleResponse(OnionRequestAPI.kt:632 undefined)
    at org.session.libsession.snode.OnionRequestAPI.access$handleResponse(OnionRequestAPI.kt:37 undefined)
    at org.session.libsession.snode.OnionRequestAPI$sendOnionRequest$1$1.invoke(OnionRequestAPI.kt:364 undefined)
    at org.session.libsession.snode.OnionRequestAPI$sendOnionRequest$1$1.invoke(OnionRequestAPI.kt:361 undefined)
                                                                                                     at org.session.libsignal.utilities.ThreadUtils.queue$lambda-0(ThreadUtils.kt:18 undefined)
    at org.session.libsignal.utilities.ThreadUtils.$r8$lambda$VDXoXx8OnC_lWovEeHWLJNb73So(Unknown Source:0)
    at org.session.libsignal.utilities.ThreadUtils$ExternalSyntheticLambda0.run(Unknown Source:2)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137 undefined)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637 undefined)
    at java.lang.Thread.run(Thread.java:1012 undefined)

Smartphone (please complete the following information):

NGoedix commented 1 year ago

As note, the message is correctly deleted in both devices, but the request to the SnodeAPI to delete the messages from the server return that exception

NGoedix commented 1 year ago

Any update?

NGoedix commented 1 year ago

Update? 1 month from the creation of the issue

0x330a commented 1 year ago

This one will be fixed with the new disappearing messages release

NGoedix commented 1 year ago

Is the problem in the libsession or in the nodes? Were the messages deleted correctly despite giving that error code? I would like to help with some PR

0x330a commented 1 year ago

I think what might be happening currently is the server message hash is being tracked incorrectly locally, which tells the node to delete a hash that may not exist or never did exist in that swarm, or it might be that the node it is trying to delete the message from isn't a part of the pubkey's swarm anymore... usually I think it isn't an issue but would be good to revisit the error handling. I think failures in these cases means that the message shouldn't exist anymore on the node you're trying to delete it from