Item10126: Intermittent rendering issues under FastCGI
For a while we have noticed some intermittent issues with the EditTablePlugin
under FastCGI. Sometimes it would work fine, sometimes render partially, sometimes not at all.
It turns out the problem was caused by compiled regular expressions
, which the plugin used in an attempt to increase performance. This works fine under plain CGI, where they are compiled for the length of the request, after which the process dies. However, under FastCGI, that same process is used for a number of requests, and the compiled regexs are not updated when variables used within it are changed. So to fix this I have removed all
compiled regexs from the plugin.
Regarding performance, it turns out that since 5.6, Perl knows when a variable for the regex has been changed and will recompile if it needs to. If the variable does not change, it won't recompile (see the FAQ
). So performance is not affected, whether we explicitly compile regexs are not.
I have also noticed this problem with a couple of other plugins, so will be removing compiled regexs from them too. If anyone see's a compiled regex in their code, it would probably be best to remove it to avoid similar problems in the future.
- 06 Dec 2010