Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error during search index rebuild #62

Open
DrewGleeson opened this issue Feb 1, 2016 · 3 comments
Open

Error during search index rebuild #62

DrewGleeson opened this issue Feb 1, 2016 · 3 comments

Comments

@DrewGleeson
Copy link

Hi

We are attempting to rebuild the search indexes which fails with the below message:
`Potential coding error - active database transaction detected during request shutdown:

  • line 3449 of /mod/forumng/mod_forumng.php: call to moodle_database->start_delegated_transaction()
  • line 140 of /mod/forumng/lib.php: call to mod_forumng::search_update_all()
  • line 41 of /local/ousearch/postinstall.php: call to forumng_ousearch_update_all()
    , referer: https://www-test.moodle.is.ed.ac.uk/local/ousearch/postinstall.php`

Do you know what can be done about this?

Thanks in advance for your time.

Best regards,
Andrew Gleeson
University of Edinburgh

@DrewGleeson
Copy link
Author

Software versions:
Moodle: 2.8.6+ (Build: 20150528)
ForumNG: 2015060500 (2.8 r1)
OUsearch: 2015050100

@DrewGleeson
Copy link
Author

We were getting failures at various points in the search index rebuild process.
The running order seemed to be as follows for us:
forumng > oublog > ouwiki

If it failed during forumng, then there would be no previous message in the logs to indicate why.
However, failing on either of the others we would see the following log entry before the above mentioned "Potential coding error" message:
"[:error] PHP Fatal error: Maximum execution time of 300 seconds exceeded in /u01/app/moodle/moodle/cache/classes/loaders.php on line 542,
referer: /local/ousearch/postinstall.php"

Looking at our PHP config the max_execution_time for our Moodle environment is set at 600 seconds. Considering this and looking further at the code, it turned out that this setting was being over-ridden by a call to set_time_limit($timelimitbefore); with a timelimitbefore value of 300. This was persisting through the rest of the index rebuild process.

Interesting note: Attempting to remove this completely (assuming that the php timout of 600 seconds would be sufficient) it failed with a "Maximum execution time of 600 seconds exceeded" ;-(

The solution for us was to simply change the timeout value on line 3445 in mod_forumng.php from 300 to 600.

Long term solution suggested in moodleou/moodle-local_ousearch#7 was to use something like core_php_time_limit::raise() in order to only increase the time limit and not decrease it.
I've not been able to find information on anything like that, although using ini_get('max_execution_time'); along with some logic to only increase this timeout if it's below a certain value could be sufficient too.

Saying that though, the "generally sufficient" 300 seconds is unfortunately not always sufficient, which is what makes this a tricky one.

For now, our solution is sufficient for us so I will close this call.

Cheers,
Andrew

@DrewGleeson
Copy link
Author

Actually, I think it's best to leave this one open for now as the above solution is a bit of a short-term "hacky" solution.

I'll leave it to yourselves to decide on the best way forward in the longer term.

From what we've experienced, a fairly simple solution could be to:
1 - get current php max_execution_time value
2 - if this is below 300 the set timelimitbefore to 300, else use the current environment value
3 - reset the timeout with this value inside the loop (as already being done)
.... or use a core_php_time_limit::raise() type mechanism

Regards,
Andrew

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant