这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@philipphofmann
Copy link
Member

📜 Description

Writing data to disk when the file handle is broken causes crashes. This is fixed now by capturing an exception.

💡 Motivation and Context

Fixes GH-2548

💚 How did you test it?

Unit tests.

📝 Checklist

  • I reviewed the submitted code
  • I added tests to verify the changes
  • I updated the docs if needed
  • Review from the native team if needed
  • No breaking changes

🔮 Next steps

Writing data to disk when the file handle is broken caused crashes.
This is fixed now by capturing an exception.

Fixes GH-2548
@philipphofmann philipphofmann changed the base branch from 8.0.0 to master December 22, 2022 18:46
Copy link
Member

@armcknight armcknight left a comment

Choose a reason for hiding this comment

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

Mostly looks fine, but I do wonder about how the breadcrumb counter is maintained. The other comments are not blockers, just suggestions.

self.breadcrumbCounter = 0;
@try {
[self.fileHandle seekToEndOfFile];
[self.fileHandle writeData:data];
Copy link
Member

Choose a reason for hiding this comment

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

We should use the newer one with an inout error in addition to wrapping in try, since this one’s deprecated and the error parameter might catch additional info or be used instead of an exception, which would help performance.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but this one only works on iOS 13.0 and above, see https://developer.apple.com/documentation/foundation/nsfilehandle/3172533-writedata

Copy link
Member Author

Choose a reason for hiding this comment

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

I would create a follow-up issue for using the new APIs, is that fine for you?

Copy link
Member

Choose a reason for hiding this comment

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

Sure, that’s fine!

@github-actions
Copy link
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1219.57 ms 1247.92 ms 28.35 ms
Size 20.76 KiB 375.15 KiB 354.39 KiB

Baseline results on branch: master

Startup times

Revision Plain With Sentry Diff
c929040 1254.84 ms 1278.42 ms 23.58 ms
c2a9b60 1222.10 ms 1240.62 ms 18.52 ms
8607e67 1255.80 ms 1259.50 ms 3.70 ms
1453a8a 1224.98 ms 1250.31 ms 25.33 ms
9754750 1234.71 ms 1265.21 ms 30.49 ms
9ad4a5f 1251.53 ms 1276.46 ms 24.93 ms
864c39a 1191.14 ms 1233.38 ms 42.24 ms
4a66f00 1224.73 ms 1241.14 ms 16.41 ms
e958899 1230.40 ms 1248.31 ms 17.91 ms
944bebe 1252.12 ms 1264.88 ms 12.76 ms

App size

Revision Plain With Sentry Diff
c929040 20.51 KiB 333.10 KiB 312.59 KiB
c2a9b60 20.50 KiB 333.54 KiB 313.04 KiB
8607e67 20.50 KiB 338.99 KiB 318.49 KiB
1453a8a 20.50 KiB 361.89 KiB 341.39 KiB
9754750 20.75 KiB 374.16 KiB 353.41 KiB
9ad4a5f 20.50 KiB 342.23 KiB 321.73 KiB
864c39a 20.51 KiB 335.57 KiB 315.06 KiB
4a66f00 20.51 KiB 331.79 KiB 311.28 KiB
e958899 20.51 KiB 331.92 KiB 311.41 KiB
944bebe 20.75 KiB 374.39 KiB 353.64 KiB

@philipphofmann philipphofmann merged commit 628acb3 into master Dec 22, 2022
@philipphofmann philipphofmann deleted the fix/scope-observer-crash branch December 22, 2022 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash: No space left on device exception not handled

4 participants