Time to dust the cobwebs off my blog and get it going again.
The iPhone plugin for MT is pretty sweet - using it now for this post.
Time to dust the cobwebs off my blog and get it going again.
The iPhone plugin for MT is pretty sweet - using it now for this post.
Movable Type's PublishQueue has some memory leakage, and running in daemon mode (for quicker response to rebuilds) highlights this problem.
So the solution (where solution = not particularly pretty workaround) is to run PQ under daemontools as per this writeup by Byrne Reese. This sets up a monitor which constantly scans for the PQ job and restarts it if it's not there.
Then create a cronjob that kills PQ every hour or so, using pkill
*/15 * * * * pkill -SIGINT run-periodic
So, in this example, the cronjob runs pkill every 15 minutes and kills any processes that contain 'run-periodic' in their name (run-periodic-tasks is the perl script that runs the PublishQueue workers).
The svscan process (part of the daemontools suite) notices instantly (within milliseconds) that the PQ task isn't running, and starts it up and memory is back to normal.
Now, this obviously isn't ideal, but the 6A guys (and some of the more Perl aware parts members (!) of the community) are well aware of the problem, and are looking at how to fix the leaky bits, as well as make the whole thing run better and faster. In the meantime, this is working well for me.
[Update - 6A have acknowledged the memory leaks issue in the latest MT 4.1 release notes and have advised that PublishQueue not be run in daemon mode, or with FastCGI - both of which are fairly essential. My workaround is even more valid now.
Also note the addition of the SIGINT signal to the pkill command - this is a less forceful shutdown and was recommended to me in the #movabletype IRC channel]
Movable Type relies on a number of libraries and additional pieces of software to perform certain functions - especially where images are concerned. Thumbnailing and captcha both rely on ImageMagick to perform various feats of graphic trickery.
However, getting ImageMagick playing nicely with Perl and Movable Type is not always straightforward. If you're on a good host, then this work may already have been done for you (leave a comment if you're with a host that has this sorted out), but even good hosts don't always get this right, and if you're on a dedicated server, this is probably something you'll have to do yourself - as I've just done with my MediaTemple (dv) server.
I'm documenting the steps I took to get this working - hopefully it will be useful to someone else (and me in the future, the next time I have to do this). Please note that the steps require that you have root access, and are for dedicated servers (or dedicated virtual servers), and you need to be running Linux - I'm using CentOS, but I'm pretty sure this works for any distro.
Ok - so first up, browse to mt-check.cgi and see whether Image::Magick is already there. It's in the same directory as mt.cgi, so just replace with mt-check.cgi in your normal URL for MT.
If you're lucky, and it's already there, then you're done. Congrats, and enjoy !
If you're not lucky, then you'll see somethinng like "Image::Magick. Your server does not have Image::Magick installed...". Time to roll up your sleeves.
Build imagemagick
./configure
make
make install
cd PerlMagick
Perl Makefile.PL
make
make install
[error] Can't load '/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/Image/Magick/Magick.so' for module Image::Magick: libMagick.so.10: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.5/i386-linux-thread-multi/DynaLoader.pm line 230.\n at /var/www/vhosts/xxx.xxx.com/httpdocs/test/perl/image_test.pl line 9\nCompilation failed in require at /var/www/vhosts/xxx.xxx.com/httpdocs/test
/etc/ld.so.conf and add /usr/local/lib below the last line. ldconfig perl -MImage::Magick -e 1
ldd /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/auto/Image/Magick/Magick.so
libMagick.so.10 => (missing)
libWand.so.10 => (missing)
libc.so.6 => /lib/tls/libc.so.6 (0xb7ca4000)
libtiff.so.3 => /usr/lib/libtiff.so.3 (0xb7c57000)
libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0xb7c39000)
libbz2.so.1 => /usr/lib/libbz2.so.1 (0xb7c28000)
libz.so.1 => /usr/lib/libz.so.1 (0xb7c18000)
libm.so.6 => /lib/tls/libm.so.6 (0xb7bf4000)
libpthread.so.0 => /lib/tls/libpthread.so.0 (0xb7be2000)
libdl.so.2 => /lib/libdl.so.2 (0xb7bde000)
/lib/ld-linux.so.2 (0xb7fea000)
ln -s /usr/local/lib/libMagick.so.10 /usr/lib/libMagick.so.10
ln -s /usr/local/lib/libWand.so.10 /usr/lib/libWand.so.10
[Updated with a better initial method - editing /ld.so.conf which removes the need for the symlinks]
Good luck !!
Recent Comments