mattporritt / moodle-search_elastic

An Elasticsearch engine plugin for Moodle's Global Search
https://moodle.org/plugins/search_elastic
GNU General Public License v3.0
16 stars 13 forks source link

Debug messages with indexing the "Messages - received" and "Messages - sent" area #27

Closed abias closed 7 years ago

abias commented 7 years ago

Hi Matt,

I am currently looking into search_elastic and have added the latest version of this plugin to a Moodle 3.2.3+ (Build: 20170622) instance and have hooked this up to a fresh elasticsearch 5.5 instance.

While doing the first indexing with sudo -u apache /opt/rh/rh-php70/root/usr/bin/php /var/www/html/moodle_dev3/search/cli/indexer.php --force I saw that there are tons of CLI debug messages for the "Messages - received" and "Messages - sent" area telling me:

++ Error retrieving core_message-message_sent 2111873 document, not all required data is available: Ungültige Nutzer/in ++
* line 59 of /message/classes/search/base_message.php: call to debugging()
* line 61 of /message/classes/search/message_sent.php: call to core_message\search\base_message->get_document()
* line ? of unknownfile: call to core_message\search\message_sent->get_document()
* line 103 of /lib/classes/dml/recordset_walk.php: call to call_user_func()
* line 573 of /search/classes/manager.php: call to core\dml\recordset_walk->current()
* line 75 of /search/cli/indexer.php: call to core_search\manager->index()

("Ungültige Nutzer/in" is the german term for "Invalid user" as I have set $CFG->lang = 'de' in config.php.

However, after some time and a very long CLI output, the indexing job comes to an end.

I had also quickly setup a SOLR instance some weeks ago and I can't remember that indexing the same Moodle instance with SOLR had also thrown these kind of errors.

The only reason for these problems I can think of is that we are using auth_ldap sync on a regular basis to delete Moodle accounts which have disappeared in LDAP, so there might be messages in the Moodle database which don't have a connected sender or receiver Moodle account anymore.

In the end, I am wondering if these debug messages come from your plugin or from Moodle core and if I should worry about them or not.

Thanks in advance, Alex

mattporritt commented 7 years ago

Congrats @abias you've found a core bug! This will occur regardless of if Solr or Elastic is being used. Do you want to raise a Moodle tracker or would you prefer if I did it?

My guess is that \core_message\message_sent get_document() needs to be modified to deal with missing users.

I'll keep this issue open until a Moodle tracker is created

To reproduce:

  1. Create a Moodle instance with two users in the same course
  2. Have the first user send the second a message
  3. Have the second user respond to the first user message
  4. Delete the first user
  5. Run the site index task

Trace in English

++ Error retrieving core_message-message_received 1 document, not all required data is available: Invalid user ++
* line 59 of /message/classes/search/base_message.php: call to debugging()
* line 62 of /message/classes/search/message_received.php: call to core_message\search\base_message->get_document()
* line ? of unknownfile: call to core_message\search\message_received->get_document()
* line 103 of /lib/classes/dml/recordset_walk.php: call to call_user_func()
* line 382 of /search/engine/elastic/classes/engine.php: call to core\dml\recordset_walk->current()
* line 666 of /search/classes/manager.php: call to search_elastic\engine->add_documents()
* line 93 of /search/cli/indexer.php: call to core_search\manager->index()
  Processed 1 records containing 1 documents, in 0.028 seconds.
abias commented 7 years ago

Hi Matt,

Yay, I found another core bug :) Thanks for your feedback and the investigation.

Here's the tracker issue: https://tracker.moodle.org/browse/MDL-59834.

As far as I see now, this issue does not affect indexing other messages or even other search areas, so I would wait if Moodle HQ picks the bug or not before spending time and money into this topic.

Thanks, Alex

mattporritt commented 7 years ago

closing, Moodle tracker created