Talks

Debugging Applications in Production:
The Crazy Way

Sergio Guillen Mantilla
@donkeysharp

Warning

Warning

This could be boring

Warning

This could be boring

Let's try to make it
not that boring :)

When there is an unexpected behavior in your application that's already been deployed... what's the first thing you do?

... and then?

... and then?

maybe a settings file?

xtime.override.properties

... and then?

maybe a settings file?

xtime.override.properties

check OS's settings?

  • Network
  • Some service settings
  • HDD
  • Memory
  • Hardware
  • Kernel Version

Let's use a profiling tool
for...

Let's use a profiling tool
for...

JVM

Perl

Ruby

.NET

Python

PHP

Erlang

NodeJS

Go

But remember...

But remember...
this talk is about
the crazy way!

In all of this, there is a key component in common

The Operating System

Free BSD

Linux

OSX

Solaris

UNIX

File Descriptors

All I/O related tasks on a Unix-like OS are represented with file descriptors.

A file descriptor is an integer id per process that can represent an open file, a pipe, a socket listening for connections, a connection to a socket, etc.

DEMO

POSIX

Portable Operating System Interface

Which means...
A common set of syscalls

  • same name
  • same parameters
  • same output type
  • same purpose

Something that may differ is the way they are implemented

Cool, but what is a syscall?

Cool, but what is a syscall?

It's the programmatic way that we can ask the kernel to do something for us
e.g. open a file, allocate memory, create a process, etc. 

Cool, but what is a syscall?

It's basically a function that can be called from assembly, C/C++, or any other programming language

Nice theory lesson but...

Nice theory lesson but...
how can this help me solve my Jira ticket?

Strace

strace is a tool that attach to a process (new or in execution) with the purpose of tracing all the system calls the process does during its execution

Strace

strace is a tool that attach to a process (new or in execution) with the purpose of tracing all the system calls the process does during its execution

$ strace command

$ strace -p <PID>

DEMO

Is it only strace?

Crazy stuff the easy way?

Crazy stuff the easy way?

Ask Julia Evans

https://jvns.ca/zines/

ptrace

Q&A

blog.donkeysharp.xyz

Debugging Applications in Production

By Sergio Guillen

Debugging Applications in Production

  • 217