Open truongan opened 9 years ago
What database are you using? Add echo $assignment_id;
before that line, and see the result.
Hi @mjnaderi
Thank you very much for your fast reply.
I'm using mysql, echo $assignment_id;
print out 2
which was the correct id for my assigments.
And FYI, adding $this->db->reconnect();
to the file applicatiopns/controllers/Queueprocess.php:
before line 135 seem to fix the poblem for me. Could you verify it please?
--Updated--
It seems that database connection times out.
This is how reconnect
is implemented for mysql driver: https://github.com/mjnaderi/Sharif-Judge/blob/Version-1/system/database/drivers/mysql/mysql_driver.php#L168
And this is how reconnect
is implemented for mysqli driver: https://github.com/mjnaderi/Sharif-Judge/blob/Version-1/system/database/drivers/mysqli/mysqli_driver.php#L138
Dump the result of mysql_ping($this->db->conn_id)
or $this->db->conn_id->ping()
.
Also check connection timeout in MySql settings, and try increasing timeout using mysqli_options, just before running submitted code.
mysql_ping($this->db->conn_id)
failed I guess, it simply printed out NULL
and caused a warning message
Severity: WarningMessage: mysql_ping() expects parameter 1 to be resource, object givenFilename: /home/judge/web/testjudge.truongan.name.vn/public_html/application/controllers/Queueprocess.phpLine Number: 135
$this->db->conn_id->ping()
dump out
bool(false)
And for the dbdriver info, I'm using mysqli.
Lien he voi minh!
2015-05-09 9:15 GMT+07:00, truongan notifications@github.com:
mysql_ping($this->db->conn_id)
failed I guess, it simply printed outNULL
and caused a warning messageSeverity: WarningMessage: mysql_ping() expects parameter 1 to be resource, object givenFilename: /home/judge/web/testjudge.truongan.name.vn/public_html/application/controllers/Queueprocess.phpLine Number: 135
$this->db->conn_id->ping()
dump outbool(false)
And for the dbdriver info, I'm using mysqli.
Reply to this email directly or view it on GitHub: https://github.com/mjnaderi/Sharif-Judge/issues/32#issuecomment-100411843
Minh da lam Full code va chay oke!
2015-06-10 23:44 GMT+07:00, Linh Pham Van phamvanlinh.group@gmail.com:
Lien he voi minh!
2015-05-09 9:15 GMT+07:00, truongan notifications@github.com:
mysql_ping($this->db->conn_id)
failed I guess, it simply printed outNULL
and caused a warning messageSeverity: WarningMessage: mysql_ping() expects parameter 1 to be resource, object givenFilename: /home/judge/web/testjudge.truongan.name.vn/public_html/application/controllers/Queueprocess.phpLine Number: 135
$this->db->conn_id->ping()
dump outbool(false)
And for the dbdriver info, I'm using mysqli.
Reply to this email directly or view it on GitHub: https://github.com/mjnaderi/Sharif-Judge/issues/32#issuecomment-100411843
Can adding $this->db->reconnect(); to Queueprocess.php:134 be considered a fix to this problem? I think we can mark this as resolved, if you too busy to commit a fix I can send you a ping request
Long story short, my assignments has one problems with fairly large test case. The whole problem would take Total Execution Time: 37282 ms to complete. And then the submission status just stuck at PENDING
I ssh into the server and execute
php index.php queueprocess run
to see the output (after change line 56 in index.php todefine('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');
of course)The fatal line was:
$scoreboard_enabled = $this->db->select('scoreboard')->get_where('assignments', array('id'=>$assignment_id))->row()->scoreboard;
I tried to
var_dump($this->db->select('scoreboard')->get_where('assignments', array('id'=>$assignment_id)))
and it print outbool(false)
So my best guess is that the database access failed somehow. I was not familiar with CodeIgniter enough to investigate any further. Even The backtrace failed to printout (I don't know why) though I believe it start from applicatiopns/controllers/Queueprocess.php:135
$this->queue_model->save_judge_result_in_db($submission, $type);
Also the source code was in C++, I had sandbox turned off because it increase execution time too much. When I did try to upload a simple "Hello world" program to the problem it execute fast enough for the system to just it as wrong. But the solution for the problem just stuck at PENDING because it took longer to executed.
If you need any more information just let me know.