WeBWorK Main Forum

Incorrect matrix syntax causes incoherent warning message

Incorrect matrix syntax causes incoherent warning message

by Sean Fitzpatrick -
Number of replies: 15

Many of the linear algebra problems in WeBWorK involve entering a matrix using syntax like [[a,b],[c,d]].

It is quite common for students to miss a bracket when entering a matrix in this syntax.

Instead of getting a standard error/warning message like, "There is a problem with your matrix syntax", students get an error page with content similar to below. Since I run our server, that means I'm currently getting a steady stream of emails from students in another instructor's class with complaints like "WeBWorK keeps crashing", or "online homework is broken".

Any way we can beef up the matrix code to give students a useful error message? Right now they get something like this:


This is the error record identifier - a69b4e53-7ea0-5913-9bbb-57e966dfc8d7::8a577e90-369a-11ec-aaf4-da1b08da9123

This is the error messages - 'require' trapped by operation mask at /usr/lib/x86_64-linux-gnu/perl/5.26/Encode.pm line 5. Compilation failed in require at /usr/lib/x86_64-linux-gnu/perl/5.26/Encode/Alias.pm line 22.

This is the call stack –

  • in WeBWorK::PG::Local::new called at line 51 of /opt/webwork/webwork2/lib/WeBWorK/PG.pm
  • in WeBWorK::PG::new called at line 752 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Problem.pm
  • in WeBWorK::ContentGenerator::Problem::pre_header_initialize called at line 213 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator.pm
  • in WeBWorK::ContentGenerator::go called at line 386 of /opt/webwork/webwork2/lib/WeBWorK.pm

In reply to Sean Fitzpatrick

Re: Incorrect matrix syntax causes incoherent warning message

by Sean Fitzpatrick -
The only problem: the students getting this message aren't much help.
Since their input creates this message, it doesn't get written to the database, so I don't know what mistake they might have made.

Attempts to get more information out of them have not been fruitful. I just get "oh, well it somehow resolved itself".

I was able to create the error as follows:

a student who was having this problem eventually got a correct answer with:

[2,4],[-1,3],[5,8]

Yes, there should be an extra set of brackets around the whole thing.
If I put one bracket in, and forget the other, no problem -- I get a warning about a missing bracket.
If I have the enclosing brackets and forget a comma, no problem -- I get a warning that one of my rows is the wrong size.

But if I forget the enclosing brackets *and* forget a comma, I get an error like the one above.

In reply to Sean Fitzpatrick

Re: Incorrect matrix syntax causes incoherent warning message

by Danny Glin -
I was able to reproduce this in WW 2.16. Based on the things I tried, it seems that if WW interprets the answer as a list rather than a matrix (e.g. if you enter an answer without the enclosing brackets), then you get the error you quoted. Forgetting some commas leads to the expected feedback messages, but others lead to this error.
The one noted exception (as you came across) is if you enter the correct answer without the enclosing brackets, it is marked correct (which I think is also a bug, and probably related).
In your case, the student entered "[2,4],[-1,3],[5,8]" and was marked correct. If they entered, say "[2,4],[-1,3],[5,7]" my testing indicates that they would get the error screen.
I have filed a bug report about this (https://github.com/openwebwork/pg/issues/612) in the hopes that someone who knows more about the inner workings of pg will take a look at it.
In reply to Danny Glin

Re: Incorrect matrix syntax causes incoherent warning message

by Sean Fitzpatrick -

Thanks Danny.

I'm also hearing complaints from students about answers being "eaten" by WeBWorK on a similar matrix problem.

Checking that student's page showed something I've never encountered before: no attempts were recorded, but I had to request a new version to be able to check answers. So somehow they were able to submit answers (and have the submission counted by the rereandomization counter) without anything being written to the database.

Could be unrelated. Maybe it's time to start a fresh WeBWorK server with a clean DB.

In reply to Sean Fitzpatrick

Re: Incorrect matrix syntax causes incoherent warning message

by Andras Balogh -

It seems to me (just noticed a few days ago) that if there are two questions using ProblemRandomize in a gateway quiz then grading causes the grader use the updated numbers for the correct answer making the submission incorrect. Or maybe one answer is not recorded and the other one is marked incorrect.

In reply to Andras Balogh

Re: Incorrect matrix syntax causes incoherent warning message

by Danny Glin -
Are you using problemRandomize.pl within a gateway quiz?  If so, I'm not surprised that it isn't working properly.  That macro file is not well supported.  It has been superseded by the problem re-randomization feature that can be enabled from the course configuration page (in the Optional Modules tab), though that feature only applies to homework sets.  Re-randomization in quizzes is handled by allowing multiple versions of a quiz via the quiz settings.
In reply to Danny Glin

Re: Incorrect matrix syntax causes incoherent warning message

by Andras Balogh -
Yes, the problems were using problemRandomize.pl before I disabled them. They were included in the gateway quiz because we did not notice the randomization not because we wanted it.
In reply to Andras Balogh

Re: Incorrect matrix syntax causes incoherent warning message

by Danny Glin -

Are the problems that you reference that include problemRandomize.pl part of the OPL?  If so, they should be reported as bugs.  The OPL editorial board made the decision not to include problems that include re-randomization hard-coded into the problem itself, so if some of these snuck through then that code should be removed.

In reply to Sean Fitzpatrick

Re: Incorrect matrix syntax causes incoherent warning message

by Danny Glin -
How are you handling the rerandomization: using problemRandomize.pl or the re-randomization feature in the WeBWorK interface?
In reply to Danny Glin

Re: Incorrect matrix syntax causes incoherent warning message

by Glenn Rice -

As Danny said, the problemRandomize.pl macro causes problems in gateway quizzes.  It causes problems even without using the grader.  I have also seen problems with it in homework problems.  That macro needs to be removed.

In reply to Danny Glin

Re: Incorrect matrix syntax causes incoherent warning message

by Sean Fitzpatrick -

In my case, I use periodic re-randomization. (And I never use quizzes; only homework.) Although I've considered turning it off: an unrelated bug that I've reported before (but nobody else can reproduce, so maybe I have something wrong deep in my settings or database...) results in question settings being locked in the database the moment a student even looks at a question. So if I edit a question, or change a weight, the changes only apply to students who haven't started their homework yet.

It used to be the case that settings only got locked after they triggered the re-randomization. Turning the feature off resolves the issue.

In reply to Sean Fitzpatrick

Re: Incorrect matrix syntax causes incoherent warning message

by Glenn Rice -

Sean, are you using WeBWorK 2.16?  That should be fixed for WeBWorK 2.16.

In reply to Glenn Rice

Re: Incorrect matrix syntax causes incoherent warning message

by Sean Fitzpatrick -
Yes, I'm on 2.16. But I couldn't figure out how to port the database over from MySQL to MariaDB so we're still using MySQL.
I probably need to retire the current server (which was originally installed when we were at 2.10) and make a new one from a clean install.
In reply to Sean Fitzpatrick

Re: Incorrect matrix syntax causes incoherent warning message

by Alex Jordan -

Earlier, I was on "2.16" but it was a preliminary release from last spring. Since then, the official release came, and then there have been some hotfixes. A few weeks ago I pulled and there were actually over 50 commits I hadn't caught up with. I know at one point, you were in a similar place with the pre-release. Have you checked to see if you could benefit from pulling "main"? (And even if you can, it may not have anything to do with the issue of this thread.)

In reply to Sean Fitzpatrick

Re: Incorrect matrix syntax causes incoherent warning message

by Glenn Rice -

Actually, I was thinking of a related issue that I fixed on this that was regarding opening a problem in the problem editor when problem randomization is turned on.  This particular issue is not fixed.  Although, this particular issue isn't exactly caused by the same thing.  In the case that a student submits an answer to a problem the same thing will happen even if problem randomization is disabled.  Problem randomization just makes the issue occur when the student opens the problem instead of after the first submission because at that time the problem count needs to be initialized in the database at that time.

In reply to Glenn Rice

Re: Incorrect matrix syntax causes incoherent warning message

by Sean Fitzpatrick -

To answer Alex: I've been pulling from main since the beginning of the semester, and everything is up to date.

As far as this randomization bug, I get the occasional frustrated instructor, but I've been trying to warn them all to just be very sure you have everything how you want it before releasing it to students.