PC2 FAQ and Troubleshooting Guide
This page lists some of the common questions which users
have asked while trying to set up and use PC2.
It explains some reasons why problems occur, and provides
suggestions for trying to eliminate them.
Q: What version of Java should I be using to run PC2?
A: We currently recommend JDK 1.4.2_05. This is the version we have tested most extensively, including running multiple Regional Contests. Other versions may work, but we have not done extensive testing on them. (Note that earlier versions of Java contain known bugs which can adversely affect PC2 operations.)
Q: What can we do if we get the message 'OutOfMemoryError' while running the PC2 Server?
A:
This is because the Java Virtual Machine is
running out of "heap space". The default values for
initial heap size and maximum heap size vary among
different JVM implementations. However, there are two
Java VM switches which can be used to control the heap
size: -Xms, which
sets the initial heap size, and -Xmx, which sets the maximum
heap size. These switches can be added to the command line
in the script which is used to start the PC2
Server (the script name is either "pc2server" or "pc2server.bat",
depending on your environment).
For example, to start the Java VM with 64M of initial
heap space and a maximum of 256M of heap space, add the
following in front of the "-D" option in the "java"
command in the script:
java -Xms64M -Xmx256M -Djava.security.policy=all.policy ...
You will have to determine which sizes will
work best for your configuration.
Q: What does it mean when the system generates the message "NoClassDefFound" and won't run ?
A:
This is a Java error message meaning that it could not find one of the
"classes" (programs) required to run the system. The missing classes
could either be PC2 modules or Java system modules.
There are a number of possible causes for this error.
Here are some things you can try:
Q: Can you describe the Edit Language fields used for configuring languages in PC2? Can you provide samples?
A:
Given below are descriptions of the fields and variables
used in defining a language in PC2,
followed by examples for several commonly-used languages.
Field Names:
Variables: these are filled in by PC2
at run-time; for example, if the input
(program) file name is: "hello.java", then:
Examples:
Display Name: GNU C (gcc)
Compile Cmd Line: gcc -lm -o {:basename} {:mainfile}
Executable Filename: {:basename}
Program Execution Command Line: {:basename}
Display Name: GNU C++
Compile Cmd Line: g++ -o {:basename} {:mainfile}
Executable Filename: {:basename}
Program Execution Command Line: {:basename}
Display Name: Java
Compile Cmd Line: javac {:mainfile}
Executable Filename: {:basename}.class
Program Execution Command Line: java {:basename}
Display Name: Kylix Delphi
Compile Cmd Line: dcc {:mainfile}
Executable Filename: {:basename}
Program Execution Command Line: {:basename}
Display Name: Kylix C++
Compile Cmd Line: bc++ -A {:mainfile}
Executable Filename: {:basename}
Program Execution Command Line: {:basename}
Display Name: Turbo Pascal (DOS)
Compile Cmd Line: tpx {:mainfile}
Executable Filename: {:basename}.exe
Program Execution Command Line: {:basename}.exe
Q: Is there a way to prepare PC2 "Account Information" (such as Team Names and Passwords) ahead of time and then load them into the system?
A:
Yes. Account information prepared ahead of time can be
loaded into PC2 with the "Load" button on the Administrator.
Loaded values overwrite any values that were in the system previously.
The format of the load file is as follows.
File lines starting with ! or # in the first column are ignored.
Each non-comment line has FOUR fields, separated by a pipe (|).
The fields are:
Account_number
Display_name
Active (either "true" or "false")
Password
For example:
1|Number 1|true|pass1
2|Team Number 2||pass33
An empty "active" field is considered false (so the example
above will cause team 2 to become inactive).
True and false are not case sensitive.
Note that there is no way to associate a "Region ID" with
accounts loaded from a file; in a contest using Region ID's
the ID values must be entered manually (unless you are
also using the "Import ICPC Data" function, which is
covered elsewhere in this FAQ).
See the section "User Accounts" in the PC2
Administrator's Guide for further information on
loading account data and on the "Import ICPC Data" function.
Q: Is there a way to download and import team registration information from the ICPC site into PC2?
A: Yes, assuming you have access to the ACM ICPC
Registration data (typically only Regional Contest Directors
(RCDs) or their designees have such access).
To do this, login to the ACM/ICPC website using your Regional
Contest Director's account. There is a button there to
download a "PC2 initialization data" file.
Once you have downloaded this file, unzip it in a directory
of your choice (this will extract several files).
Then on the PC2 Administrator,
go to the "Accounts" screen and click the "Import ICPC Data"
button. This will ask you to navigate to the unzip directory
and select one of the extracted files.
Once you do this, PC2 will read the rest of the
files automatically and load the ICPC data (such as the team names).
Note: it is important to create PC2 accounts
BEFORE importing ICPC data. The import function assigns
imported account information to PC2 accounts in
the order in which the accounts are encountered in the import
data files (and therefore the accounts must already exist in
PC2).
If it is desired to associate ICPC teams with PC2
accounts in a different order than they appear in the ICPC
download file, one solution is to simply edit the file
"PC2_Team.tab" by rearranging the records in the file to
reflect the desired PC2 team ordering. Alternatively
you can copy the PC2_Team.tab file to a new file named
"_PC2_Team.tab" and edit that file by adding an additional
field to the beginning of each record containing the desired
PC2 Team ID. PC2 will automatically
check for the existence of the file "_PC2_Team.tab" during
an Import operation, and will use that file (including the
PC2 Team IDs) if it is present.
See the section on "Importing ICPC Data" in the
PC2 Administrator's Guide for further information.
Q: How can I run a "Practice Contest" during which contestants get to login and use the system to see how it works, and then "restart" a real contest?
A:
There are several ways to do this.
Note that this method has the advantage of isolating
(preserving) the practice contest data in its entirety, and it
allows for a very quick switch from practice to real contest (the
real contest problems do not have to be configured between
the practice and real contests, as they do after
the other methods listed above). However, this method does
have the disadvantage that no data from the practice is carried
across to the real contest -- including team accounts and
any changes a team may have made, say to their
PC2 password.
Q: I would like to be able to change the format of the Scoreboard -- I want to be able to put the data into my own web page for example. Is there a way to get to the Scoreboard data in text form or something like that?
A: Yes; something like that.
When you run a PC2 Scoreboard module,
it automatically
generates a collection of HTML files showing contest
standings and submission data in several different formats. These
HTML files are updated and placed in a directory name "html"
under the $PC2HOME directory (PC2
installation directory) each time there is a change in the contest
standings state (roughly, each time a submission is judged).
This updating is done automatically, on the fly as the state changes.
There are currently FIVE different HTML files generated:
You can therefore get to the "text data" from the scoreboard by
picking it out of the HTML files, if that's what you want.
However, since the generated files are full valid HTML,
you can simply use them as-is, or include them as components
in your own HTML files (as frame data, for example).
For example, when we run a contest under PC2 (as if there was
some other way...) we never run more than ONE Scoreboard module for
the entire contest (even if it is a multi-site contest spread over
multiple continents). Once we have one Scoreboard module running,
we build an external "master" HMTL file containing references to the
PC2 directory HTML files (for example, we insert the various
PC2
HTML files into frames in the master page,
along with things like a header frame
showing the contest title and graphics and so forth). We then write
a script (batch file) to copy the master page to some publicly published
location at regular intervals (e.g. once per minute).
We then tell people who want to see the "scoreboard" (for example,
Teams, Judges, Spectators) to simply point their favorite browser to the
"public" location.
The PC2 Scoreboard will update the
PC2 HTML files whenever the standings change; the script
will copy the updated HTML files to the public location at
the frequency we specify.
This approach also makes it easy to "freeze" the (public) scoreboard
at some point near the end of the contest, if that's what is desired:
simply kill the script which is doing the copying (but not the
PC2 Scoreboard module itself). The internal
scoreboard will continue to update, while the public HTML scoreboard
will "freeze" at the last displayed form.
Q: The scoreboard updates its HTML output files only every 3 minutes; can that be changed ?
A: Yes. An entry in the pc2v8.ini file
can be used to change (or remove) that delay.
The minimum delay is in specified in seconds; if the delay
is set to zero then there is no delay.
An example is shown below.
[client]
minSecsBetweenUpdate=0
Three Notes:
- If the contest time is stopped (like at the end of a contest)
then there will be no delay in updating the html files,
regardless of the delay setting..
- The scoreboard only reads/changes the .ini value
when a "start" contest clock is clicked on the Admin.
- The scoreboard ignores the current delay limit if a Yes
judgement is sent to the board; any Yes judgement causes an
immediate update.
Q: I have heard that the PC2 scoreboard can be configured to print judgement notifications and/or automatically send email messages when a team correctly solves a problem. We'd like to use this function to tell our Contest Runners to take a balloon to the team. How do we get PC2 to print/send balloon messages/e-mails ?
A: Click here to see the Balloon e-mail in PC2 Web Page.
Q: Does PC2 provide support for "Automated Judging"?
A: Yes, in several ways. PC2 allows the
contest administrator to associate, with each contest problem,
something called a "validator". A validator is simply a piece
of software written to accept (as input) the output of a
team's program and return as the validator output an
indication of the correctness of the team's program.
PC2 has a "built-in" validator which can
be used for validation, or you can write your own "custom"
validator and load it into PC
Validator results (indicators of team program correctness)
can be utilized in two ways. In "Recommendation Mode",
the result returned by a validator is simply displayed
for the human judge to see; the judge can either accept
the validator "recommendation", or can assign a
different response to the team's program. In "AutoJudging"
mode, the system automatically accepts the validator result
as the definitive answer for judging the run, and
automatically forwards that result to the team.
This allows PC2 to be set up in "fully-automated"
mode requiring no human intervention in the judging process.
The details of using validators with PC2 are
documented in Appendix F in the Admin Guide.
Q: Where is the interface between a custom (user-written) validator and PC2 documented?
A: The interface and implementation details are documented
in the Admin manual in appendix F.
The interface conforms to the international standard
which is documented here:
International Collegiate Programming Contest Validator
Interface Standard
Note that this standard allows for system-specific
variations, and that PC2 makes use of certain of these
allowed variations. For example, PC2 requires
the use of the "security=key" option shown in the standard.
Be sure to read the entire Appendix F to
gain a clear understanding of how to write a validator for use with
PC2
Q: If the PC2 Server is shut down or dies for some reason, is it necessary for Clients (Teams, Judges, etc.) to log back in?
A:
In the current version of PC2, Yes. Although the state of
the contest (runs submitted, problem names, etc.) is retained between
executions of the Server, the state of remote connections
is not retained.
Note also that if the reverse happens -- e.g. a Client gets killed or
shut down improperly without executing a "log out" operation --
the system will think the Client is still
"logged in" and will not allow the Client to reconnect when it starts
back up -- it considers it a "duplicate login". To fix this, simply
use the "Force Logout" function in the Admin to make the system drop
the login connection to the dead Client, then have the Client log back
in normally. The same is true if a Server dies in a multi-site contest;
before the Server can "reconnect" to the system, it must be "forced off"
by the Administrator. (We're working on improving this aspect of the
system...)
Q: Why can't my PC2 Clients connect to the PC2 Server when I run the server on my Linux machine? (It works fine when the Server is running under Windows, even if the Clients are on Linux machines.)
A:
We have seen this happen when a Linux machine running the PC2
Server has not been properly configured for a network environment.
Specifically, Linux machines typically start up configured to report
their "machine name" as "localhost". PC2 queries the OS to
obtain the machine name, and then maps this name to a corresponding IP
address. The machine name "localhost" maps to the "loopback" IP
address 127.0.0.1. This ends up being the IP address which the
PC2 Server broadcasts to the Clients as the address
they should use for communication back to the Server -- which means
the Clients will be unable to contact the Server because they will
use their own local loopback channel.
To check whether your Linux machine running the PC2 Server
has this problem, type the command "hostname" (or "/bin/hostname")
at a command prompt. If this returns "localhost", your OS is not
properly configured for network operations.
One way to fix this problem on most machines is to edit the file
/etc/sysconfig/network and change the HOSTNAME entry to a host name
which resolves to a non-local IP address, and then reboot the machine.
Another approach is to use the "hostname" command, run as root,
to set the hostname to either a specific non-local IP address or
to a hostname which resolves to a non-local IP address.
One user with this problem wound up changing the hostname
before starting PC2, via a command line like:
which is basically getting the address from the eth0 interface
and setting the hostname to that value.
In any case, be sure to coordinate such actions with your local network
administrator.
hostname $(ifconfig eth0 | grep inet | sed 's/.*r:\| B.*//g')
or (depending on your shell)
hostname `ifconfig eth0 | grep inet | sed 's/.*r:\| B.*//g'`
Q: Sometimes when a PC2 team executes a TEST run they get back no results in the team output window -- even though they can get the program to produce output by compiling it at the command line. Also I notice that in the command window there are error messages like "Bad File Descriptor" and "IOCollector Error" or other similar messages. We've also seen this happen on the PC2 Judge when judging a submitted run. What might be causing this? (p.s. This seems to happen more often when running under Unix/Linux.)
A:
We have noticed that under certain conditions the Java virtual machine
which is acting as the interface between PC2 and the host
OS does not accurately handle the connection between PC2 and
the external processes being used to execute the team program. In fact,
this can also happen when executing the compiler command used to produce
the team's executable program.
The problem seems to occur more frequently under Unix/Linux simply
because those OS's are faster in the way they handle spawning and
handling of the I/O channels for processes.
We are currently investigating this issue and seeking a permanent
solution. Meanwhile, we have discovered that a workaround appears
to be simply slowing the external processes down under Unix/Linux so
that the JVM has time to keep up with the external OS process management
operations.
For example, we have successfully eliminated this problem
in a large Regional Contest by defining each "compiler call" (language)
in PC2 so that instead of directly invoking the compiler,
it invokes a short script (which we call "slowdown"), whose contents
are simply:
#!/bin/sh
nice -19 $*
We then define the compiler execution command (using the PC2
Languages tab in the Administrator) to be (for example for gcc):
slowdown gcc -o {:basename} {:mainfile}
We do a similar thing to invoke the executable program:
slowdown {:basename}
What this does is simply execute the "slowdown" script, passing it the rest of the compile (or execute) command as arguments; the script in turn runs the "nice" command which again in turn runs the command (arguments), but at a low process priority. Note that the "slowdown" script must appear somewhere in the "path"; we typically put it in the PC2 installation directory.
We do note that one undesirable side effect of this two-level process structure (running a script to run the actual program) is that if the actual program hangs for any reason -- for example, a team submits a program with an infinite loop -- and then the Judge uses the "Terminate" button on the Execution Timer, what gets terminated is the external script process, not the actual team program program process running "niced". This means that the Judge will need to use "ps" and "kill" ("TaskManager" for Windows types) to remove the looping process. We are working on a fix for this side effect.
Q: When configuring a problem to read the data input from stdin, sometimes the results are incorrect or the program hangs. What might be causing this?
A: This is a known Java bug in versions prior to 1.4.1_05. The fix for this bug is to use Java version 1.4.1_05 or later. For more details see Bug 4843136 at the Sun developer site.
Q:
What if my problem is not covered in the above list?
Can you still help me?
A:
Well, we will be happy to try (please keep in mind that this is
a totally volunteer project on our part). The first thing we ask is that
you make the effort to read the Administrator's Guide and see if you can
find out from there what is going on. The Admin Guide is available on
our web page, and it comes packaged with the system when you download it.
If that doesn't do it....
Each of the PC2 modules generates entries in a "log" file.
The log file names correspond to the module -- team.log, judge.log, etc.
Look through the log files and see if there are any obvious error
messages -- this will frequently give you a clue as to what is
happening.
If you still can't figure out what is happening, create a "PC2Zip"
file of the system and send us an email
message (
pc2@ecs.csus.edu
)
java pc2.ZipPC2
This will create a .zip file of the system in the archive/ directory;
go into the archive/ directory and attach the file to your mail
message. (If
the problem relates to multiple modules on multiple machines, please
send a PC2Zip file for each module).