Monthly Archives: August 2010

A memory leak in getResults from AMT CLT? Nope.

I had a strange error popping up. Every time I tried to use the getResults.sh script outside of a project in the samples directory, an unidentified process would eat up all of the memory on my machine. Worse, when I used strace, the process seemed to be just hanging there.

I tried a bunch of things:

  1. Moving the directory back to samples. No dice.
  2. Switching from OpenJDK to Sun's JDK. Since the CLT doesn't support 1.6, I followed the directions here to install sun-java5-jdk and set JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun/jre/
  3. Taking another close look at the script.

Here an excerpt from the the getResults.sh script:

JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun/jre/
export JAVA_HOME
DIR=`pwd`
./getResults.sh $1 $2 $3 $4 $5 $6 $7 $8 $9 -successfile $DIR/rate-3-4-36.success -outputfile $DIR/rate-3-4-36.results
cd $DIR

Notice that I forgot to change to the bin directory of the CLT. (I don't know why, but you seemingly have to be in the bin directory for the CLT to work properly. I haven't messed with it much yet; I might have screwed up my path somehow when I first tried.)

If you add the line:

cd ~/workspace/aws-mturk-clt-*/bin

It works. My script was recursing on itself. That's what was eating the memory. And it didn't show up in top because each invocation of the script used up only a very little bit of the memory. Man I feel dumb.

I only post this in case someone else has these troubles.

XML for AMT ExternalQuestion

If you are trying to use Amazon Mechanical Turk for something and you don't know XML very well, you might run into this error when trying to write an ExternalQuestion with the command line tools.

vanhoudn@gauze:~/workspace/aws-mturk-clt-1.3.0/samples/rate_tests$ ./run.sh
--[Initializing]----------
Input: ../samples/rate_tests/rate_tests.input.csv
Properties: ../samples/rate_tests/rate_tests.properties
Question File: ../samples/rate_tests/rate_tests.question
Preview mode disabled
--[Loading HITs]----------
Start time: Thu Aug 05 16:12:33 EDT 2010
[Fatal Error] :6:111: The reference to entity "student2" must end with the ';' delimiter.
[ERROR] Error creating HIT 1 (3001): [6,111] The reference to entity "student2" must end with the ';' delimiter.
...

The issue is that I'm trying to pass more than one variable via the url and this:
[sourcecode language="xml"]
<ExternalURL>

http://www.contrib.andrew.cmu.edu/~nmv/amt/test.php?

student1=${helper.urlencode($student1)}
&student2=${helper.urlencode($student2)}
&student3=${helper.urlencode($student3)}
</ExternalURL>
[/sourcecode]

Should instead be:
[sourcecode language="xml"]
<ExternalURL>

http://www.contrib.andrew.cmu.edu/~nmv/amt/test.php?

student1=${helper.urlencode($student1)}
&amp;student2=${helper.urlencode($student2)}
&amp;student3=${helper.urlencode($student3)}
</ExternalURL>
[/sourcecode]

The & that separates the variables need to be replaced with &amp;. Then it works just fine.