Ruby and the Undead
Posted by Tim Brys on Oct 26, 2007
Xen
Docpublisher is nearing it's first internal release, so a lot of testing has been done this week.
For this, a virtual machine running on Xen was used as environment. Not only was it useful for testing purposes, but later on, we will be able to run this same Xen-image on Amazon's EC2 when DocBook publishing will become a hit and scaling will be necessary.
Zombies
During these testing sessions, a bug was encountered, more specifically : an undead bug. Sometimes, when the xmlparser failed to parse a docbookfile, the childprocess it runs in turned zombie and never quit. Luckily, this was quickly fixed by enclosing the fork in a begin..rescue block and then collecting the process 'death signal':
begin
pid = fork do
#...
xmlparser.parse
#...
end
#...
rescue
puts "#{pid} turned zombie, going to kill #{pid}"
Process.wait(pid, Process::WNOHANG)
end
Gems
After weeks of copying the core-files to the various transform- and pub lish-directories, I finally decided to make a gem package so that the "libra ry" code is separated from the application-specific code. The gem includes a logger, temp-file manager, message handler and svn wrapper.
Other
- Wrote a lot of documentation (a nice flowchart of the system can be seen here)
- Made code highlighting possible in html of published docbook files
- Implemented support for external xml entities