Debugging a File Synchronization Problem

 

In Effective Debugging I write that if a web search doesn’t return you any useful results, then maybe you’re barking at the wrong tree. Here’s an example.

Christos Kontas reported through a tweet that a page on drawing tools in this blog was broken. The file was indeed cut in the middle of a paragraph. I guess that the file got broken some time ago when I interrupted the file regeneration process. I created the file anew on my local host, but noticed that the file failed to update on the web server. This is how I debugged the problem. I’ve put in bold text in brackets references to the corresponding Effective Debugging chapters.

  • I first verified that the two files were indeed different and that rsync executed from the command line (rather than through the blog update script) failed to update the remote file. (Enable the Efficient Reproduction of the Problem)
  • Then I executed rsync on increasingly lower-level directories, until I run it on exactly the file that needed refreshing. Still rsync would not refresh it. (Drill Up from the Problem to the Bug or Down from the Program’s Start to the Bug)
  • A Google search didn’t come up with anything interesting, so my focus changed to how I invoked rsync. (Use Focused Queries to Search the Web for Insights into Your Problem)
  • With just a single file to update, it was easy to increase the verboseness level of rsync and examine its output. (Use the Software’s Debugging Facilities)
  • This gave me an important hint, because rsync reported: [sender] hiding file index.html because of pattern index.html.
  • Based on that, I edited a file of paths I had instructed rsync to ignore, and, presto, the file got updated immediately.
  • The problem’s root cause was that in the file of ignore patterns I used the pattern index.html to exclude the top-level index file, instead of specifying /index.html.
  • I then proceeded to fix other path patterns that also lacked a leading slash. (Fix All Instances of a Problem Class)

Comments   Toot! Share


Last modified: Thursday, October 13, 2016 2:10 pm

Creative Commons Licence BY NC

Unless otherwise expressly stated, all original material on this page created by Diomidis Spinellis is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.