Scheduled LDAP failed with Duplicate key error

Scheduled LDAP failed with Duplicate key error

by Rey Ong -
Number of replies: 0

Hi there,

Whenever I run the cron job on ldap sync task, following error message came out:

Scheduled task failed: LDAP users sync job (auth_ldap\task\sync_task),Error writing to database

Debug info:

Duplicate entry '1-nb08615$' for key 'mdl_tmpextu_mneuse_uix'

INSERT INTO mdl_tmp_extuser (username,mnethostid) VALUES(?,?)

[array (

  0 => 'nb08615$',

  1 => '1',

)]

Backtrace:

* line 1357 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()

* line 994 of /auth/ldap/auth.php: call to mysqli_native_moodle_database->insert_record_raw()

* line 771 of /auth/ldap/auth.php: call to auth_plugin_ldap->ldap_bulk_insert()

* line 50 of /auth/ldap/classes/task/sync_task.php: call to auth_plugin_ldap->sync_users()

* line 248 of /lib/cronlib.php: call to auth_ldap\task\sync_task->execute()

* line 150 of /admin/cli/scheduled_task.php: call to cron_run_inner_scheduled_task()


Potential coding error - existing temptables found when disposing database. Must be dropped!



I have checked this 1-nb08615$'  and its pointing back to my own profile/guest user. (either admin or my own normal user login)
Environment:
Moodle 3.9+

PHP 7.3+

MariaDB 10.3+

Centos 7

Auth method: LDAP with MS AD

All the solutions I found online seems point to a certain duplicated users ID clearly, but not applicable to this issue. Been pulling my hair out for this, please help. THank you.

Average of ratings: -