Installation

Errors after upgrade to apache2

Errors after upgrade to apache2

by Lars Jensen -
Number of replies: 12
We just upgraded to apache2, and we are now getting some errors after login to webwork. We are able login to courses but when we look at a problem in a set we get errors like the one below. Also, when we look at problems in the Library Browser, we get lots of errors. Not every problem produces an error, but the vast majority do. We are running webwork 2-4-dev from cvs, and we ran check_modules apache2 and it does not report any missing software at all.

Any help greatly appreciated.

Thanks,
Lars.

Error messages

Can't locate object method "getCopy" via package "Parser::Context" at line 1071 of (eval 222) Died within main::NUM_CMP called at line 498 of (eval 222) from within main::num_cmp called at line 619 of (eval 222) from within main::std_num_cmp called at line 38 of [TMPL]/custom/TL_8_4.pg

Error details

 Problem1
ERROR caught by Translator while processing problem file:custom/TL_8_4.pg
****************
Can't locate object method "getCopy" via package "Parser::Context" at line 1071 of (eval 222)
 Died within main::NUM_CMP called at line 498 of (eval 222)
 from within main::num_cmp called at line 619 of (eval 222)
 from within main::std_num_cmp called at line 38 of [TMPL]/custom/TL_8_4.pg

Warning messages

  • Failed to evaluate module Parser: Attempt to reload Parser.pm aborted.
  • Compilation failed in require at (eval 486) line 1.
  • Failed to evaluate module Value: Attempt to reload Parser.pm aborted.
  • Compilation failed in require at (eval 486) line 1.
  • Failed to evaluate module Parser::Legacy: Attempt to reload Parser/Legacy.pm aborted.
  • Compilation failed in require at (eval 487) line 1.

In reply to Lars Jensen

Re: Errors after upgrade to apache2

by Davide Cervone -
Did you update pg as well as webwork2? It looks like there may be a version mismatch there. The getCopy stuff was added last summer; have you updated pg since then?

Davide
In reply to Davide Cervone

Re: Errors after upgrade to apache2

by Lars Jensen -
Hi David,

Yes, I updated both pg and webwork2. Also, the system ran fine with apache 1.3 after I upgraded it last winter.

Lars.
In reply to Lars Jensen

Re: Errors after upgrade to apache2

by Lars Jensen -
Here's another error message I get when I start (or stop) apache2:

# /etc/init.d/apache2 start
Starting web server: apache2Useless use of a constant in void context at /opt/webwork/pg/lib/WeBWorK/EquationCache.pm line 41.
Useless use of a constant in void context at /opt/webwork/pg/lib/WeBWorK/EquationCache.pm line 41.

The typical error I get when I use the library browser to look at a problem is included below. [A very few problems actually displays, for example, these problems from the setDemo display (but still produces an error message): setDemo/nsc2s10p2.pg, setDemo/sample_myown_ans.pg, and setDemo/screenHeaderFile1.pg].

I have tried everything and can't get beyond the errors on my debian installation. As a result, our college wwk system is non-functional, and I'd really like to get it going again. I have tried another from-the ground-up test install on a different machine, but with the same negative result - same errors.

I have had more success testing with an ubuntu 7.04 installation, where I actually got a working system, except that the national problem library didn't work. This might be related, though, to the fact that the NPL-update script is not present in webwork 2-4-dev anymore (why?)?

Any help is greatly appreciated.

Lars.

Error messages

Can't locate object method "getCopy" via package "Parser::Context" at line 1071 of [PG]/macros/PGanswermacros.pl Died within main::NUM_CMP called at line 469 of [PG]/macros/PGanswermacros.pl from within main::num_cmp called at line 78 of [TMPL]/setDemo/limits.pg


Warning messages

  • Failed to evaluate module Parser: Can't use string ("Value::Real::ISA") as an ARRAY ref while "strict refs" in use at /opt/webwork/pg/lib/Value/Context.pm line 99.
  • Compilation failed in require at /opt/webwork/pg/lib/Value.pm line 983.
  • BEGIN failed--compilation aborted at /opt/webwork/pg/lib/Value.pm line 983.
  • Compilation failed in require at /opt/webwork/pg/lib/Parser.pm line 763.
  • BEGIN failed--compilation aborted at /opt/webwork/pg/lib/Parser.pm line 763.
  • Compilation failed in require at (eval 200) line 1.
  • Failed to evaluate module Value: Can't use string ("Value::Real::ISA") as an ARRAY ref while "strict refs" in use at /opt/webwork/pg/lib/Value/Context.pm line 99.
  • Compilation failed in require at /opt/webwork/pg/lib/Value.pm line 983.
  • BEGIN failed--compilation aborted at /opt/webwork/pg/lib/Value.pm line 983.
  • Compilation failed in require at /opt/webwork/pg/lib/Parser.pm line 763.
  • BEGIN failed--compilation aborted at /opt/webwork/pg/lib/Parser.pm line 763.
  • Compilation failed in require at (eval 200) line 1.
  • Failed to evaluate module Parser::Legacy: Can't call method "copy" on an undefined value at /opt/webwork/pg/lib/Parser/Legacy/LimitedNumeric.pm line 75.
  • Compilation failed in require at /opt/webwork/pg/lib/Parser/Legacy.pm line 6.
  • BEGIN failed--compilation aborted at /opt/webwork/pg/lib/Parser/Legacy.pm line 6.
  • Compilation failed in require at (eval 201) line 1.






In reply to Lars Jensen

Re: Errors after upgrade to apache2

by Michael Gage -
Hi Lars,

The first error in EquationCache.pm corresponds to

use Fcntl qw(:DEFAULT :flock);
BEGIN { O_RDWR; O_CREAT; LOCK_EX } # get rid of "subroutine redefined" warnings

in my installation.

I don't get that error -- it might be because of an error in
including Fcntl where the constants are defined. It might also be a hidden error that my relatively old perl installation silently ignores. I don't think it's related to the other errors.

The other errors (reading from the bottom up) are because the server is unable to load some files:

use Parser::Legacy::NumberWithUnits;
use Parser::Legacy::LimitedNumeric;
use Parser::Legacy::Numeric;
use Parser::Legacy::LimitedComplex;

so check to see if (1) they are there in the right location under the pg directory: pg/lib/Parser/Legacy

(2) make sure that they are readable by the server -- this means checking the permissions on both the files and on the directories containing the files and the other directories back up to the top.

Depending on how you set your umask you may have unintentionally blocked execution or read privileges to the group containing the server.


There might be something else that I haven't thought of which is preventing the server from reading those files -- but I'm pretty sure that not having access to those files is causing the rest of the problems.

--Mike
In reply to Michael Gage

Re: Errors after upgrade to apache2

by Lars Jensen -
Hi Mike,

Everything down the pg subdirectory structure looks OK:

mahler:/opt/webwork/pg/lib/Parser/Legacy$ ls -al
total 72
drwxr-xr-x 3 root root 4096 2008-05-21 13:13 .
drwxr-xr-x 9 root root 4096 2008-05-21 13:13 ..
drwxr-xr-x 2 root root 4096 2008-05-21 13:13 CVS
-rw-r--r-- 1 root root 9595 2007-08-09 16:10 LimitedComplex.pm
-rw-r--r-- 1 root root 3370 2005-08-01 05:04 LimitedNumeric.pm
-rw-r--r-- 1 root root 7013 2007-08-09 16:10 NumberWithUnits.pm
-rw-r--r-- 1 root root 1203 2007-08-09 16:10 Numeric.pm
-rw-r--r-- 1 root root 26718 2007-08-09 16:10 PGcomplexmacros.pl
-rw-r--r-- 1 root root 2384 2005-08-25 11:32 README

The permission/ownership of all files above this directory are 644 and root:root. All directories above are 755 and root:root. I have tested that the web server can access and read the files.

Lars.
In reply to Michael Gage

Re: Errors after upgrade to apache2

by Davide Cervone -
I don't think it's missing or inaccessible files. The errors show that the Parser library has been loaded and is trying to make calls to getCopy and other routines. The important message as I see it is the one complaining about the use of "Value::Real::ISA" as an ARRAY reference when strict refs are in effect. This suggests to me that there may be a difference with the "strict" module compared to the version I'm using (admittedly, not all that recent). The line in question is a line where a string is used as a reference.

Try adding

    no strict "refs";
right after the line
   use strict;
in pg/lib/Value/Context.pm and see if that gets you any further. There may be other files that need the same treatment.

If that doesn't work, take out the use strict entirely and see if that helps.

Davide

In reply to Davide Cervone

Re: Errors after upgrade to apache2

by Michael Gage -
This would jibe with the error message "Useless use of a constant" reported from the file EquationCache.pm It's beginning to look to me as if it's the new perl version 5.10.x which is catching errors that were previously silent. Has anyone else used WeBWorK with new versions of perl?
In reply to Davide Cervone

Re: Errors after upgrade to apache2

by Lars Jensen -
Hi Davide,

Ingenious, Davide! You hit the nail right on the head. After making the change below, everything works again! Thanks!

Is there any drawback to adding the extra line.

Lars.


Davide Cervone said:

Try adding

 right after the line 
 in pg/lib/Value/Context.pm
In reply to Lars Jensen

Re: Errors after upgrade to apache2

by Davide Cervone -
Is there any drawback to adding the extra line.
I can't think of one. Since I don't have perl 5.10.x running here (and don't have time to do a new installation at the moment), it is hard for me to test it out. There are some other places in the MathObjects library where strings are used as references, so you may run into this issue again as you work with some of the more modern problems that call on MathObjects directly. it is not yet clear to me exactly what behavior will be trapped.

If this is the only instance of the problem (and it seems to be the only obvious one), then I could work around it in a way that doesn't require turning off the strict refs. But for now, I think you are OK.

Davide

In reply to Michael Gage

Re: Errors after upgrade to apache2

by Davide Cervone -
In the meanwhile, you might be able to get some problems working by setting
   $pg{specialPGEnvironmentVars}{useOldAnswerMacros} = 1;
in global.conf. This will cause the traditional answer checkers like num_cmp() to not use MathObjects internally. That might allow older problems to work correctly.

You could probably use course.conf to set this back to 0 for a single course where you do your testing of the MathObject issues. You could also add

    $useOldAnswerMacros = 0;
to the top of a single problem file to get the MathObject-based answer checkers for that problem only. I think this has to go before the first loadMacros() call if I remember correctly.

Davide

In reply to Davide Cervone

Re: Errors after upgrade to apache2

by Arnold Pizer -
Hi Lars,

I not sure it's much help but for what it's worth I installed WW 2.4 on Ubuntu 8.04 using Apache2 and everything worked fine (see http://webwork.maa.org/wiki/Installation_Manual_for_2.4_on_Ubuntu_8.04).

Unfortunately the installation is on a laptop in my office and I shut it down for the weekend. I'm sitting on my boat 40 miles away so I can't tell what version of perl Ubuntu 8.04 comes with (I would guess the same version as Debian but maybe not). I did a quick search on the web but couldn't find a list of what version of perl Ubuntu 8.04 comes with. Hold on --- I just remembered I put the output from server-info in the instructions --- here it is:
Server Version: Apache/2.2.8 (Ubuntu) mod_apreq2-20051231/2.6.0 mod_perl/2.0.3 Perl/v5.8.8
So Ubuntu 8.04 uses perl 5.8.8. The above line tells you what versions I'm using successfully.

Arnie


In reply to Arnold Pizer

Re: Errors after upgrade to apache2

by Lars Jensen -
Hi Arnie,

Ubuntu 8.04 works for me too. I haven't got debian testing to work, though. My best guess is that the errors i get due are dur to something related to the fact that debian testing uses perl 5.10. But I'm going to give up trying to resolve it, and instead install ubuntu 8.04 on our production machine.

Lars.