Karl (supersat) wrote in lj_dev,
Karl
supersat
lj_dev

BML patch

I whipped up a quick patch which prevents bmlp.pl from executing a code block indefinitely that could cause potential problems for the site. This patch adds an alarm which will stop a code block from executing if it's taking too long to complete.

Right now each page times out after about 7 seconds (based on the value in /htdocs/users), but if desired, I could modify it so that a the timeout time could be set by bmlp.cfg and/or the BML files themselves. This could be useful if there are some BML pages that should take longer than others to execute. BML files that should execute quickly would timeout quicker than those that could take a while to execute (such as credit card verification pages) under normal circumstances.

In addition, I was thinking it might be useful to log any timeouts and possibly output any debugging information into HTML comments so the admins would have an easier time tracking down problems where BML pages keep timing out.

The patch can be grabbed here. An example of it in action can be seen here (that file has a code block which goes into an infinite loop). It's been tested and appears to work just fine.
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 11 comments