XF 2.0 XF_job is eating up CPU

KSA

Well-known member
We have noticed lately that there is high cpu usage and after digging up here and there we found that xf_job could be the source of this issue. we keep getting There are manual rebuild jobs awaiting completion in the ACP and the site is very slow, posts are being duplicated.

mysqladmin processlist
Code:
mysqladmin processlist


+----------+--------------+-----------+--------------+---------+------+--------------------------+------------------------------------------------------------------------------------------------------+----------+


| Id       | User         | Host      | db           | Command | Time | State                    | Info                                                                                                 | Progress |


+----------+--------------+-----------+--------------+---------+------+--------------------------+------------------------------------------------------------------------------------------------------+----------+


| 1        | system user  |           |              | Daemon  |      | InnoDB purge coordinator |                                                                                                      | 0.000    |


| 2        | system user  |           |              | Daemon  |      | InnoDB purge worker      |                                                                                                      | 0.000    |


| 3        | system user  |           |              | Daemon  |      | InnoDB purge worker      |                                                                                                      | 0.000    |


| 4        | system user  |           |              | Daemon  |      | InnoDB purge worker      |                                                                                                      | 0.000    |


| 5        | system user  |           |              | Daemon  |      | InnoDB shutdown handler  |                                                                                                      | 0.000    |


| 10641893 | database_name | localhost | database_name | Execute | 15   | query end                | UPDATE  `xf_job` SET `trigger_date` = ?, `last_run_date` = ? WHERE job_id = ? AND trigger_date = ?   | 0.000    |


| 10641917 | database_name | localhost | database_name | Execute | 8    | update                   | INSERT  INTO `xf_thread_read` (`thread_id`, `user_id`, `thread_read_date`) VALUES (?, ?, ?) ON DUPLI | 0.000    |


| 10641956 | root         | localhost |              | Query   | 0    | init                     | show processlist                                                                                     | 0.000    |


+----------+--------------+-----------+--------------+---------+------+--------------------------+------------------------------------------------------------------------------------------------------+----------+

Is it ok to empty/truncate the table? also when running the rebuild though ACP it starts the process by "deleting user..1" and start deleting users! is that something we should worry about? I have no idea what users are being deleted and why!

Screen Shot 2018-10-31 at 6.06.13 AM.webp
 
Based on your process list, you seemingly have some other server performance issues. Both of those queries are trivial single row writes. If they're taking 8 or 15 seconds, then something else has gone very wrong. You likely need to look what is using CPU in the server itself and debug down from there.

In terms of the deleting user thing, it looks like you deleted a user (with a rename) on the 24th of September but never let the job that it triggered run (which handles the rename and then delete). It would appear to be the user that was ID 36085. In the message you saw, the value after "deleting" would've been the username you chose. (The final number in parentheses being the number of steps into the process.)

Given that you already deleted the user, you should let that run.

It should not be considered safe to empty the job table. Even removing specific jobs should only be considered if you understand the details of why you're removing it. If you have manual jobs pending, they should generally be run through unless you have a particular reason not to.
 
  • Like
Reactions: KSA
Top Bottom