Wednesday, November 23, 2011

strace to the rescue

So today I feel like a haxor.

My coworker was having an issue with Eclipse/EGit (on linux) and it was a very cryptic error message.  So we ran an strace -p 1234 -p 1235 -p etc. -o strace.log -ff -q on his java process (not the eclipse process).  I tried a trace with -e trace=file, but we did not get much in the logs.  The full trace worked.  We searched for git in the logs and found that his .gitconfig file was missing the [user] tag at the top.  (After comparing to my .gitconfig file).  We added the [user] to the top of his file and we got past the error!  Yay!  He had created the file by himself according to some instructions that we are going to CHANGE.  LOL.

Here's a script to generate the tracer.sh command as seen above.  This is provided as is with no warranty.  Use/edit at your own risk.


#!/usr/bin/ksh


if [[ -z "$1" ]]
then
echo "Call this script with the process ID of eclipse or java."
exit
fi


pidlist=`ls -1 /proc/$1/task | sed s/^/\ -p\ / | sed s/$/\ \\\\\\\\/`
strace_cmd="strace -e trace=file $pidlist
 -o strace.log -ff -q"
echo "strace_cmd is $strace_cmd"
echo "$strace_cmd" > tracer.sh

Tuesday, November 22, 2011

Monday, November 14, 2011

Thursday, November 10, 2011

Git rule of thumb

If you can't push, fetch and merge (or pull), then try again.
If you can't pull, try a commit!  (You might have an open commit/dirty files which are causing merge conflicts)

If that fails, go to gitref.org.

Strace to debug processes in Linux


Strace is an awesome debugging tool.  Vhokstad has an awesome blog post about different ways to use strace.

Exactly like in his post, I used strace on Eclipse and Java by PID but I only got a futex message back.  I know for a fact that more is happening...  I found out it is a threading issue.  Strace -p PID will trace the main thread by default.  Thanks caf and stackoverflow.

I'm going to use strace while starting the process instead.

Rambling post continues...

Using  strace -t -f -ff -d -o killed my session.  I wish I knew why.  I'm going to try to go back to strace -p PID and find the correct thread.

Friday, November 4, 2011

Eclipse is Awesome Again. (MySQL this time)

In half an hour I was able to download the Mysql JDBC database driver (login account to mysql required), put it on my Linux system, and then set up Data Source Explorer in Eclipse to connect to my test database.  You can drill down to tables and edit the data.  You can save or revert your edits at will!  Sweet!

I had to create a new MySQL user 2 of course using this:
Create User
Grant

I may need to get the SQL Exlporer plugin since I don't see a way to write and execute SQL with this, but it is an awesome start.

Wednesday, November 2, 2011