Looking Under the Hood of Apache Pulsar: How Good is the Code?

Looking Under the Hood of Apache Pulsar: How Good is the Code?

Apache Pulsar (incubating) is an enterprise-grade publish-subscribe (aka pub-sub) messaging system that was originally developed at Yahoo. Pulsar was first open-sourced in late 2016, and is now undergoing incubation under the auspices of the Apache Software Foundation.

Apache Pulsar (incubating) is an enterprise-grade publish-subscribe (aka pub-sub) messaging system that was originally developed at Yahoo. Pulsar was first open-sourced in late 2016, and is now undergoing incubation under the auspices of the Apache Software Foundation. At Yahoo, Pulsar has been in production for over three years, powering major applications like Yahoo! Mail, Yahoo! Finance, Yahoo! Sports, Flickr, the Gemini Ads platform, and Sherpa, Yahoo’s distributed key-value store.

One of the primary goals of the open-source software movement is to allow all users to freely modify software, use it in new ways, integrate it into a larger project or derive something new based on the original. The larger idea being that through open collaboration, we can make a software the best version of itself. So, in the spirit of innovation and improvement, we peeked behind the curtain and ran Apache Pulsar through the free static code analysis tool Embold. The results are very interesting, both from an observer's and a learner's point of view.

1. Quality Gate: Embold's Quality gate is "closed" for Pulsar mainly due to the Code Issues and Code Duplication. The overall rating score is certainly not the best, but sits at an innocuous 1.76 (5 being the best on the scale).

Overall rating

2. Code Issues: And so let's move on to some of the code issues found. The critical and high Code issues count in the modules pulsar-broker and pulsar-functions are close to 150. That's a high number worth exploring. Time to do a deep-dive. 

TheadLeak: This issue is fairly common across the entire codebase. To quote an occurrence, we see that in the Compactor class, shutdown() is missing for the executor service that manages the threadpool, indicating a thread resource leak. The tool recommends call the shutdown() once done to ensure there is no thread resource leaks.

Threadleak

_Resource Leak: _In the RuntimeUtils class, we see that close() on the resource rd is not guarded by a finally block. This means, that if there's an exception while reading the data, the resource will never get closed, indicating a leak.

java open source software testing code quality anti-patterns static analysis tools source code analysis apache pulsar code duplication code issues

What is Geek Coin

What is GeekCash, Geek Token

Best Visual Studio Code Themes of 2021

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Static Code Analysis: What It Is? How to Use It?

Static code analysis is a method of debugging by examining source code before a program is run. It's done by analyzing a set of code against a set (or multiple sets) of coding rules. Static code analysis and static analysis are often used interchangeably, along with source code analysis.

Guidelines for Java Code Reviews

Guidelines for Java Code Reviews.Get a jump-start on your next code review session with this list.

Effective Code Reviews: A Primer

Peer code reviews have increasingly been adopted by engineering teams around the world. Here are 6 tips to make the process better for teams.

Top 8 Java Open Source Projects You Should Get Your Hands-on [2021]

Top 8 Java Open Source Projects You Should Get Your Hands-on [2021]. Learning about Java is no easy feat. It’s a prevalent and in-demand programming language with applications in numerous sectors. We all know that if you want to learn a new skill, the best way to do so is through using it. That’s why we recommend working on projects.  So if you’re a Java student, then […]

How to Install OpenJDK 11 on CentOS 8

What is OpenJDK? OpenJDk or Open Java Development Kit is a free, open-source framework of the Java Platform, Standard Edition (or Java SE).