Warning: Persistent ASP 0240 Bug in ActivePerl 5.8

Discussion in 'Perl Misc' started by David Dickinson, Dec 23, 2006.

  1. Hello,

    Running the following ASP web page on any version of ActivePerl 5.8.x under
    any version of Win32/IIS returns an error:

    ----- BEGIN ASP CODE -----
    <%@ LANGUAGE="PerlScript" %>
    ----- END ASP CODE -----

    The script will run correctly the first time but, if the page is refreshed
    in the web browser, the following error message is displayed:

    ----- BEGIN ERROR MESSAGE -----
    Active Server Pages error 'ASP 0240'

    Script Engine Exception


    A ScriptEngine threw exception 'C0000005' in
    'IActiveScript::SetScriptState()' from 'CActiveScriptEngine::ReuseEngine()'.
    ----- END ERROR MESSAGE -----

    Refreshing the web page in the browser allows for normal continuation. A
    VBScript version of the same code does not result in this error message.

    This problem has dire consequences. Many scripts which use, for instance,
    $Response->Redirect() to a page that contains a $Response->End() can die.
    All that the web site visitor sees is the error message. They don't know
    that they can simply refresh the web page to get past the error.

    This bug (ActiveState Bug 65223) has, as far as I know, existed in every
    version of ActivePerl 5.8.
    David Dickinson, Dec 23, 2006
    1. Advertisements

  2. David Dickinson

    Toby Ovod-Everett

    Jan 19, 2016
    Likes Received:
    This reply comes 9 years later, but hopefully it will be helpful for someone.

    I recently ran into this issue when assisting with the porting of a ASP application that uses PerlScript, and discovered that the issue is still present in ActivePerl 5.16.3. I noticed that the reported error message is in CActiveScriptEngine::ReuseEngine, and so figured if there was a way to prevent reuse of script engines, that might serve as a workaround without requiring coding changes or extensive testing.

    Sure enough, setting "Maximum Script Engines Cached" (scriptEngineCacheMax) to 0 has the effect of disabling script engine caching, which in turn means no reuse. Since every call gets a fresh script engine, the bug in CActiveScriptEngine::ReuseEngine is no longer exposed. It appears that the setting is a server level property (the setting is visible, but grayed out, at the application level). See https://www.iis.net/configreference/system.webserver/asp/cache for additionaly information.

    Toby Ovod-Everett
    Toby Ovod-Everett, Jan 19, 2016
    Ted Chuang likes this.
    1. Advertisements

  3. David Dickinson

    Ted Chuang

    Apr 21, 2017
    Likes Received:
    Thank you, Toby,

    This has been haunting me for years, and your tip works marvelously.

    Ted Chuang, Apr 21, 2017
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.