← Back to team overview

mahara-contributors team mailing list archive

[Bug 1256118] Re: elasticsearch install hangs if ElasticSearch Server not running

 

https://reviews.mahara.org/#/c/2757/
I have added a function in elasticsearch to check to see if one can connect to the host/port with the given elasticsearch host and port details.

I tried using the inbuilt Elastica functions like getConnection() or isEnabled() to achieve a similar thing but there was instances where I could generate false positives / negatives if I ran 
sudo /etc/init.d/elasticsearch stop
or
sudo /etc/init.d/elasticsearch start

After certain pages had already loaded

The inbuilt checks seem to  be one page load behind actual state.

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1256118

Title:
  elasticsearch install hangs if ElasticSearch Server not running

Status in Mahara ePortfolio:
  In Progress

Bug description:
  If you try to enable the elasticsearch search option in Configure site
  -> Site options -> Search settings when the ElasticSearch Server is
  not running it hangs on saving site options.

  There needs to be a report back to the screen that an error occurred
  like 'ElasticSearch Server is not running, please start service and
  try again'

  Actually for this to work we'd need to check if it is running before
  letting them choose it - because the site option is saved before the
  failure so coming back to the page it shows the search is set to
  'elasticsearch' which is incorrect.

  The error log has errors like this:

  
  [WAR] 15 (lib/errors.php:448) An exception was thrown of class Elastica\\Exception\\ClientException. , referer: http://mahara-testing/admin/site/options.php
  [WAR] 15 (lib/errors.php:448) THIS IS BAD and should be changed to something extending MaharaException,, referer: http://mahara-testing/admin/site/options.php
  [WAR] 15 (lib/errors.php:448) unless the exception is from a third party library., referer: http://mahara-testing/admin/site/options.php
  [WAR] 15 (lib/errors.php:448) Original trace follows, referer: http://mahara-testing/admin/site/options.php
  [WAR] 15 (lib/elastica/lib/Elastica/Client.php:431) No enabled connection, referer: http://mahara-testing/admin/site/options.php
  Call stack (most recent first):, referer: http://mahara-testing/admin/site/options.php
    * Elastica\\Client->getConnection() at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/elastica/lib/Elastica/Client.php:530, referer: http://mahara-testing/admin/site/options.php
    * Elastica\\Client->request("mahara/", "DELETE", array(size 0), array(size 0)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/elastica/lib/Elastica/Client.php:551, referer: http://mahara-testing/admin/site/options.php
    * Elastica\\Client->request("mahara/", "DELETE", array(size 0), array(size 0)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/elastica/lib/Elastica/Index.php:405, referer: http://mahara-testing/admin/site/options.php
    * Elastica\\Index->request("", "DELETE") at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/elastica/lib/Elastica/Index.php:133, referer: http://mahara-testing/admin/site/options.php
    * Elastica\\Index->delete() at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/elastica/lib/Elastica/Index.php:184, referer: http://mahara-testing/admin/site/options.php
    * Elastica\\Index->create(array(size 3), true) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/search/elasticsearch/lib.php:1363, referer: http://mahara-testing/admin/site/options.php
    * ElasticsearchIndexing::create_index() at /home/robertl/htdocs/mahara-testing/mahara/htdocs/search/elasticsearch/lib.php:403, referer: http://mahara-testing/admin/site/options.php
    * PluginSearchElasticsearch::reset_all_searchtypes() at /home/robertl/htdocs/mahara-testing/mahara/htdocs/search/elasticsearch/lib.php:371, referer: http://mahara-testing/admin/site/options.php
    * PluginSearchElasticsearch::initialize_sitewide() at Unknown:0, referer: http://mahara-testing/admin/site/options.php
    * call_user_func_array(array(size 2), array(size 0)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/mahara.php:1453, referer: http://mahara-testing/admin/site/options.php
    * call_static_method("PluginSearchElasticsearch", "initialize_sitewide") at /home/robertl/htdocs/mahara-testing/mahara/htdocs/admin/site/options.php:763, referer: http://mahara-testing/admin/site/options.php
    * siteoptions_submit(object(Pieform), array(size 65)) at Unknown:0, referer: http://mahara-testing/admin/site/options.php
    * call_user_func_array("siteoptions_submit", array(size 2)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/pieforms/pieform.php:528, referer: http://mahara-testing/admin/site/options.php
    * Pieform->__construct(array(size 7)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/pieforms/pieform.php:170, referer: http://mahara-testing/admin/site/options.php
    * Pieform::process(array(size 7)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/lib/pieforms/pieform.php:71, referer: http://mahara-testing/admin/site/options.php
    * pieform(array(size 7)) at /home/robertl/htdocs/mahara-testing/mahara/htdocs/admin/site/options.php:673, referer: http://mahara-testing/admin/site/options.php

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1256118/+subscriptions


References