skynet-im / skynet-android

Skynet Messenger Android client
GNU General Public License v3.0
1 stars 0 forks source link

Crash on counterpart nickname update #4

Closed daniel-lerch closed 5 years ago

daniel-lerch commented 5 years ago

To Reproduce Steps to reproduce the behavior:

  1. Let someone else register and login to Skynet, but not enter his nickname
  2. Create a direct channel together with this account
  3. Let the other person set his nickname
  4. Your Skynet app crashes

Expected behavior The list item should update to show the nickname instead of the email address.

Smartphone (please complete the following information):

Log output

2019-07-21 16:46:04.393 30551-1762/de.vectordata.skynet E/AndroidRuntime: FATAL EXCEPTION: Thread-197
    Process: de.vectordata.skynet, PID: 30551
    android.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed: channelMessages.channelId, channelMessages.messageId (code 2067)
    #################################################################
    Error Code : 2067 (SQLITE_CONSTRAINT_UNIQUE)
    Caused By : Abort due to constraint violation.
        (UNIQUE constraint failed: channelMessages.channelId, channelMessages.messageId (code 2067))
    #################################################################
        at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
        at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:865)
        at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:788)
        at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:86)
        at androidx.sqlite.db.framework.FrameworkSQLiteStatement.executeInsert(FrameworkSQLiteStatement.java:51)
        at androidx.room.EntityInsertionAdapter.insert(EntityInsertionAdapter.java:80)
        at de.vectordata.skynet.data.sql.dao.ChannelMessageDao_Impl.insert(ChannelMessageDao_Impl.java:88)
        at de.vectordata.skynet.net.packet.P0BChannelMessage.writeToDatabase(P0BChannelMessage.java:125)
        at de.vectordata.skynet.net.PacketHandler.handlePacket(PacketHandler.java:159)
        at de.vectordata.skynet.net.packet.P0BChannelMessage.handlePacket(P0BChannelMessage.java:109)
        at de.vectordata.skynet.net.PacketHandler.handlePacket(PacketHandler.java:113)
        at de.vectordata.skynet.net.PacketHandler.handlePacket(PacketHandler.java:87)
        at de.vectordata.skynet.net.NetworkManager.onPacketReceived(NetworkManager.java:131)
        at de.vectordata.libjvsl.VSLClient.onPacketReceived(VSLClient.java:91)
        at de.vectordata.libjvsl.net.NetworkManager.receivePacket_AES_256_CBC_HMAC_SHA_256_CTR(NetworkManager.java:174)
        at de.vectordata.libjvsl.net.NetworkManager.receiveData(NetworkManager.java:52)
        at de.vectordata.libjvsl.net.NetworkChannel.lambda$startReceiverThread$1$NetworkChannel(NetworkChannel.java:98)
        at de.vectordata.libjvsl.net.-$$Lambda$NetworkChannel$tsv2U_-W_a1feLNNFmmVaV1ytCA.run(lambda)
        at java.lang.Thread.run(Thread.java:762)
Twometer commented 5 years ago

This stacktrace shows that the client tried to save two channel messages with the same channelId and messageId. As this information comes from the server, I don't think this is the fault of the client.

Twometer commented 5 years ago

@daniel-lerch Can you confirm this as a server issue so that I can close this?

daniel-lerch commented 5 years ago

In dozens of highly parallel running tests not a single duplicate message ID appeared. If it this would happen, it would crash the server with a UNIQUE CONSTRAINT VIOLATION. That's why I don't understand this bug. However the ID generation will be changed with skynet-im/skynet#3. I will close this issue now and reopen if the problem occurs again.