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

feat: network observer cover from not connected and blocked to connected (WPB-11200) #3057

Merged
merged 6 commits into from
Oct 15, 2024

Conversation

yamilmedina
Copy link
Contributor

@yamilmedina yamilmedina commented Oct 11, 2024

SpikeWPB-11200 [Android] investigate the posintial of connectivity observer blocking sync


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

There is one case that seems to be not covered by the network state observer being:

Not connected -> to Unblocked = Connected

Causes (Optional)

Potentially hanging the state until a new connected state is triggered.

Solutions

Covering all grounds by adding this case and some logs to help debugging in datadog

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

Notes (Optional)

For now I'm testing this in an local build, to gather logs and monitor improvements


PR Post Submission Checklist for internal contributors (Optional)

  • Wire's Github Workflow has automatically linked the PR to a JIRA issue

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

@yamilmedina yamilmedina requested review from a team, m-zagorski, alexandreferris, borichellow, MohamadJaara, damian-kaczmarek, Garzas and saleniuk and removed request for a team October 11, 2024 17:51
Copy link
Contributor

github-actions bot commented Oct 11, 2024

Test Results

3 235 tests  +16   3 129 ✅ +16   3m 58s ⏱️ +16s
  552 suites ± 0     106 💤 ± 0 
  552 files   ± 0       0 ❌ ± 0 

Results for commit c3b21fd. ± Comparison against base commit fc3f3e3.

This pull request removes 1 and adds 17 tests. Note that renamed tests count towards both.
com.wire.kalium.logic.data.conversation.ConversationRepositoryTest ‑ givenAGroupConversationHasNewMessages_whenObservingConversationListDetails_ThenCorrectlyGetUnreadMessageCount[jvm]
com.wire.kalium.logic.data.conversation.ConversationMapperTest ‑ givenArchivedConversationWithDraftAndLastMessage_whenMappingFromDAODetailsWithEventsToModel_thenReturnProperLastMessage[jvm]
com.wire.kalium.logic.data.conversation.ConversationMapperTest ‑ givenConversationWithDraftAndLastMessage_whenMappingFromDAODetailsWithEventsToModel_thenReturnProperLastMessage[jvm]
com.wire.kalium.logic.data.conversation.ConversationMapperTest ‑ givenConversationWithLastMessage_whenMappingFromDAODetailsWithEventsToModel_thenReturnProperLastMessage[jvm]
com.wire.kalium.logic.data.conversation.ConversationMapperTest ‑ givenConversationWithNoLastMessageAndDraft_whenMappingFromDAODetailsWithEventsToModel_thenReturnProperLastMessage[jvm]
com.wire.kalium.logic.data.conversation.ConversationRepositoryTest ‑ givenAConversationHasLastMessageAndDraft_whenObservingConversationListDetails_ThenCorrectlyGetLastMessage[jvm]
com.wire.kalium.logic.data.conversation.ConversationRepositoryTest ‑ givenAOneToOneConversationHasNewMessages_whenObservingConversationListDetails_ThenCorrectlyGetUnreadMessageCount[jvm]
com.wire.kalium.persistence.dao.ConversationDAOTest ‑ givenAGroupConvWhichSelfUserLeft_whenGettingAllConversationsWithEventsAndOnlyEnabledInteractions_thenDoNotReturnIt[jvm]
com.wire.kalium.persistence.dao.ConversationDAOTest ‑ givenAOneOneConvWithDeletedUser_whenGettingAllConversationsWithEventsAndOnlyEnabledInteractions_thenDoNotReturnIt[jvm]
com.wire.kalium.persistence.dao.ConversationDAOTest ‑ givenArchiveConversationWithUnreadMessageAndDraft_whenGettingAllConversationsWithEvents_thenShouldReturnCorrectValues[jvm]
com.wire.kalium.persistence.dao.ConversationDAOTest ‑ givenConnectionRequest_whenGettingAllConversationsWithEventsAndOnlyEnabledInteractions_thenDoNotReturnIt[jvm]
…

♻️ This comment has been updated with latest results.

Copy link
Contributor

github-actions bot commented Oct 11, 2024

🐰 Bencher Report

Branchfeat/network-observer
Testbedubuntu-latest

⚠️ WARNING: The following Measure does not have a Threshold. Without a Threshold, no Alerts will ever be generated!

Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the --ci-only-thresholds CLI flag.

Click to view all benchmark results
BenchmarkLatencynanoseconds (ns)
com.wire.kalium.benchmarks.logic.CoreLogicBenchmark.createObjectInFiles📈 view plot
⚠️ NO THRESHOLD
680,129.39
com.wire.kalium.benchmarks.logic.CoreLogicBenchmark.createObjectInMemory📈 view plot
⚠️ NO THRESHOLD
324,488,051.38
com.wire.kalium.benchmarks.persistence.MessagesNoPragmaTuneBenchmark.messageInsertionBenchmark📈 view plot
⚠️ NO THRESHOLD
934,174,437.83
com.wire.kalium.benchmarks.persistence.MessagesNoPragmaTuneBenchmark.queryMessagesBenchmark📈 view plot
⚠️ NO THRESHOLD
21,192,383.44
🐰 View full continuous benchmarking report in Bencher

@codecov-commenter
Copy link

codecov-commenter commented Oct 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 52.23%. Comparing base (fc3f3e3) to head (c3b21fd).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3057      +/-   ##
===========================================
- Coverage    52.43%   52.23%   -0.20%     
===========================================
  Files         1309     1314       +5     
  Lines        50337    50951     +614     
  Branches      4671     4724      +53     
===========================================
+ Hits         26394    26616     +222     
- Misses       22055    22440     +385     
- Partials      1888     1895       +7     

see 24 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fc3f3e3...c3b21fd. Read the comment docs.

@datadog-wireapp
Copy link

datadog-wireapp bot commented Oct 11, 2024

Datadog Report

Branch report: feat/network-observer
Commit report: 45bdff5
Test service: kalium-jvm

✅ 0 Failed, 3129 Passed, 106 Skipped, 15.73s Total Time

Copy link
Contributor

@damian-kaczmarek damian-kaczmarek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to produce this strange state where there is no connection but app do not register that. @yamilmedina Do you think this is a part of this problem or separate issue?

How to reproduce:

  • airplane mode on
  • wait a little bit
  • airplane mode off
  • quickly airplane mode on
strange_network.mp4

@yamilmedina
Copy link
Contributor Author

I was able to produce this strange state where there is no connection but app do not register that. @yamilmedina Do you think this is a part of this problem or separate issue?

How to reproduce:

  • airplane mode on
  • wait a little bit
  • airplane mode off
  • quickly airplane mode on

strange_network.mp4

Thanks for the repro info, indeed this case we are trying to cover from many sides, so it is somewhat related.
I will take a look and see if I can include the fix on this PR or maybe create a new ticket if there is more work to do, since this spike would be an option too :D

Copy link

@yamilmedina
Copy link
Contributor Author

yamilmedina commented Oct 14, 2024

I was able to produce this strange state where there is no connection but app do not register that. @yamilmedina Do you think this is a part of this problem or separate issue?

How to reproduce:

  • airplane mode on
  • wait a little bit
  • airplane mode off
  • quickly airplane mode on

strange_network.mp4

Ok, I investigated further, and the issue can happen after the second time in airplane mode (it does no matter if it's quick or not, at least for me). In the worst case, this gets short-circuited after ~20 seconds, when the websocket does a ping, this happens since we delay when no connection for the incremental sync to happen.

I will create a ticket, to see how we can improve this state change, for the scope of this ticket at least is not relevant, since is related to the other case (from no network to connected) and blocking the sync because of it.

Anyway, this helped me to take a look at some buffer config we could use for this PR and having a quicker reaction back to connected state :D

Copy link
Contributor

@damian-kaczmarek damian-kaczmarek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edit: didn't noticed your comment, nvm
@yamilmedina I was still able to reproduce it, do we want separate issue for that?

image

@yamilmedina
Copy link
Contributor Author

Created a ticket for this other issue here:
https://wearezeta.atlassian.net/browse/WPB-11568

@yamilmedina yamilmedina added this pull request to the merge queue Oct 15, 2024
Merged via the queue into develop with commit b6d117d Oct 15, 2024
22 checks passed
@yamilmedina yamilmedina deleted the feat/network-observer branch October 15, 2024 09:12
@echoes-hq echoes-hq bot added the echoes: product-roadmap Work aligned with the customer-announced roadmap, targeting a specific release date. label Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
echoes: product-roadmap Work aligned with the customer-announced roadmap, targeting a specific release date. 👕 size: S type: feature ✨
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants