News for hackers. Stuff that matters.
Re:Open-sourcing Facebook Infer: Identify bugs before you ship by guepe on Thursday June 11, 2015 @12:49PM (#9700793)
The types of issues discovered (they mention null pointer access and resource and memory leaks) is much smaller than what a tool like Coverity will find (I use it). And they analyze C and Java, two languages supported by Coverity, a very mature tool...

I am not certain of the proposed value, except it's free to other than Facebook - but not to Facebook, who pays engineers to develop this... Is this some kind of NIH syndrom by Facebook, or is there something I missed ?

Re:Open-sourcing Facebook Infer: Identify bugs before you ship by Rezo on Thursday June 11, 2015 @01:43PM (#9701149)
Coverity is great, but for example on the mid-size service (10s but not 100s of kloc) that my team works on the analysis still takes hours. Therefore we only do it for prod releases, not on every commit or CI deployment.

If you want to make static analysis part of the everyday development process, it has to be 1) very quick, ideally seconds; minutes at most 2) preferably something the developer can just run locally before pushing a change. If it's fast and easy enough, it simply becomes another code hygiene tool like a code formatter that you'll run continuously, perhaps even directly integrated into something like IntelliJ.

To me Infer sounds like a nice complement to Coverity to catch issues as close to where they are introduced as possible. It might even be Good Enough for many projects to be the only tool, since Coverity is pretty expensive.

Re:Open-sourcing Facebook Infer: Identify bugs before you ship by cactusface on Thursday June 11, 2015 @04:06PM (#9702007)
> If you want to make static analysis part of the everyday development process [...]

Just to nitpick, I think your use of the term "static analysis" is a bit too broad. Every (or almost every) production compiler or JIT does static analysis intraprocedurally, that is, confined within a function / method / procedure. On the other hand, whole program / interprocedural static analysis quickly gets very expensive, usually because an alias / pointer analysis is involved, and that's what you need for null pointer checks and stuff.

So I guess my point is, there is plenty of static analysis going on all the time, just not expensive whole program bug-finding analysis. Cheap bug-finding static analysis stuff is common, for example in GCC all those warning options to catch undefined behavior.

Re:Open-sourcing Facebook Infer: Identify bugs before you ship by theblatte on Thursday June 11, 2015 @05:34PM (#9702601)
(Infer dev here) One strength of Infer is that it is inter-procedural, yet not whole-program: each procedure gets analyzed independently. So it's cheap enough to run on large codebases while still able to find deep inter-procedural bugs.
Re:Open-sourcing Facebook Infer: Identify bugs before you ship by cactusface on Thursday June 11, 2015 @06:38PM (#9702919)
If you're analyzing procedures independently, why is it interprocedural? Interprocedural just means that you use some information about another procedure. This is expensive because if the information about one procedure changes during the analysis, you have to go and reanalyze all the dependent procedures. There are cheap but less accurate pointer analyses, is that why it's fast?
Re:Open-sourcing Facebook Infer: Identify bugs before you ship by _shb on Thursday June 11, 2015 @07:01PM (#9703006)
Infer does bottom-up analysis: it starts at the bottom of the call graph and analyzes each procedure once independently of its callers. Analyzing the procedure produces a concise summary of its behavior that can be used in each calling procedure. This means that the cost of the analysis is roughly linear in the number of nodes in the call graph, which is not true for a lot of other interprocedural analysis techniques.

It's true that it a procedure changes that you may have to re-analyze all dependent procedures (and calling procedures!) in the worst case. However, in the bottom-up scheme you only need to re-analyze a procedure when the code change produces a change in the computed summary, and in practice summaries are frequently quite stable.

Re:Open-sourcing Facebook Infer: Identify bugs before you ship by cactusface on Thursday June 11, 2015 @07:33PM (#9703118)
Cool, thanks for the details. So... what do you do about cycles?

By "change" I didn't mean code change, I meant change in the information about the procedure collected during an iteration of the fixed point computation. But from the sounds of things you aren't computing a fixed point.

For example: A calls B and B calls A. You have information A0 and B0 about A and B. Analyze B, you have information B1 about B. Then you go and analyze A using B1. This gives you A1. Now you have to redo B, and compute B2. Use this to compute A2. This carries on until the information is not changing, i.e. An = An + 1 and Bn = Bn + 1.

Re:Open-sourcing Facebook Infer: Identify bugs before you ship by theblatte on Thursday June 11, 2015 @07:48PM (#9703162)
Infer computes fixpoints whenever there is a cycle in the call graph, until it reaches stable procedure summaries or timeouts.
Re:Open-sourcing Facebook Infer: Identify bugs before you ship by cactusface on Thursday June 11, 2015 @08:42PM (#9703352)
Ok, thanks for indulging my curiosity guys!
Re:Open-sourcing Facebook Infer: Identify bugs before you ship by ribs on Friday June 12, 2015 @02:39AM (#9704374)
Blatant sales pitch: Klocwork (which I rep) is what you want. Our static analysis tool is fast enough so that your developers can run it just before a commit, but for many environments it will run when they save code, or even as they type. In a CI process you can run it on every commit. It's like a spellchecker, except that it does highly sophisticated static source code analysis.

We cover C/C++/Java/C#. The tool runs on the order of 1-2x of the speed of your build, and is integrated into Eclipse, IntelliJ, and Visual Studio. It's very, very fast, and it covers much of same ground as Coverity, and more. Mail me at [email protected] to arrange a demo.

Re:Open-sourcing Facebook Infer: Identify bugs before you ship by hornbill on Friday June 12, 2015 @03:45AM (#9704532)
You might want to check the desktop analysis in Coverity. It runs a complete analysis at the first time. But afterwards, it can run analysis on the changes - but against a version present on your build server. I had set this up for a code base in C (>100Kloc) and desktop analysis was fast enough.
Re:Open-sourcing Facebook Infer: Identify bugs before you ship by jetru on Thursday June 11, 2015 @04:11PM (#9702044)
Have you tried Coverity Desktop analysis? It'll let you run Coverity on your code incrementally(for only code changes), assuming you already have a baseline.
Re:Open-sourcing Facebook Infer: Identify bugs before you ship by Lewisham on Thursday June 11, 2015 @01:41PM (#9701136)
Coverity was evaluated a number of times at Google, and IIRC we decided it wasn't going to scale to the codebase size we needed it to. A separate and unrelated effort ended up with us building Tricorder [1].

Often perceived NIH at large companies for this sort of thing is simply a byproduct of scale that is unreasonable for external companies to have to worry about supporting.

[1] http://research.google.com/pubs/pub43322.html

Re:Open-sourcing Facebook Infer: Identify bugs before you ship by ixtli on Friday June 12, 2015 @01:54AM (#9704283)
Your second point is very good; I get the feeling that NIH is simply a buzzword at the moment. Especially since a cursory glance Infer's source code will show that it was, in fact, invented somewhere else and purchased by Facebook.
Re:Open-sourcing Facebook Infer: Identify bugs before you ship by Alupis on Thursday June 11, 2015 @01:08PM (#9700934)
Findbugs is also very good for Java apps, and is free. (Developed by the University of Maryland)[1]

[1] http://findbugs.sourceforge.net/

Re:Open-sourcing Facebook Infer: Identify bugs before you ship by hbhakhra on Friday June 12, 2015 @03:08AM (#9704440)
These sorts of tools can get very annoying with their excessive warnings, but when they work, they save tons of time. We faced one bug at work where when multiple users were making a search at the same time, you would get bogus results back. With one user it would work consistently. We spent weeks tracking this downs and the problem:

== instead of .equals() in Java

The thing is, we were used to ignoring find bugs, but lo and behold it had pointed this problem out.

Re:Open-sourcing Facebook Infer: Identify bugs before you ship by pkaye on Thursday June 11, 2015 @01:41PM (#9701141)
Some of these tools (like Coverity) can be very comprehensive yet slow and expensive. We do our checking in layers like lint, memory check tools on every checkin and slower and expensive tools on a hourly/nightly basis.
Re:Open-sourcing Facebook Infer: Identify bugs before you ship by tptacek on Thursday June 11, 2015 @01:28PM (#9701064)
Isn't Coverity expensive?
Re:Open-sourcing Facebook Infer: Identify bugs before you ship by Locke1689 on Thursday June 11, 2015 @02:16PM (#9701322)
I would say a Coverity installation at Facebook is probably a "let's talk" level of expensive.

That said, paying a team of expert engineers is also very expensive, not to mention the opportunity cost.

Re:Open-sourcing Facebook Infer: Identify bugs before you ship by tptacek on Thursday June 11, 2015 @02:21PM (#9701348)
Right, and for Facebook internally, whatever the number is, it's a speed bump.

But some reasons not to use Coverity then:

* Doing it in-house gives Facebook near total control over what the system is going to focus on; they can tailor it exactly to their problem set.

* It's a worthwhile open source project, since most values of "expensive" mean "other projects won't ever use it".

* If it gets any traction as an open source project, they can draft off the work other people will put into it.

Re:Open-sourcing Facebook Infer: Identify bugs before you ship by Locke1689 on Thursday June 11, 2015 @02:42PM (#9701466)
I'd add

* Facebook has recently hired a number of expert language theorists and practitioners. Doing it in-house

  1) Gives them something to do

  2) Serves to cement Facebook's language-expertise-brand recognition and dominance.
The very fact that hiring is focusing on this group signals to me that this is an area which Facebook takes seriously and wants to be taken seriously in.
Re:Open-sourcing Facebook Infer: Identify bugs before you ship by mschuster91 on Friday June 12, 2015 @07:47AM (#9705269)
If Facebook ever goes down as a social network, they will without doubt still be a powerful technology company.

FB has achieved a vertical integration in the IT world rivaled only by Google, Apple and maybe MS.

Re:Open-sourcing Facebook Infer: Identify bugs before you ship by justincormack on Thursday June 11, 2015 @07:32PM (#9703113)
It is free for open source projects, but yes expensive otherwise.
Re:Open-sourcing Facebook Infer: Identify bugs before you ship by xjia on Thursday June 11, 2015 @06:49PM (#9702964)
What is the underlying theory behind Coverity? Is it based on separation logic as well?
Re:Open-sourcing Facebook Infer: Identify bugs before you ship by buttproblem on Thursday June 11, 2015 @10:00PM (#9703589)
I'd be interested in this as well; all I could find on their site is that it is uses "patened techniques." Considering the first seperation logic paper was published in 2001 [1] and Coverity founded in 2002 [2], they probably did not (at least originally) use the same techniques.

I'm guessing their site is designed to sell to people and not have the details.

[1] http://fbinfer.com/docs/separation-logic-and-bi-abduction.ht... [2] https://en.wikipedia.org/wiki/Coverity

Re:Open-sourcing Facebook Infer: Identify bugs before you ship by cma on Thursday June 11, 2015 @10:03PM (#9703599)
how does the post positive break compare?
Re:Open-sourcing Facebook Infer: Identify bugs before you ship by cma on Friday June 12, 2015 @02:36PM (#9707735)
Sorry.. should have read "false positive rate"
Re:Open-sourcing Facebook Infer: Identify bugs before you ship by Cthulhu_ on Thursday June 11, 2015 @02:21PM (#9701349)
> Is this some kind of NIH syndrom by Facebook?

Facebook employs thousands of developers and has a product that is pretty much done (or, IDK what they spend all their development budget on atm); they have the room to create new tools. TBF though, if this was a hobby project that wasn't linked to Facebook, it wouldn't get the attention it is getting right now.