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.

Helpful ways to quickly find more information about PC²

Use Google to search the PC² Wiki for more information, for example use: csus pc2 perl

Check the latest PC² Contest Admininstrator's Guide, that can be found on the PC² documentation page. The Contest Admininstrator's Guide is also in the doc/ directory in the distribution.

Version 9 Questions

Resetting A Contest



Version 8 Questions


Contest Configuration

PC2 Scoreboard

PC2 Validators (Automated Judging)


Microsoft Windows-Specific

Other PC2 Questions

Getting Help

Q: I want to run a Practice contest, then quickly switch to a Real contest. How can I do this in Version 9?

A: Starting with Version 9.3, this functionality is supported through the use of "profiles". Whenever you enter contest description data (e.g. accounts, languages, etc.), you are specifying values in the "current contest profile". The Admin module has a function which allows creation of new profiles (contest descriptions), including the ability to "clone" a profile (i.e. make a copy of an existing contest description) and the ability to switch to a different profile (i.e. make some other profile become the current profile).

Thus, to easily run a Practice contest followed immediately by a Real contest, you create the Practice profile up through the point where it contains all the information which is to be shared in common with the Real contest (for example, all the team accounts, language descriptions, judgements, etc.), omitting those data which are practice- or real-contest specific (e.g. the problem sets). You then clone the Practice profile, creating a new "Real contest profile". Each profile can then be independently completed with its profile-specific data (the data for the Practice contest problems entered into the Practice profile; the data for the Real contest problems entered into the Real contest profile; etc.).

When a server is started, if there is more than one profile present in the system it asks which profile should be used. The Practice profile can be selected and the Practice contest run; when the Practice contest is done it is a one-button operation to switch to the already-configured "Real contest profile", effectively "resetting" the system from Practice contest to Real contest. (Note: selecting or switching to a profile requires entering a password; the password for each profile is specified by the contest administrator when the profile is first created.)

Q: I'm using Version 9.2 (or earlier) and I can't find the "Profile" function described above to accomplish a quick switch between a Practice and Real contest. How can I do the equivalent operation in V9.2 or earlier?

A: Unfortunately the "profile" function is not available in versions prior to 9.3. The following manual steps can be used to accomplish the equivalent of a "reset" or "switch profile" from a Practice contest to a Real contest in earlier versions (note that these instructions assume a single-site contest):

  1. On the PC² Server machine, create two directories called (for example) "real" and "practice".

  2. Copy your pc2v9.ini file into the "real" directory.

  3. Change into the "real" directory.

  4. Start the PC² Server using the command "pc2server", then login to the Server.

  5. In a different terminal window, change into the "real" directory and start a PC² Admin using the command "pc2admin", then login to the Admin.

  6. Use the Admin to configure all of the contest configuration items which will be the same for both the Real and the Practice contests. Typically this might include specifying things like Accounts, Languages, Judgement response messages, AutoJudging configuration, Group assignments, and loading ICPC registration data, but would not include entry of contest problems or judge's data files, since these are typically different between the Practice and Real contests. It might or might not include values on the Notifications and Settings tabs, depending on whether or not you want those values to be the same for the Real contest as for the Practice contest. The point of this step is to configure, in the Real contest, only those items which are the same in both contests.

  7. Exit (shut down) both the PC² Admin and the PC² Server.

  8. In the "real" directory, execute the command "pc2zip". This will create a directory named "archive", and will place into that directory a "zip" file containing the current contest configuration (that is, the Real contest configured only with those data which are the same as for the Practice contest). The name of the archive "zip" file includes a UTC timestamp to help identify it.

  9. Copy the .zip file created in the preceding step from the archive directory (under the "real" directory) into the "practice" directory.

  10. Still in the "real" directory, restart the PC² Server and then the PC² Admin, and finish configuring the Real contest (enter the Real Contest problem descriptions, along with any other data that is unique to the Real contest). When done, you might want to shut down the Admin and Server and execute another "pc2zip" command in the "real" directory to make an archive backup of the final Real Contest configuration (this is not required, but it might be helpful later and it will not affect the previously-created zip file since each archive file is uniquely named).

  11. Change into the "practice" directory and unzip the copied .zip file. The effect of this step is that you now have in the "practice" directory a contest configuration which matches the saved Real Contest configuration -- that is, a configuration containing only those data which are the same between the Real and Practice contests.

  12. In the "practice" directory, start the PC² Server and then the PC² Admin, and finish configuring the Practice contest (enter the Practice Contest problem descriptions, along with any other data that is unique to the Practice contest). When done, shut down the Admin and Server and execute a "pc2zip" command from within the "practice" directory to make an archive backup of the final Practice Contest configuration (again, this is not required but it might be useful later).

To run the Practice Contest, change to the "practice" directory and start the PC² Server and Admin; use the Admin Times tab to start the (Practice) contest running. To switch to the Real Contest, first use the Times tab to stop the Practice Contest. Next, shutdown all PC² modules, change to the "real" directory, and restart the PC² Server and Admin from within that directory. Finally, use the Admin Times tab to start the Real Contest.

Q: When logging in, I get a message that says: "Unable to contact server, contact staff". What might cause this?

A: This could be a network problem (firewall) or more commonly the pc2v9.ini file was either missing or the server= entry has not been updated to point to the actual server host and port.

In the log file logs/pc2-startup-0.log there is an entry that shows which host and port is being contacted, for example:

090809 145358.046|INFO|main|info|Contacting server at localhost:50002
This shows the default host name which is likely different than the host name that is being used.

Q: Where is there more information about Version 9 ?

A: Review the PC2 Documentation and the PC2 Wiki .

Q: How can I get the Java source code for PC² ?

A: PC² is not an Open-Source project; unfortunately, the source code is not available publicly at this time. This may change in the future, but it is not likely to change any time very soon.


Q: What version of Java should I be using to run PC2?

A: The current release of PC2 requires at least JDK 1.7. This is the version we have tested most extensively, including running multiple Regional Contests. Newer 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:

Contest Configuration

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.

		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:

		Active  (either "true" or "false")
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.

  1. Configure and run the practice contest. After the practice contest is over, go to the "Time/Reset" tab on the PC2 Admin and push the appropriate "Reset" button ("Reset Site" or "Reset All Sites"). This will clear the problem definitions, runs, and clarifications from the practice contest but retain all other contest configuration information. You will then have to add the problem definitions for the real contest.

  2. Configure and run your practice contest, then when the practice is over kill all PC2 clients and the server, then use the command "pc2reset" on the server machine (typed in the directory in which the server was running) to reset the contest database. This will make a backup (zip file) of the current contest state, then delete all contest configuration information (putting the system back to an initial installation configuration, except for the contents of .ini files). You can then restart the server, start a new Administrator, configure the real contest (including loading account, language, and problem information), and start the real contest.

  3. First create a subdirectory (say, "real"), configure the real contest in that subdirectory (meaning, start the server in that directory, then start an Admin and configure the contest). Then shut down the Admin and the server, move to a different directory (say, "practice"), start the server and then an Admin, and configure the practice contest. You can then run the practice contest from that directory. When the practice is over, simply kill all the clients and the server, switch to the (pre-configured) "real" directory, and restart the server from that directory.
    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.

PC2 Scoreboard

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.

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.

PC2 Validators (Automated Judging)

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 when configuring the contest.

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 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 This ends up being the IP address which PC2 uses for network communication -- which means Clients will be unable to contact the Server (or vice-versa) because they will use their own local loopback channel instead of broadcasting over the network.

To check whether your Linux machine 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. Note that both the PC2 Server and the Client machines must be properly configured in order for PC2 to work properly.

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:

 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'`

which is basically getting the address from the eth0 interface and setting the hostname to that value.

In any case, be sure to coordinate any changes in network addresses with your local network administrator.

Microsoft Windows-Specific

Q: After configuring PC2 with a language under Windows, when I try to execute a program submitted using that language I get an error message saying something is wrong with "ntvdm". What could cause this?

A: "NTVDM" is the Windows NT Virtual DOS Machine. It is a Windows subsystem that attempts to allow older "16-bit" applications such as Borland's "Turbo" compilers to run in the 32-bit Windows NT environment (which is the environment used in Windows 2000, Windows XP, and Windows Vista, not just under "Windows NT"). However, PC2 does not support use of 16-bit applications. You will need to replace your old 16-bit language system with a 32-bit compiler.

Other Questions

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:

	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:   The admin hangs on login with Java 1.8.0_161, what might be causing this?

A: See wiki article section on pc2 wiki, Unable to login as admin using Java 1.8

Getting Help

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 set of "PC2 Zip" files of the system and send us an email message ( pc2@ecs.csus.edu ) describing the problem and containing the PC2 Zip files as attachments and we'll see what we can do to help. To generate the PC2 Zip files,

  1. Go to the PC2 installation directory on the PC2 Server in use when the problem occurred and type the command "pc2zip".
  2. Go to any other machine(s) which were also involved in the problem (for example, if the problem was associated with a Judge then go to the Judge's machine) and type the same command ("pc2zip") in the PC2 installation directory on that machine.
  3. Go into the "archive/" directory on each machine, find the .zip file created by the pc2zip command (it will have the current date/time as part of the file name), and attach each .zip file to your email message.

Please note that unless we have zip files from the Server as well as any other machine(s) associated with the problem, it is very hard for us to give you any meaningful help.

Return to PC2 Home Page

Revised: Tue Jan 16 19:49:38 PST 2018