Skip to main content
Engineering, Backend

NilAway: Practical Nil Panic Detection for Go

November 15, 2023 / Global
Featured image for NilAway: Practical Nil Panic Detection for Go
Image
Figure 1: Nil panic error message
Image
Figure 2: from fixing a nil panic in its net package (). The nil panic is caused by calling method String() on the return of RemoteAddr() on L1859, which can be a nil interface value (as shown in Figure 3)
Image
Figure 3: Excerpt from showing the net.Conn interface and the implementation of the RemoteAddr() method by the struct net.conn, which can return nil, if c.ok() is false
Image
Figure 4: Excerpt from the implication graph built by NilAway representing the nil flow for the example in Figure 2.
Image
Figure 5: Error message reported by NilAway for the unsafe flow in Figure 2
Image
Figure 6: Architecture of NilAway.
Image
Figure 7: Simplified and redacted code excerpt from an internal Uber service logging 3000+ nil panics per day in production.
Image
Figure 8: Complete addressal of the 3000+ nil panics being logged per day in production.
Sonal Mahajan

Sonal Mahajan

Sonal Mahajan is a Senior Software Engineer on Uber’s Programming Systems team. Her research interests cover software engineering and artificial intelligence, with a particular focus on using program analysis and machine learning to develop automated tools for improving code quality, reliability, and developer productivity.

Yuxin Wang

Yuxin Wang

Yuxin Wang is a Software Engineer on Uber’s Programming Systems team. His research interests include general static analysis, software verification, and program repair and synthesis. His current work includes building fast tooling for improving software reliability, as well as automated code review tools for developer productivity.

Lazaro Clapp

Lazaro Clapp

Lazaro Clapp is a Staff Engineer and TLM on Uber's Programming Systems team. His current focus is on improving application reliability using fast type-system based tools. His broader research interests include general static and dynamic analysis, modeling of third-party code behavior, and automated testing and code repair. https://lazaroclapp.com/

Raj Barik

Raj Barik

Raj Barik is a former Principal Engineer and TLM in the Programming Systems group at Uber. He led the Programming Systems group and delivered a number of impactful program analysis tools to reduce infrastructure cost, improve code quality, and increase developer velocity. His broad research interests include Programming Languages, Program analysis, Compilers, and Performance optimization tooling.

Posted by Sonal Mahajan, Yuxin Wang, Lazaro Clapp, Raj Barik