<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Debugging on traviscj/blog</title>
    <link>https://traviscj.com/blog/tags/debugging/</link>
    <description>Recent content in Debugging on traviscj/blog</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Tue, 24 Jun 2025 19:47:52 -0500</lastBuildDate>
    <atom:link href="https://traviscj.com/blog/tags/debugging/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Evolution of a Get Endpoint</title>
      <link>https://traviscj.com/blog/post/2025-06-24-evolution-of-a-get-endpoint/</link>
      <pubDate>Tue, 24 Jun 2025 19:47:52 -0500</pubDate>
      <guid>https://traviscj.com/blog/post/2025-06-24-evolution-of-a-get-endpoint/</guid>
      <description>&lt;p&gt;My work project started pretty simple: there was a simple &lt;code&gt;GetXyz&lt;/code&gt; endpoint that just looked up the &lt;code&gt;xyz&lt;/code&gt; record in the database by a unique key &amp;amp; returned it.&#xA;How complicated could it be?&lt;/p&gt;&#xA;&lt;p&gt;It was a straightforward generalization of an old &lt;code&gt;GetAbc&lt;/code&gt; functionality, it was really only used by oncall engineers through an admin console, it shouldn&amp;rsquo;t have been too big of a deal.&lt;/p&gt;&#xA;&lt;p&gt;Ok, but then it outgrew its original datastore, so a separate service had to be created.&#xA;We thought about migrating clients, but at the time it seemed faster to just implement once on our side &amp;amp; have clients continue calling us; essentially encapsulating the separate service as an implementation detail.&#xA;But as part of the traffic swing, we figured it should support either the &lt;code&gt;local&lt;/code&gt; or the &lt;code&gt;remote&lt;/code&gt; read path.&lt;/p&gt;</description>
    </item>
    <item>
      <title>macos log command</title>
      <link>https://traviscj.com/blog/post/2019-05-23-macos_log_command/</link>
      <pubDate>Thu, 23 May 2019 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2019-05-23-macos_log_command/</guid>
      <description>&lt;p&gt;My work laptop has been randomly shutting itself off.&#xA;I came across &lt;a href=&#34;TODO&#34;&gt;this&lt;/a&gt; stackoverflow post, it said to run&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;log show &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  --predicate &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;eventMessage contains &amp;#34;Previous shutdown cause&amp;#34;&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  --last 24h&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;which, for me, returns&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;risksys  ➜ log show --predicate &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;eventMessage contains &amp;#34;Previous shutdown cause&amp;#34;&amp;#39;&lt;/span&gt; --last 24h&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Filtering the log data using &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;composedMessage CONTAINS &amp;#34;&lt;/span&gt;Previous shutdown cause&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Skipping info and debug messages, pass --info and/or --debug to include.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Timestamp                       Thread     Type        Activity             PID    TTL&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;2019-05-23 11:29:01.874486-0700 0xaf       Default     0x0                  &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;      &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;    kernel: &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;AppleSMC&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; Previous shutdown cause: -128&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;2019-05-23 11:44:49.786722-0700 0xaf       Default     0x0                  &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;      &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;    kernel: &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;AppleSMC&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; Previous shutdown cause: -128&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;--------------------------------------------------------------------------------------------------------------------&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Log      - Default:          2, Info:                0, Debug:             0, Error:          0, Fault:          &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Activity - Create:           0, Transition:          0, Actions:           &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This, combined with these &lt;a href=&#34;https://georgegarside.com/blog/macos/shutdown-causes/&#34;&gt;MacOS Shutdown Causes&lt;/a&gt; paints a pretty bleak picture: I&amp;rsquo;ve got RAM issues :-(&lt;/p&gt;</description>
    </item>
    <item>
      <title>multiple thread test cases in java</title>
      <link>https://traviscj.com/blog/post/2018-05-15-multiple_thread_test_cases_in_java/</link>
      <pubDate>Tue, 15 May 2018 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2018-05-15-multiple_thread_test_cases_in_java/</guid>
      <description>&lt;p&gt;Some of my day job lately has been trying to get a better handle on threads in Java.&#xA;In particular, we had a really weird race condition resulting from multiple threads processing an input data stream and causing some unexpected conflicts in our data access layer.&lt;/p&gt;&#xA;&lt;p&gt;To try to replicate the problem in tests, I started with something like this:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-java&#34; data-lang=&#34;java&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;private&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;static&lt;/span&gt; Runnable &lt;span style=&#34;color:#a6e22e&#34;&gt;runWithDelay&lt;/span&gt;(String name, &lt;span style=&#34;color:#66d9ef&#34;&gt;long&lt;/span&gt; millis) {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; () &lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;try&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      Thread.&lt;span style=&#34;color:#a6e22e&#34;&gt;sleep&lt;/span&gt;(millis);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    } &lt;span style=&#34;color:#66d9ef&#34;&gt;catch&lt;/span&gt; (InterruptedException e) {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#66d9ef&#34;&gt;throw&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;new&lt;/span&gt; RuntimeException(e);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    System.&lt;span style=&#34;color:#a6e22e&#34;&gt;out&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;println&lt;/span&gt;(name &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34; finished&amp;#34;&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  };&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;&lt;p&gt;This is just a &lt;code&gt;Runnable&lt;/code&gt; that waits a while, and then prints that it finished.&#xA;Then we can test with something like:&lt;/p&gt;</description>
    </item>
    <item>
      <title>debugging internet</title>
      <link>https://traviscj.com/blog/post/2014-10-28-debugging_internet/</link>
      <pubDate>Tue, 28 Oct 2014 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2014-10-28-debugging_internet/</guid>
      <description>&lt;p&gt;My standard plan for debugging internet connections:&lt;/p&gt;&#xA;&lt;ol start=&#34;0&#34;&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Can we reach stuff from some other device?&lt;/p&gt;&#xA;&lt;p&gt;Usually, connection problems are something like &amp;ldquo;My iPad isn&amp;rsquo;t working,&amp;rdquo; which is caused  by a flash of light in the sky, like when Swamp gas from a weather balloon gets trapped in a thermal pocket and reflects the light from Venus.&amp;quot;&lt;/p&gt;&#xA;&lt;p&gt;So try something other than your iPad on your WiFi to isolate whether it is a WiFi network problem or a &amp;ldquo;iPad&amp;quot;problem.&lt;/p&gt;</description>
    </item>
    <item>
      <title>logging</title>
      <link>https://traviscj.com/blog/post/2014-09-26-logging/</link>
      <pubDate>Fri, 26 Sep 2014 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2014-09-26-logging/</guid>
      <description>&lt;p&gt;In grad school, I spent a lot of time writing code that read output from nonlinear optimization solvers, and tried&#xA;to do useful things with it.&#xA;A much better way to do that is called &amp;ldquo;structured logging&amp;rdquo;, an idea I experimented with a bit during grad school.&#xA;It has also been coming up in my working life, so I wanted to delve into it a bit deeper.&#xA;For a quick introduction, check out &lt;a href=&#34;http://gregoryszorc.com/blog/category/logging/&#34;&gt;Thoughts on Logging&lt;/a&gt;.&#xA;For a lot longer introduction, see &lt;a href=&#34;http://engineering.linkedin.com/distributed-systems/log-what-every-software-engineer-should-know-about-real-time-datas-unifying&#34;&gt;The Log: What every software engineer should know about real-time data unifying&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Numerical Development on OSX (in the Command Line)</title>
      <link>https://traviscj.com/blog/post/2013-08-19-numerical_development_on_osx_in_the_command_line/</link>
      <pubDate>Mon, 19 Aug 2013 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2013-08-19-numerical_development_on_osx_in_the_command_line/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ve been working on C implementations of my research projects, which can of course be a perilous project. I&amp;rsquo;ve found some tools that make it hugely, hugely better.&lt;/p&gt;&#xA;&lt;h2 id=&#34;homebrew&#34;&gt;Homebrew&lt;/h2&gt;&#xA;&lt;p&gt;You can&amp;rsquo;t do a list like this without mentioning homebrew. You want homebrew instead of MacPorts or Fink or bailing twine and chewing gum or whatever else you were thinking about using. Just do it: You can find the homepage at brew.sh or just install with:&lt;/p&gt;</description>
    </item>
    <item>
      <title>debugging matlab mex</title>
      <link>https://traviscj.com/blog/post/2012-08-16-debugging_matlab_mex/</link>
      <pubDate>Thu, 16 Aug 2012 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2012-08-16-debugging_matlab_mex/</guid>
      <description>&lt;p&gt;One thing I&amp;rsquo;ve been doing a bit of lately is debugging MATLAB mex files; it seemed worth documenting.&#xA;The broad strokes:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;recompile all mex codes with &amp;lsquo;-g&amp;rsquo;&lt;/li&gt;&#xA;&lt;li&gt;quit MATLAB&lt;/li&gt;&#xA;&lt;li&gt;From a command prompt, run&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ /Applications/MATLAB_R2012a.app/bin/matlab -Dgdb&#xA;[snip]&#xA;(gdb) run -nojvm&#xA;&amp;gt;&amp;gt; run_your_mex_file&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This gives debugging output. If there is an error in the code, you&amp;rsquo;re dropped back to a gdb prompt, where you can continue debugging in a semi-normal fashion.&#xA;Typically, I end up doing a &amp;lsquo;where&amp;rsquo; to get a stack trace, and debug from there more-or-less like usual.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Found - Wordpress Spam Virus in Theme files</title>
      <link>https://traviscj.com/blog/post/2009-04-01-found_wordpress_spam_virus_in_theme_files/</link>
      <pubDate>Wed, 01 Apr 2009 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2009-04-01-found_wordpress_spam_virus_in_theme_files/</guid>
      <description>&lt;p&gt;Almost a month ago, I was helping &lt;a href=&#34;http://www.jdbeals.com/blog&#34;&gt;my good buddy Beals&lt;/a&gt; get his Wordpress website set up. On looking close, I noticed something a little weird in a theme he had found(NOT Wordpress proper, to be clear):&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;D-69-91-134-36:black-abstract-20 tjohnson$ ls -alh *&#xA;-rw-r--r--  1 tjohnson staff  528 2008-07-24 08:35 404.php&#xA;-rw-r--r--  1 tjohnson staff 3.9K 2008-07-24 08:35 comments.php&#xA;-rw-r--r--  1 tjohnson staff 8.0K 2008-10-22 20:44 footer.php&#xA;-rw-r--r--  1 tjohnson staff  871 2008-10-22 10:10 functions.php&#xA;[more removed here]&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;As you can see, the footer and functions files are both modified much more recently than every other file, which seemed strange to me. So I took a look at the file:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Johnson vs Acronis, Pt 2</title>
      <link>https://traviscj.com/blog/post/2008-08-04-johnson_vs_acronis_pt_2/</link>
      <pubDate>Mon, 04 Aug 2008 00:00:00 +0000</pubDate>
      <guid>https://traviscj.com/blog/post/2008-08-04-johnson_vs_acronis_pt_2/</guid>
      <description>&lt;p&gt;Some more ways Acronis fails, just for the record:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Completely useless log files. Error messages are crucial in applications. Acronis says ‘Error creating file’. This could mean:&lt;/li&gt;&#xA;&lt;li&gt;I couldn’t resolve the FTP server’s hostname&lt;/li&gt;&#xA;&lt;li&gt;I could resolve the hostname, but could not connect to the FTP port&lt;/li&gt;&#xA;&lt;li&gt;I could resolve the hostname and connect, but I could not authenticate.&lt;/li&gt;&#xA;&lt;li&gt;I could resolve, connect, authenticate, but I could not create a new file.&lt;/li&gt;&#xA;&lt;li&gt;Any number of other things. I could not create a temporary file(Why? No permissions in Acronis’s temporary folder?  No hard drive space? It already exists? The folder that should be the temporary folder doesn’t exist?)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Another error we’ve gotten a few times is ‘Failed to process pair script (some hash).’ While it might be useful to someone, it’s not really any help. A lot of the same stuff applies: Is the file corrupt? What’s wrong with it? Improper syntax? The configuration files are XML, they should be editable as such. Point being: Acronis, get your stuff together and write some real, honest error checking code. It’s boring code to write, but it’s boilerplate stuff, and basic. This is what you hire interns for. Please do so.&#xA;2. The GUI stinks. Everything is wizard based. This in itself isn’t so much of a problem, but it becomes one with their absolute awful support of stuff like, oh, say, remembering passwords. To see how this is an issue: Say I realize that I want maximum encryption on my backup archives. So, I load up the tasks list, click the one I want to change, click the ‘changed settings’ button. It asks me what I want to backup(2-3 screens), then where I want to back it up to. I tell it the FTP site, and it asks me for my login for that site, then allows me to navigate(keep in mind this is already stored in the configuration file I’m trying to edit, in some encrypted form(hopefully, though I would not bet 2bits on it)). Then, it asks me if I want to sign in to the FTP anonymously or use a username and password. Upon selecting non-anonymously, it asks me for the same username and password. Every single time you try to change any part of the configuration.&#xA;3. The command line stinks. There are just a couple of commands, including trueimagecmd and trueimagemnt, but both of them are completely inconsistant on file argument parsing: trueimagemnt uses the more standard UNIX conventions of [-(shortopt)|–(longopt)] (arg) while trueimagecmd uses the completely zany –(longopt):(arg). The command trueimagecmd allows a –verify command, but doesn’t include it in the runtime help or the manual page. None of this seems like too big of a deal, but Acronis is basically the only program that we actual require any GUI at all for on 2 of our 4 main servers. It’d be very nice to have backups and not need a GUI.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
