Posts

Showing posts with the label debug

Networking Troubleshooting/Debugging with Wireshark & tcpdump

Image
This is the 3rd and final post on the Apache Mina series.  I highly recommend you check out posts I and II.  tcpdump is very important networking debugging tool. tcpdump allows us to capture traffic because on a specific port. Wireshark is a visual(there is a terminal version as well) network capture and analyzer tool. We will use tcpdump to capture traffic between our mina TCP server app and a telenet client session. We will use the tcpdump capture to feed Wireshark and we will use Wireshark to understand what's going on between the client and the server on the network stack. Wireshark has a killer feature to follow TCP flow: meaning you can see all exchanges from client and server. So I made a video showing in detail this whole thing. So Let's get started.

Debug Tricks

Image
Debugging is an important tool. When it's possible to debug you have more chances to figure out the problem faster. Unfortunately not all issues are created equally and sometimes you cant debug. When you need to debug something is important to have your debug game sharp. Several engineers might consider the topic basic but as a consultant, I saw multiple times overtime people dont dominate the tools. Dominate and master your tools is important not only for productivity but also to improve your developer experience and make your life easier as an engineer.  I used Eclipse for a long time. For the last 3 months I decided to give IntelliJ a chance. A month ago I made a video about some killer stream debug trick and also how to do some configs. Today for this post I want to show some other IntelliJ Debug tricks which will make your life easier and will make debug much better and productive.

Idea: Configs and Stream Debug

Image
I work with Java for a long time. I always used eclipse. I like eclipse IDE. However I need to admit eclipse is pretty much dead, specially scala IDE wish I used a lot but unfortunate is long dead. So IntelliJ Idea is alive and has some interesting features like being alive first of all and also easily I could say performance is pretty good and you dont want need to install lots of plugins. So I made a video showing some configs that will make your life easier if you came from eclipse like me and also share some killer features for Java Streams Debug. I always like eclipse but I dont have issues using Idea, I believe 2 things. First of all changing editors, IDE is always good for experience and open your mind and secondly, you should not be attache to any language, IDE, editor or tool, these things are tools and there is the best too for the jobs, this tools dont define you and you are bigger than this tools. So the tools should serve you and not the other way around.  So Let's ...

Debugging Redis Module

Image
Lately, I'm working with custom redis-modules and I need to say: redis-modules kick ass. I started working with Cthulu and coding modules with javascript which was nice and very productive but given some of my current use cases I had to go to C. I recommend you take a look at my previous posts here:   -  Building Redis-Modules with JavaScript using Cthulhu   -  Dispatching Custom Commands with Lettuce and Redis-Modules Today I want to you how to do proper debug with Redis modules written in C language. I will be using eclipse Oxygen CPP in order to debug redis module and redis 4. Here there is a video which I recorded with a simple live demo about how to debug a redis-module project and redis. The source code is available on my GitHub . I hope this is useful for you.

Global Gradle Config for Remote Debug and IDE support

Image
Gradle right now is the standard tool for Java builds. Before gradle, pretty much everybody was using maven . Working with cloud computing very often we need do remote debugging. In this blog post, I will show how to configure remote debugging for all your gradle projects.  The nice thing about the approach I will show is that you don't need to change your build.gradle files since we will do it as a global config this will be valid for all. We also will setup configs for Eclipse and IntelliJ IDE support in the same file. Since we will configure remote debug you need to keep in mind that debug port need to be open in all security groups and firewalls in order to work.  Keep in mind remote debug is slow especially with Amazon. We will open port 9009, but you can change the port if you like. This config works with Jetty and also with Java main classes as well.

JBoss Remote Debug and Port Configuration

Image
Is quite common you need debug JBoss remotely, basically you may have an Linux server running it for Development or QA environment. In order to be able to debug JBoss in your machine you just need change one configuration file. Open the file $JBOSS_HOME \bin\run.conf in your favorite text editor an serach for this lines: # Sample JPDA settings for remote socket debugging # JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n" You new uncoment the last line, like the following sample: # Sample JPDA settings for remote socket debugging<br>JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"<br> The parameter address is the port that JBoss will be listing to remote debug. Now you can open eclipse an run and remote debug like the following sample: 1. Create a new Remote Java Application Debug configuration. 2. Select your project, remember that must be an EAR or WAR(You can use jar...