"미디어위키 Error: 1205 Lock wait timeout exceeded; try restarting transaction"의 두 판 사이의 차이

잔글 (봇: Jmnote의 2017-10-01T10:26:22Z 에 작성한 349322 판으로 되돌림)
잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
 
11번째 줄: 11번째 줄:


==확인==
==확인==
<source lang='console'>
<syntaxhighlight lang='console'>
root@zetawiki:~# php /var/www/mediawiki/maintenance/runJobs.php
root@zetawiki:~# php /var/www/mediawiki/maintenance/runJobs.php
root@zetawiki:~#  
root@zetawiki:~#  
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
MariaDB [mediawiki]> SELECT COUNT(*) FROM job;
MariaDB [mediawiki]> SELECT COUNT(*) FROM job;
+----------+
+----------+
23번째 줄: 23번째 줄:
+----------+
+----------+
1 row in set (0.00 sec)
1 row in set (0.00 sec)
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
MariaDB [mediawiki]> SELECT COUNT(*), job_cmd FROM job GROUP BY job_cmd;
MariaDB [mediawiki]> SELECT COUNT(*), job_cmd FROM job GROUP BY job_cmd;
+----------+-------------------------+
+----------+-------------------------+
35번째 줄: 35번째 줄:
+----------+-------------------------+
+----------+-------------------------+
4 rows in set (0.00 sec)
4 rows in set (0.00 sec)
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
MariaDB [mediawiki]> UPDATE job SET job_attempts=0;
MariaDB [mediawiki]> UPDATE job SET job_attempts=0;
ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
</source>
</syntaxhighlight>


==조치==
==조치==
<source lang='console'>
<syntaxhighlight lang='console'>
MariaDB [mediawiki]> show variables like 'innodb_lock_wait_timeout';
MariaDB [mediawiki]> show variables like 'innodb_lock_wait_timeout';
+--------------------------+-------+
+--------------------------+-------+
50번째 줄: 50번째 줄:
+--------------------------+-------+
+--------------------------+-------+
1 row in set (0.01 sec)
1 row in set (0.01 sec)
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
MariaDB [mediawiki]> set innodb_lock_wait_timeout=120;
MariaDB [mediawiki]> set innodb_lock_wait_timeout=120;
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
MariaDB [mediawiki]> show variables like 'innodb_lock_wait_timeout';
MariaDB [mediawiki]> show variables like 'innodb_lock_wait_timeout';
+--------------------------+-------+
+--------------------------+-------+
63번째 줄: 63번째 줄:
+--------------------------+-------+
+--------------------------+-------+
1 row in set (0.00 sec)
1 row in set (0.00 sec)
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
MariaDB [mediawiki]> update job set job_attempts=0 limit 1;
MariaDB [mediawiki]> update job set job_attempts=0 limit 1;
Query OK, 1 row affected, 1 warning (0.00 sec)
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 1
Rows matched: 1  Changed: 1  Warnings: 1
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
MariaDB [mediawiki]> update job set job_attempts=0 where job_attempts!=0 LIMIT 10;
MariaDB [mediawiki]> update job set job_attempts=0 where job_attempts!=0 LIMIT 10;
Query OK, 10 rows affected, 1 warning (0.01 sec)
Query OK, 10 rows affected, 1 warning (0.01 sec)
Rows matched: 10  Changed: 10  Warnings: 1
Rows matched: 10  Changed: 10  Warnings: 1
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
MariaDB [mediawiki]> update job set job_attempts=0 where job_attempts!=0 LIMIT 10;
MariaDB [mediawiki]> update job set job_attempts=0 where job_attempts!=0 LIMIT 10;
Query OK, 10 rows affected, 1 warning (1 min 28.26 sec)
Query OK, 10 rows affected, 1 warning (1 min 28.26 sec)
Rows matched: 10  Changed: 10  Warnings: 1
Rows matched: 10  Changed: 10  Warnings: 1
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
MariaDB [mediawiki]> update job set job_attempts=0 where job_attempts!=0 LIMIT 10;
MariaDB [mediawiki]> update job set job_attempts=0 where job_attempts!=0 LIMIT 10;
Query OK, 10 rows affected, 1 warning (0.00 sec)
Query OK, 10 rows affected, 1 warning (0.00 sec)
Rows matched: 10  Changed: 10  Warnings: 1
Rows matched: 10  Changed: 10  Warnings: 1
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
MariaDB [mediawiki]> update job set job_attempts=0 where job_attempts!=0 LIMIT 10;
MariaDB [mediawiki]> update job set job_attempts=0 where job_attempts!=0 LIMIT 10;
ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
MariaDB [mediawiki]> update job set job_attempts=0 where job_attempts!=0 LIMIT 5;
MariaDB [mediawiki]> update job set job_attempts=0 where job_attempts!=0 LIMIT 5;
ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
MariaDB [mediawiki]> update job set job_attempts=0 where job_attempts!=0 LIMIT 1;
MariaDB [mediawiki]> update job set job_attempts=0 where job_attempts!=0 LIMIT 1;
Query OK, 1 row affected, 1 warning (1 min 38.41 sec)
Query OK, 1 row affected, 1 warning (1 min 38.41 sec)
Rows matched: 1  Changed: 1  Warnings: 1
Rows matched: 1  Changed: 1  Warnings: 1
</source>
</syntaxhighlight>


==의견==
==의견==
105번째 줄: 105번째 줄:
:[[innodb_lock_wait_timeout]]을 120으로 늘리고 job테이블의 job_attempts 컬럼을 0으로 업데이트하며 작업을 반복하여 해소함
:[[innodb_lock_wait_timeout]]을 120으로 늘리고 job테이블의 job_attempts 컬럼을 0으로 업데이트하며 작업을 반복하여 해소함


<source lang='console'>
<syntaxhighlight lang='console'>
root@zetawiki:~# crontab -l | grep runJobs
root@zetawiki:~# crontab -l | grep runJobs
* * * * * php /var/www/mediawiki/maintenance/runJobs.php >> /var/log/runJobs.log 2>&
* * * * * php /var/www/mediawiki/maintenance/runJobs.php >> /var/log/runJobs.log 2>&
</source>
</syntaxhighlight>
<source lang='console'>
<syntaxhighlight lang='console'>
root@zetawiki:~# vi /var/www/mediawiki/LocalSettings.php
root@zetawiki:~# vi /var/www/mediawiki/LocalSettings.php
</source>
</syntaxhighlight>
<source lang='php'>
<syntaxhighlight lang='php'>
# End of automatically generated settings.
# End of automatically generated settings.
# Add more configuration options below.
# Add more configuration options below.
#---------------------------------------------------------------------
#---------------------------------------------------------------------
$wgRunJobsAsync = false;
$wgRunJobsAsync = false;
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==

2020년 11월 2일 (월) 00:56 기준 최신판

1 개요[ | ]

Error: 1205 Lock wait timeout exceeded; try restarting transaction (135.79.246.80)

[a3ce57bdfc91ea46d80257fb] /w/index.php?title=ll&action=submit JobQueueError from line 802 of /var/www/html/w/includes/jobqueue/JobQueueDB.php: DBQueryError: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?
Query: DELETE FROM job WHERE job_cmd = 'refreshLinksPrioritized' AND job_id = '9135'
Function: JobQueueDB::doAck
Error: 1205 Lock wait timeout exceeded; try restarting transaction (135.79.246.80)
Backtrace:
... (생략)

2 확인[ | ]

root@zetawiki:~# php /var/www/mediawiki/maintenance/runJobs.php
root@zetawiki:~#
MariaDB [mediawiki]> SELECT COUNT(*) FROM job;
+----------+
| count(*) |
+----------+
|      203 |
+----------+
1 row in set (0.00 sec)
MariaDB [mediawiki]> SELECT COUNT(*), job_cmd FROM job GROUP BY job_cmd;
+----------+-------------------------+
| COUNT(*) | job_cmd                 |
+----------+-------------------------+
|        7 | htmlCacheUpdate         |
|        2 | recentChangesUpdate     |
|        8 | refreshLinksDynamic     |
|      187 | refreshLinksPrioritized |
+----------+-------------------------+
4 rows in set (0.00 sec)
MariaDB [mediawiki]> UPDATE job SET job_attempts=0;
ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction

3 조치[ | ]

MariaDB [mediawiki]> show variables like 'innodb_lock_wait_timeout';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| innodb_lock_wait_timeout | 25    |
+--------------------------+-------+
1 row in set (0.01 sec)
MariaDB [mediawiki]> set innodb_lock_wait_timeout=120;
Query OK, 0 rows affected (0.00 sec)
MariaDB [mediawiki]> show variables like 'innodb_lock_wait_timeout';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| innodb_lock_wait_timeout | 120   |
+--------------------------+-------+
1 row in set (0.00 sec)
MariaDB [mediawiki]> update job set job_attempts=0 limit 1;
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 1
MariaDB [mediawiki]> update job set job_attempts=0 where job_attempts!=0 LIMIT 10;
Query OK, 10 rows affected, 1 warning (0.01 sec)
Rows matched: 10  Changed: 10  Warnings: 1
MariaDB [mediawiki]> update job set job_attempts=0 where job_attempts!=0 LIMIT 10;
Query OK, 10 rows affected, 1 warning (1 min 28.26 sec)
Rows matched: 10  Changed: 10  Warnings: 1
MariaDB [mediawiki]> update job set job_attempts=0 where job_attempts!=0 LIMIT 10;
Query OK, 10 rows affected, 1 warning (0.00 sec)
Rows matched: 10  Changed: 10  Warnings: 1
MariaDB [mediawiki]> update job set job_attempts=0 where job_attempts!=0 LIMIT 10;
ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
MariaDB [mediawiki]> update job set job_attempts=0 where job_attempts!=0 LIMIT 5;
ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
MariaDB [mediawiki]> update job set job_attempts=0 where job_attempts!=0 LIMIT 1;
Query OK, 1 row affected, 1 warning (1 min 38.41 sec)
Rows matched: 1  Changed: 1  Warnings: 1

4 의견[ | ]

미디어위키 작업큐에 있는 작업 중에는 50초 이상 걸리는 것도 있는데, 대기시간이 짧으면 계속 실패할 뿐 해소가 안됨
innodb_lock_wait_timeout을 120으로 늘리고 job테이블의 job_attempts 컬럼을 0으로 업데이트하며 작업을 반복하여 해소함
root@zetawiki:~# crontab -l | grep runJobs
* * * * * php /var/www/mediawiki/maintenance/runJobs.php >> /var/log/runJobs.log 2>&
root@zetawiki:~# vi /var/www/mediawiki/LocalSettings.php
# End of automatically generated settings.
# Add more configuration options below.
#---------------------------------------------------------------------
$wgRunJobsAsync = false;

5 같이 보기[ | ]

6 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}