Creating and analyzing Heap Dumps is a standard for analyzing memory issues with JVM based programs. To do this, you have to:
- create the Heap Dump (duh!)
- move the data to your computer
- actually analyze the data
Each of these steps has it's own challenges though the first two seem trivial at first sight.
Creating the Heap Dump
The main challenge in Heap Dump creation I faced in today's production environments is that only essential software is installed in order to keep containers and the potential attack surface small. So likely there is only a JVM which is enough to run the program but not enough to get a Heap Dump. Through the recommendation of a colleague I became aware of jattach. It describes itself as:
[Read More]Fixing the problem of too many tabs
Tab mayhem and windows inflation
How many browser tabs are open on your browser right now? Too many to count? Let
me guess: Rows and rows of tabs belonging to different research tasks that you
want to pick up later. The occasional tab on social network. That
store you still have a cart open with that thing you maybe want to buy. Some
are still relevant but many are not.

The last version manager you'll ever need
Chances are high you have already used tfenv, pyenv, SDKMAN!, rbenv, nvm or some
other version manager. In case you haven't: A version manager is a program that
let's you install multiple versions of a tool for different contexts: Your one
project needs version X, the other version Y.alpha. Just the tool in one
version all the time does not cut it as different versions behave differently.
So if people work on the same project with different versions of core tools, it
often gets messy:
Why does MaxRAMPercentage stop working at heaps of ~ 30 GB?
The other day at work a Clojure program on a machine with 100 GB ran into OutOfMemory errors. A quick look at the metrics showed that the heap was only at about 30 GB though. Checking the JVM flags I found a configuration that is commonplace:
-XX:MaxRAMPercentage=80So one would assume that the JVM could have sized the heap much larger than it actually did. Thanks to docker this behavior can be observed quite easily by doing a few tests like this one:
[Read More]Create downtimes with Instance Refresh for EC2 Auto Scaling
When AWS launched Instance Refresh for EC2 Auto Scaling last year my colleagues and me were delighted: Should we be able to retire our half baked and mostly working lambda for restarting ec2 instances and hand this over to AWS Auto Scaling?
I think we were not the only ones looking forward to this: Auto Scaling groups is an extremely popular option of the most popular AWS service (EC2) of the biggest cloud provider in the world. At the same time all of these many customers are responsible to use a recent machine image with current security patches. That means refreshing instances in an Auto Scaling Group is something anybody out there needs to do on a regular basis1 and anybody who does not like busywork will automate the process.
[Read More]Do you ever forget to push your git commits?
The title of this post is a rhetorical question. At least I think it is. Or I like to think it is. What I can say with certainty is that I forgot my fair share of pushes. π
Sometimes I was the one tripping over my own mistake (Why is that commit not live? Ah, because the pipeline did not run. Because I did not push. facepalm). Sometimes my colleagues had to find out.βΊοΈ
[Read More]Notifications for failed cron jobs
Every few years when I setup a new computer I stumble over the same question: "How do I get notified of failed cron jobs again?". It is pretty simple, but as I tripped over it again today, here is a little write-up so I do not have to google this again. Or potentially I will and then hopefully this post will turn up in the search results.π
As cron is an old program from the days where the server use case was the predominant one, it will send emails with the output it's jobs will produce. Now I don't want my desktop machine to send emails over the internet to myself about broken jobs, when I am working on the very same machine at the same time.
[Read More]Create virtualenvs in project directories
It's quite handy to create the virtual environment aka venv for a python project in the project folder itself. This means:
- No huge
.virtualenvsfolder in your home directory with a lot of envs which you will never use again (The one on this computer is 1.2 GB big although I do not work with many Python projects at all(!)). If you are done with a project and delete all local files, the corresponding environment will be gone with it. - Pointing your editor/IDE to the current virtual env as well as deleting it is easy, because it is right there in the project root folder.
As there are many tools in this realm, obviously every one of them handles things a little bit differently and it is the default for none of the popular ones:
[Read More]Why does poetry not use the specified Python version?
TL;DR: There is only one way to install poetry proper and that is with the installer script provided by the project itself.
I was sweating for the better part of an afternoon with a colleague about this.
I had installed poetry, the new star in the python tooling world and it kept
using the global version of Python instead the one for the project at hand,
though poetry's own pyproject.toml specifies it. It was quite a frustrating
experience.
Missing system modules in Python
I got to work on a Python code-base in the last days and have been struggling to get to a stable development environment. I learned some lessons along the way. Here is one of them, as it seems to be rather common and causes headaches for many people (a simple search has a whopping half a million hits on Google).
The error
ModuleNotFoundError: No module named '_lzma'
I found this error at the bottom of a very long stack trace after running a unit test. That was suprising as the tests had worked fine before. I stashed all current changes, but the error persisted. I recognized that the lzma module is part of the standard library. I could not find the module _lzma though. It turned out that the problem could be reproduced with a simple import statement:
[Read More]