Here’s a quick list of things to check when trying to find the cause of a problem:
- Evaluation context
- Lock files
- PATH and environment variables
- Has the code changed recently?
- Am I looking at the code being executed (maybe a symlink didn’t update)?
- Has the kind of data changed recently (e.g. previously unseen characters, accents)?
- Has the volume of data changed (e.g. exceeding limit on number of files in a directory)?
- Has the encoding of the data changed (thanks mysql)?
- Is the code being evaluated or executed in the correct context?
- Are the necessary processes actually running?
- Is the process manager tracking them correctly?
- Are the processes owned by the correct user?
- Are files owned by the correct user and/or group?
- Are files in the expected location?
- Are there any old lock files lying around?
PATH and environment variables
- Is the PATH correct (for example in a cron task)?
- Are the ENV variables as expected? Are new processes inheriting ENV variables or starting from a clean slate (e.g. when Unicorn forks a new master the new master inherits the old master’s ENV variables)?
Here are a few ways I try to get my brain fully involved:
- Write everything out in an email / issue
- Explain problem to someone
- Systematically test assumptions
- Try to do a binary search of the problem space
- Frequent recaps of what I know and assume
- Before taking a break, ask for help on a mailing list or StackOverflow.