Malformed Header Error?

I know that some people are having problems getting R2 Web Edition web apps to run.  I was having the same problem on a few of the more complicated apps I’ve been working on and what made it frustrating was that locally, on my Mac, they ran fine in debug and in as regular web apps.  But on two separate Linux servers (one in CentOS and the other is unknown) they crashed.  I dug into the Error Logs on the servers and kept running across lines like this:

Malformed header from script. Bad header=App.Open

What was in my open event?  Well, I was connecting to the database and upon success opening  a web page and that’s it.  Simple, right?

I was also doing some logging and was calling a method called PrintAndLog which would append whatever string I passed in to a log file and it would send the same message to the console via the Print command.

After much tearing out of hair (and those that know me surely will recognize that I’ve done this a lot!) I commented out ALL the code in App.Open and ran it on the server.  It worked!  So I then started uncommenting code line by line.  Eventually I got to the PrintAndLog call and sure enough that was it.

I then did the same thing in the PrintAndLog method and discovered it was the very first line in the method:

print s

Crazy huh?  Comment out that line and it works again.  What makes it weird is that I’ve used this in multiple places AFTER and it works fine.  So I can only conclude that it has something to do with the application initializing and that print isn’t recommended at that point in time.

Yeah, I agree, it’s a stretch but stranger things have happened. This has been reported <feedback://showreport?report_id=17388> with an example project (the project is private, sorry).  Oh, and this still happens in the R3 beta’s.

So hopefully this might help someone in a similar predicament.

3 thoughts on “Malformed Header Error?

  1. Thanks for the post.

    I’ve been trying to identify the problem in my dummy app for 2 weeks now.
    I might as well have to turn to another IDE for my web work.

    The dummy app is just a window with a button, which when clicked, pops up a msgbox.
    No “Print s” like in your case.
    Would you have any suggestions? Thanks

    (find details below)
    the log file reports of an error at line 326: “system(@args) == 0 or return 0;”

    if ($is_windows == 1) {
    my $process;
    Win32::Process::Create($process, script_directory() . “/” . $app_name,”–port=”.$port,0,$process_type,”.”) || return 0;
    } else {
    my @args = (“$app_path”,”–port=$port”);
    system(@args) == 0 or return 0;

    return 1;

  2. Tim, I downloaded your project and it’s running on my web server at The only thing that I changed was App.ApplicationIdentifier I changed it to “com.bkeeney.dummy”. I made one change in the .htaccess file so it would run on my web server and that was it.

    This was built under R3 (a Final Candidate) so it’s possible something was changed from R2.

  3. Dear Bob,

    thank you for being so responsive.
    The new update did help, without any extra tweaks.

    I’m happy now.


Comments are closed.