Movable Type 4.0, FastCGI, and Background Tasks

| | 5 Comments

I solved the problem of using MovableType’s background tasks with FastCGI a while back. A couple of MT developers took notice, but the solution wasn’t incorporated into the recent 4.0 installation. Six Apart still maintains that background tasks and persistent environments are incompatible. I believe it has to do with different philosophies that Six Apart and I have in regards to running MT under FastCGI.

Since the last release I’ve added some interesting features to my MT-Dispatcher. This “current” version discovers and understands MT apps. No more need to edit the dispatcher to specify the apps you want to run.

For 4.0 compatibility I’ve had to update the my background tasks code to the new organization of MT. I’ve also copied the error handling code from MT::Bootstrap so the dispatcher will behave like a normal MT install. This means that the current version is probably not backwards compatible anymore. If needed, I can backport my changes to a 3-compatible branch.

I’ve decided to post links to the version that is under active development in case anyone wants to try it out. Read this post for a rough outline of the installation procedure. A release won’t happen for a few days, and I cannot guarantee that as I update the source code that the version that you download will run.

mt-dispatch, current (download)

However, background tasks still fork the process. I’m working on a new method of doing background tasks that will not cause fork.

5 Comments

Reed, this rocks. Thanks for your great work. I’d love a backported 3.x compatible branch with your recent changes, as I’m not ready to take the plunge yet.

The backport is easy to do, you just have to copy the code for MT::Util::start_background_task and the error handling in MT::Bootstrap. I’ve not done it yet because I don’t want to do it multiple times.

1. rename start_background_task to start_background_task_fcgi

2. “!launch_background_tasks()” to !MT::Util::launch_background_tasks()

3. add “$CGI::Fast::Ext_Request->Detach();” below “#child” and above close STDIN;

I’ve written a new handler for background tasks that avoids a fork.

Testing…

It looks like I’m going to have to come up with another way to launch background tasks without a fork.

About this Entry

This page contains a single entry by Reed A. Cartwright published on August 16, 2007 5:02 PM.

PostgreSQL was the previous entry in this blog.

More MT-Dispatcher Features is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Archives

Powered by Movable Type 4.37