Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In the starred messages view, new starred message events crash the app #5895

Open
PIG208 opened this issue Sep 26, 2024 · 4 comments
Open

In the starred messages view, new starred message events crash the app #5895

PIG208 opened this issue Sep 26, 2024 · 4 comments
Labels
a-message list bug severe: crash The app quits, or stops responding.

Comments

@PIG208
Copy link
Member

PIG208 commented Sep 26, 2024

To reproduce:

  1. Go to the starred messages view on the mobile app
  2. Log into the same account on another device
  3. Star an old message

I haven't yet diagnosed the cause of the crash, but looking at the error message, it is likely that the client relies on the assumption that a starred message is known to the app. This is not the case when that message is ancient and hasn't been fetched before.

Error Details
Error: getFetchedMessagesForNarrow: message with id is missing in getMessages(state)
The error may be correlated with this previous error:
index.android.bundle:1881:1699
map@[native code]
index.android.bundle:1881:1544
[email protected]:1158:886
index.android.bundle:1157:1038
[email protected]:1158:886
index.android.bundle:1157:1004
[email protected]:1158:886
index.android.bundle:1157:1004
[email protected]:1158:886
index.android.bundle:2469:4330
[email protected]:1153:1076
[email protected]:1122:149
index.android.bundle:1122:347
[email protected]:1122:309
[email protected]:1122:724
notifyNestedSubs@[native code]
[email protected]:1126:3030
[email protected]:1122:149
index.android.bundle:1122:347
[email protected]:81:93155
[email protected]:81:12945
[email protected]:1122:309
[email protected]:1122:724
[email protected]:1122:149
[email protected]:2692:1608
index.android.bundle:2638:366
[email protected]:2013:4962
index.android.bundle:2013:6131
[email protected]:107:746
index.android.bundle:107:2101
[email protected]:107:746
[email protected]:107:1233
index.android.bundle:107:1389
index.android.bundle:101:618
index.android.bundle:101:645
index.android.bundle:110:1748
[email protected]:110:496
[email protected]:110:886
[email protected]:110:3148
[email protected]:61:2874
index.android.bundle:61:965
[email protected]:61:2510
[email protected]:61:923
value@[native code]
value@[native code]



Component Stack:

    in Unknown
    in Unknown
    in Connect(Component)
    in Unknown
    in Unknown
    in Unknown
    in RCTView
    in Unknown
    in RCTView
    in Unknown
    in RCTView
    in Unknown
    in Unknown
    in RCTView
    in Unknown
    in u
    in Unknown
    in PanGestureHandler
    in Unknown
    in RCTView
    in Unknown
    in u
    in Unknown
    in RCTView
    in Unknown
    in o
    in Unknown
    in RNSScreen
    in u
    in Unknown
    in n
    in Suspense
    in Unknown
    in _
    in r
    in a
    in Unknown
    in RNSScreenContainer
    in ScreenContainer
    in Unknown
    in n
    in o
    in Unknown
    in RNGestureHandlerRootView
    in Unknown
    in s
    in Unknown
    in Unknown
    in Unknown
    in Unknown
    in Unknown
    in Unknown
    in Unknown
    in RCTView
    in Unknown
    in RCTView
    in UnknownError: getFetchedMessagesForNarrow: message with id is missing in getMessages(state)
The error may be correlated with this previous error:
index.android.bundle:1881:1699
map@[native code]
index.android.bundle:1881:1544
[email protected]:1158:886
index.android.bundle:1157:1038
[email protected]:1158:886
index.android.bundle:1157:1004
[email protected]:1158:886
index.android.bundle:1157:1004
[email protected]:1158:886
index.android.bundle:2469:4330
[email protected]:1153:1076
[email protected]:1122:149
index.android.bundle:1122:347
[email protected]:1122:309
[email protected]:1122:724
notifyNestedSubs@[native code]
[email protected]:1126:3030
[email protected]:1122:149
index.android.bundle:1122:347
[email protected]:81:93155
[email protected]:81:12945
[email protected]:1122:309
[email protected]:1122:724
[email protected]:1122:149
[email protected]:2692:1608
index.android.bundle:2638:366
[email protected]:2013:4962
index.android.bundle:2013:6131
[email protected]:107:746
index.android.bundle:107:2101
[email protected]:107:746
[email protected]:107:1233
index.android.bundle:107:1389
index.android.bundle:101:618
index.android.bundle:101:645
index.android.bundle:110:1748
[email protected]:110:496
[email protected]:110:886
[email protected]:110:3148
[email protected]:61:2874
index.android.bundle:61:965
[email protected]:61:2510
[email protected]:61:923
value@[native code]
value@[native code]



Component Stack:

    in Unknown
    in Unknown
    in Connect(Component)
    in Unknown
    in Unknown
    in Unknown
    in RCTView
    in Unknown
    in RCTView
    in Unknown
    in RCTView
    in Unknown
    in Unknown
    in RCTView
    in Unknown
    in u
    in Unknown
    in PanGestureHandler
    in Unknown
    in RCTView
    in Unknown
    in u
    in Unknown
    in RCTView
    in Unknown
    in o
    in Unknown
    in RNSScreen
    in u
    in Unknown
    in n
    in Suspense
    in Unknown
    in _
    in r
    in a
    in Unknown
    in RNSScreenContainer
    in ScreenContainer
    in Unknown
    in n
    in o
    in Unknown
    in RNGestureHandlerRootView
    in Unknown
    in s
    in Unknown
    in Unknown
    in Unknown
    in Unknown
    in Unknown
    in Unknown
    in Unknown
    in RCTView
    in Unknown
    in RCTView
    in Unknown
    in u
    in c
    in RCTView
    in Unknown
    in RCTView
    in Unknown
    in Unknown
    in Unknown
    in l
    in IntlProvider
    in Unknown
    in RCTView
    in Unknown
    in r
    in Connect(r)
    in Unknown
    in RNCSafeAreaProvider
    in Unknown
    in Unknown
    in n
    in Unknown
    in r
    in r
    in Unknown
    in RCTView
    in Unknown
    in RCTView
    in Unknown
    in n

Call Stack:

index.android.bundle:1881:1699
map@[native code]
index.android.bundle:1881:1544
[email protected]:1158:886
index.android.bundle:1157:1038
[email protected]:1158:886
index.android.bundle:1157:1004
[email protected]:1158:886
index.android.bundle:1157:1004
[email protected]:1158:886
index.android.bundle:2469:4330
index.android.bundle:1153:645
index.android.bundle:1153:1249
index.android.bundle:1117:530
[email protected]:2469:4271
index.android.bundle:2469:488
[email protected]:81:41156
[email protected]:81:52479
[email protected]:81:78041
[email protected]:81:77943
[email protected]:81:77708
[email protected]:81:74696
Sa@[native code]
[email protected]:81:25302
[email protected]:81:93216
[email protected]:81:12945
[email protected]:1122:309
[email protected]:1122:724
[email protected]:1122:149
[email protected]:2692:1608
index.android.bundle:2638:366
[email protected]:2013:4962
index.android.bundle:2013:6131
[email protected]:107:746
index.android.bundle:107:2101
[email protected]:107:746
[email protected]:107:1233
index.android.bundle:107:1389
index.android.bundle:101:618
index.android.bundle:101:645
index.android.bundle:110:1748
[email protected]:110:496
[email protected]:110:886
[email protected]:110:3148
[email protected]:61:2874
index.android.bundle:61:965
[email protected]:61:2510
[email protected]:61:923
value@[native code]
value@[native code]
    in u
    in c
    in RCTView
    in Unknown
    in RCTView
    in Unknown
    in Unknown
    in Unknown
    in l
    in IntlProvider
    in Unknown
    in RCTView
    in Unknown
    in r
    in Connect(r)
    in Unknown
    in RNCSafeAreaProvider
    in Unknown
    in Unknown
    in n
    in Unknown
    in r
    in r
    in Unknown
    in RCTView
    in Unknown
    in RCTView
    in Unknown
    in n

Call Stack:

index.android.bundle:1881:1699
map@[native code]
index.android.bundle:1881:1544
[email protected]:1158:886
index.android.bundle:1157:1038
[email protected]:1158:886
index.android.bundle:1157:1004
[email protected]:1158:886
index.android.bundle:1157:1004
[email protected]:1158:886
index.android.bundle:2469:4330
index.android.bundle:1153:645
index.android.bundle:1153:1249
index.android.bundle:1117:530
[email protected]:2469:4271
index.android.bundle:2469:488
[email protected]:81:41156
[email protected]:81:52479
[email protected]:81:78041
[email protected]:81:77943
[email protected]:81:77708
[email protected]:81:74696
Sa@[native code]
[email protected]:81:25302
[email protected]:81:93216
[email protected]:81:12945
[email protected]:1122:309
[email protected]:1122:724
[email protected]:1122:149
[email protected]:2692:1608
index.android.bundle:2638:366
[email protected]:2013:4962
index.android.bundle:2013:6131
[email protected]:107:746
index.android.bundle:107:2101
[email protected]:107:746
[email protected]:107:1233
index.android.bundle:107:1389
index.android.bundle:101:618
index.android.bundle:101:645
index.android.bundle:110:1748
[email protected]:110:496
[email protected]:110:886
[email protected]:110:3148
[email protected]:61:2874
index.android.bundle:61:965
[email protected]:61:2510
[email protected]:61:923
value@[native code]
value@[native code]
@PIG208 PIG208 added bug severe: crash The app quits, or stops responding. a-message list labels Sep 26, 2024
@gnprice
Copy link
Member

gnprice commented Oct 18, 2024

Thanks for the report.

Looking at the code around the error, it's thrown because we've breached the invariant that state.narrows contains only message IDs that appear in state.messages.

And looking at narrowsReducer.js which maintains state.narrows, I see the bug there: it's that when we receive an event saying a message was starred, we add it unconditionally to the state.narrows entry for the starred-messages narrow (if we have such an entry), without checking if the message appears in state.messages.

It looks like the same issue also applies to events saying a message gained a mention flag.

It'd be possible to fix this bug. But I think this situation is rare, which is consistent with the fact that we haven't heard a report of it before. Given that and that this app is in maintenance mode, I think we won't fix it in this codebase and will instead indirectly fix it by finishing and launching the new zulip-flutter app.

@gnprice
Copy link
Member

gnprice commented Oct 18, 2024

Meanwhile, taking this as an opportunity to avoid a similar bug in zulip-flutter:

The zulip-flutter analogue of state.narrows is MessageListView, the view-model for a message list. It doesn't currently respond to UpdateMessageFlagsEvent, so this doesn't arise. When we add that functionality, the most obvious thing will be to handle it the same way we handle messages getting moved into a channel or topic narrow, which is already conservative about preventing this sort of issue:

  void _messagesMovedIntoNarrow() {
    // If there are some messages we don't have in [MessageStore], and they
    // occur later than the messages we have here, then we just have to
    // re-fetch from scratch.  That's always valid, so just do that always.
    // TODO in cases where we do have data to do better, do better.
    _reset();
    notifyListeners();
    fetchInitial();
  }

I'll also make a note in the relevant issue, to make sure we watch for this potential bug. (… Actually it looks like we didn't quite have such an issue in the tracker; just filed zulip/zulip-flutter#1006 for it.)

@mayankdhangar2408

This comment was marked as spam.

@gnprice

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-message list bug severe: crash The app quits, or stops responding.
Projects
None yet
Development

No branches or pull requests

3 participants