firefox-ios icon indicating copy to clipboard operation
firefox-ios copied to clipboard

Bugfix FXIOS-31023 [Logins] Fix crash when multiple addLogin calls race across threads

Open Aniket-pd opened this issue 3 weeks ago โ€ข 2 comments

:scroll: Tickets

Jira ticket Github issue

:bulb: Description

Wraps storage/FFI calls in RustLogins with dispatch to the serial queue after getStoredKey to prevent race conditions. Adds a concurrent test to verify multiple logins can be added safely.

:pencil: Checklist

  • [x] I filled in the ticket numbers and a description of my work
  • [x] I updated the PR name to follow our PR naming guidelines
  • [x] I ensured unit tests pass and wrote tests for new code
  • [ ] If working on UI, I checked and implemented accessibility (Dynamic Text and VoiceOver)
  • [ ] If adding telemetry, I read the data stewardship requirements and will request a data review
  • [ ] If adding or modifying strings, I read the guidelines and will request a string review from l10n
  • [ ] If needed, I updated documentation and added comments to complex code

Aniket-pd avatar Dec 07 '25 22:12 Aniket-pd

Messages
:book: Project coverage: 37.66%

๐Ÿ’ช Quality guardian

1 tests files modified. You're a champion of test coverage! ๐Ÿš€

๐Ÿงน Tidy commit

Just 2 file(s) touched. Thanks for keeping it clean and review-friendly!

โœ… Per-file coverage

All changed files meet the threshold of 35.0%.

libStorage.a: Coverage: 54.52

File Coverage
RustLogins.swift 37.48% โš ๏ธ

Generated by :no_entry_sign: Danger Swift against 5f2a5f7328949d8a776aec598b2a25f640598798

mobiletest-ci-bot avatar Dec 08 '25 17:12 mobiletest-ci-bot

This pull request has conflicts when rebasing. Could you fix it @Aniket-pd? ๐Ÿ™

mergify[bot] avatar Dec 09 '25 18:12 mergify[bot]

Nice work @Aniket-pd, thanks for taking this ticket on!

It makes more sense to jump back to the queue for the work in the completion blocks.

One issue I noticed. When I ran the full test suite (or even the full test class) locally, your test passed just fine. Now, as I was about to try running it repeatedly, I noticed it crashes when I run even just once individually. Are you able to see this crash as well? ๐Ÿค”

Image

Yes, Iโ€™m able to reproduce the crash locally as well when running the test individually Iโ€™ll investigate the cause

Aniket-pd avatar Dec 10 '25 21:12 Aniket-pd

Hi @Aniket-pd , looks like we have some compiler errors building the unit test suite. Could something maybe have gotten changed after the merge conflicts were addressed?

โŒ  /Users/[REDACTED]/git/firefox-ios/Storage/Rust/RustLogins.swift:227:20: type 'RustLogins' does not conform to protocol 'LoginsProtocol'

public final class RustLogins: LoginsProtocol, KeyManager, @unchecked Sendable {
                   ^

ih-codes avatar Dec 16 '25 17:12 ih-codes