News for hackers. Stuff that matters.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by yreg on Friday July 10, 2020 @10:36AM (#23791853)
The apps are broken serverside by Facebook. No amount of testing (automated or not) on the side of the app developers would have prevented this.

Facebook's own apps did not break since they are on the latest version of FBSDK.

What Facebook needs to do is to test whether their changes don't break other people's apps.

Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by emerongi on Friday July 10, 2020 @10:46AM (#23791967)
1. Server-side APIs can be versioned. If an old version is somehow changed, I would call it plain malpractice and in some other industries your license to practice could be stripped.

2. Client-side SDKs can be designed in a way that even if the server-side changes (which it shouldn't), it does not cause the whole application to crash. This can of course be hard depending at which level the SDK operates and how integrated it is into the app.

3. Are there no contracts between Google/Spotify/etc and Facebook? If I were FB and there were contracts on the line, I would make sure that there is no way something like this can slip through (automated testing).

Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by rv-de on Friday July 10, 2020 @11:07AM (#23792233)
> What Facebook needs to do is to test whether their changes don't break other people's apps.

I'd argue this is at the very core of why you test. I mean this problem is as simple as (n+1).m vs n.(m+1) in terms of versioning vs revisioning.

If that is not being tested then I'd say Facebook isn't actually testing at all - at least not in a practically relevant sense ...

... despite the shit-load of YouTube videos from FB devs lecturing about CI/CD and what not.

Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by jayd16 on Friday July 10, 2020 @12:22PM (#23793118)
Sounds like you have it backwards. They use other people's apps to test whether their changes break Facebook.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by mrtksn on Friday July 10, 2020 @10:50AM (#23792016)
It is not acceptable to have your client crash due to server-side stuff going on. When the server is faulty the client must handle that gracefully, like disabling the functionality or displaying a message about what is wrong if no further use is possible due to the error.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by linux2647 on Friday July 10, 2020 @10:43AM (#23791930)
I disagree. While, yes, Facebook needs to test their SDK, app developers need to build resiliency into their apps to ensure third party dependencies don’t break their app. The developer adopted it into their app; it’s their responsibility to do the proper checks in cases like these where Facebook broke things on their end.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by monocularvision on Friday July 10, 2020 @10:48AM (#23791991)
This is a native SDK that is crashing the process. There is nothing an app developer can responsibly do to prevent or recover from this crash.

Other than remove the SDK, of course.

Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by hyko on Friday July 10, 2020 @11:39AM (#23792643)
Yes there is: a remote kill switch that prevents the third party SDK from loading. That puts you back in control of the software you’re shipping.

Fool me once, and all that.

Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by saagarjha on Friday July 10, 2020 @12:01PM (#23792882)
You have to be technically competent enough to know how to dynamically load a framework, though.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by liuliu on Friday July 10, 2020 @01:52PM (#23794256)
And most SDKs are provided as static frameworks. You have to be technically competent to know how to wrap a static framework as dynamic, and then use dlopen to load them properly with a rather high one-time runtime cost. A mess.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by bognition on Friday July 10, 2020 @12:29PM (#23793201)
For a tech company with a multi-billion dollar valuation this shouldn't be insurmountable
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by saagarjha on Friday July 10, 2020 @01:00PM (#23793590)
Facebook knows how dynamic loading works. (At least, I think so…) However, their many clients may not, as a lot are not multi-billion dollar companies.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by XCSme on Friday July 10, 2020 @10:56AM (#23792099)
So there is no way to try {} catch {} it, right?
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by Sephiroth87 on Friday July 10, 2020 @11:00AM (#23792156)
Not in this case, as it's not code explicitly called by the client, but automatically loaded on app launch...
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by saagarjha on Friday July 10, 2020 @12:02PM (#23792892)
Yes, but 1. it’s hard to inject that as the crash happens very early at launch and 2. Objective-C exceptions of this type are not intended to be caught.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by robterrell on Friday July 10, 2020 @12:54PM (#23793516)
That's not strictly true, and anyway it's different for the app developer versus a library provider. If you're making a 3rd party SDK that can throw, you need to make it can catch those throws.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by saagarjha on Friday July 10, 2020 @01:05PM (#23793659)
NSInvalidArgumentException is not intended to be caught. You can, of course, but receiving one indicates a serious run-time error.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by valuearb on Friday July 10, 2020 @11:59AM (#23792865)
If it's an objective C exception, you can catch those with an objective c wrapper function. Ive done that before in my Swift projects.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by ryandrake on Friday July 10, 2020 @05:15PM (#23796560)
> Other than remove the SDK, of course.

Bingo! App developer voluntarily pulled in a dependency which they didn't fully understand. When you bring in a dependency, it's not still someone else's code/problem, it becomes your problem.

Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by corndoge on Friday July 10, 2020 @10:46AM (#23791959)
Ah yes.

If hacker news goes down while you are writing this comment, it is your responsibility to ensure you can still post your comment despite the service breakage.

Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by slipheen on Friday July 10, 2020 @10:59AM (#23792138)
Unless your app is designed for browsing Facebook, there's no reason that anything on Facebook's servers should affect if your app works.

Many of the apps crashing are using Facebook for a portion of their app, such as one login option.

Letting that take down the whole app is insufficiently defensive coding, whether in the app, sdk, or glue between them.

Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by frenchy on Friday July 10, 2020 @11:24AM (#23792435)
> there's no reason that anything on Facebook's servers should affect if your app works.

Absolutely, but the problem is that in order for you to use these features, you're supposed to use the official Facebook SDK. The additional problem, is that Facebook has no interest in defensive coding, because if you're not interacting with Facebook in an app, there's no benefit to Facebook for you using that app at all.

Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by corndoge on Friday July 10, 2020 @11:19AM (#23792373)
How do you defend against abort() in library code?
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by Nextgrid on Friday July 10, 2020 @11:35AM (#23792577)
Don't include libraries which contain such code?
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by saagarjha on Friday July 10, 2020 @12:03PM (#23792905)
No abort here, the crash is coming from the runtime, which you’re not opting out of if you want your app to work.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by slipheen on Friday July 10, 2020 @06:23PM (#23797273)
Then we can agree the FB sdk should have been better written to avoid this, right?
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by corndoge on Friday July 10, 2020 @06:49PM (#23797490)
Obviously, and now we agree!
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by yreg on Friday July 10, 2020 @10:48AM (#23791980)
So how could the app developers have prevented this, other then not using the SDK? (I'm not advocating for using the SDK.)
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by mattgreenrocks on Friday July 10, 2020 @10:50AM (#23792009)
Would disabling SDK autoinit have fixed this? That was a suggestion raised back in March. Seems like a net win to avoid static initializers in the first place.

(Am not a mobile dev, but it wasn't exactly hard to find that, either).

Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by Sephiroth87 on Friday July 10, 2020 @11:03AM (#23792178)
Maybe (although some people report that not working), but not necessarily, as "autoinit" is just an if case checked in the same auto executed code in the Facebook SDK, which could still crash before the flag is checked.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by akerro on Friday July 10, 2020 @05:12PM (#23796519)
Are you telling me that Facebook Inc. has no capacity or ability to test their own, one of the most popular SDKs in the world, in the wild? Like have a single phone connected by USB and open spotify app and simply login after they make a backend change?
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by yreg on Saturday July 11, 2020 @11:58AM (#23803112)
By app developers I mean the consumers of FBSDK, not Facebook.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by liuliu on Friday July 10, 2020 @01:47PM (#23794207)
The truth is, 1st-party apps are well-supported but 3rd-party SDKs provided by these companies, especially the ones don't generate revenues (Facebook SDK, and many others) are simply not well-supported within the organization. They are not dogfooded, they don't develop with the latest and greatest tools available for 1st-party apps, some of them have very spotty CI, and often their release schedule is not as rigorous (many 1st party apps adopted weekly release schedule).
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by nathanyz on Friday July 10, 2020 @03:29PM (#23795365)
I would disagree that the 3rd-party SDKs don't make revenue for Facebook. They likely provide additional targeting and behavioral data that feeds into their giant ad machine and lookalike audiences.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by liuliu on Sunday July 12, 2020 @12:37AM (#23808859)
That is a long chain. Internal promo doesn't work that way. That's why it is easier to get promoted when you work directly on ads.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by tpmx on Friday July 10, 2020 @12:08PM (#23792959)
Maybe don't include the Facebook SDK (Facebook Spyware Development Kit) in your tier-1 app?
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by vsareto on Friday July 10, 2020 @11:32AM (#23792536)
1. Mock dependency

2. Throw exceptions

Don't tell me "No amount of testing" just because you aren't responsible for your own dependencies.

Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by mschuster91 on Friday July 10, 2020 @11:49AM (#23792754)
You can't mock it, that is the entire point. Simply loading the shared library of the SDK will execute the broken code.
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by adamparsons on Friday July 10, 2020 @12:57PM (#23793555)
90% of people in this thread think “native code” is a react plugin
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by vsareto on Friday July 10, 2020 @01:01PM (#23793598)
I don't, but I'm fairly sure there is a solution and others just don't want to try hard enough
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by kerbs on Friday July 10, 2020 @11:29PM (#23799217)
Can validate, no reasonable way.

Removed the SDK myself from a top 100 App Store app.

Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by vsareto on Friday July 10, 2020 @12:14PM (#23793023)
So an app (which you control), is told to load a shared library, and there's no way to handle that? Even by delaying the loading to only when it'll be used?
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by mschuster91 on Friday July 10, 2020 @01:18PM (#23793840)
It's not "is told", it is "it is writen in the binary itself that the kernel/libc runtime should load the shared library".
Re:App suddenly crashing on startup due to FBSDKRestrictiveD... by saagarjha on Friday July 10, 2020 @01:48PM (#23794210)
To be fair, you don't have to do it that way. (Library loading is done by dyld, FWIW.)