oda-hub / mmoda-frontend-module

GNU General Public License v2.0
0 stars 1 forks source link

Frontend got broken while reinitialising #263

Closed dsavchenko closed 5 months ago

dsavchenko commented 5 months ago

During update of the frontend (container were not rebuilt for 8d) there was a problem when reinstalling mmoda modules.

root@frontend-5d8c488cb5-bqfwx:/var/www/mmoda# ~/.composer/vendor/bin/drush pm-enable mmoda
unserialize(): Error at offset 0 of 36 bytes bootstrap.inc:1255                                                                                                                                                                    [warning]
The following extensions will be enabled: mmoda
Do you really want to continue? (y/n): y
Undefined index: field_name field.crud.inc:240                                                                                                                                                                                     [warning]
FieldException: Attempt to update a non-existent field. in /var/www/mmoda/modules/field/field.crud.inc:242                                                                                                                         [error]
Stack trace:
#0 /var/www/mmoda/sites/all/modules/mmoda/mmoda.lib.inc(62): field_update_field(Array)
#1 /var/www/mmoda/sites/all/modules/mmoda/mmoda.install(187): _mmoda_common_install('mmoda', '', Array)
#2 /var/www/mmoda/includes/module.inc(935): mmoda_install()
#3 /var/www/mmoda/includes/module.inc(499): module_invoke('mmoda', 'install')
#4 /root/.composer/vendor/drush/drush/commands/core/drupal/environment_7.inc(143): module_enable(Array)
#5 /root/.composer/vendor/drush/drush/commands/pm/pm.drush.inc(1122): drush_module_enable(Array)
#6 /root/.composer/vendor/drush/drush/includes/command.inc(361): drush_pm_enable('mmoda')
#7 /root/.composer/vendor/drush/drush/includes/command.inc(212): _drush_invoke_hooks(Array, Array)
#8 /root/.composer/vendor/drush/drush/includes/command.inc(180): drush_command('mmoda')
#9 /root/.composer/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(64): drush_dispatch(Array)
#10 /root/.composer/vendor/drush/drush/drush.php(70): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#11 /root/.composer/vendor/drush/drush/drush.php(11): drush_main()
#12 {main}

Then the module is reported enabled, but there are visible problems here and there and no instruments are shown

dsavchenko commented 5 months ago

@burnout87 saw it locally. Following his advice I commented the line field_update_field($field_mmoda_module); in mmoda.lib.inc in-place, then installation works. But the frontend is not functional anyway Now I see this messages, and still no instrument (lightcurve_analysis was enabled)

    Notice: unserialize(): Error at offset 0 of 36 bytes in variable_initialize() (line 1255 of /var/www/mmoda/includes/bootstrap.inc).
    Notice: Undefined index: common in mmoda_name_resolve() (line 171 of /var/www/mmoda/sites/all/modules/mmoda/mmoda.common.inc).
    Notice: Undefined index: common in mmoda_common() (line 256 of /var/www/mmoda/sites/all/modules/mmoda/mmoda.common.inc).
    Notice: Undefined index: mmoda_debug in mmoda_main_block_content() (line 374 of /var/www/mmoda/sites/all/modules/mmoda/mmoda.module).
    Notice: Undefined index: frontend_version in mmoda_main_block_content() (line 375 of /var/www/mmoda/sites/all/modules/mmoda/mmoda.module).
    Notice: Undefined index: help_page_nids in mmoda_main_block_content() (line 389 of /var/www/mmoda/sites/all/modules/mmoda/mmoda.module).
motame commented 5 months ago

I've made tests with my instance as shown to Gabrielle and all seem OK. Uninstalling/installing mmoda or any submodule (instrument) is done smoothly. I'll install a new instance and let you know ...

dsavchenko commented 5 months ago

I've made tests with my instance as shown to Gabrielle and all seem OK. Uninstalling/installing mmoda or any submodule (instrument) is done smoothly. I'll install a new instance and let you know ...

Please say if I can help in debugging the problem on my instance

burnout87 commented 5 months ago

after having pull all the latest changes from the drupal instance repo, I now get the following error:

gabriele@gabriele-ubuntu:/mmoda-frontend-drupal$ drush pm-disable -y mmoda && drush pmu -y mmoda && drush en -y mmoda
unserialize(): Error at offset 0 of 4 bytes bootstrap.inc:1255                                                                                                                                   [warning]
mmoda is already disabled.                                                                                                                                                                       [ok]
There were no extensions that could be disabled.                                                                                                                                                 [ok]
unserialize(): Error at offset 0 of 4 bytes bootstrap.inc:1255                                                                                                                                   [warning]
The following modules will be uninstalled: mmoda
Do you really want to continue? (y/n): y
Undefined array key "help_page_nids" mmoda.lib.inc:366                                                                                                                                           [warning]
Trying to access array offset on value of type null field.crud.inc:798                                                                                                                           [warning]
Trying to access array offset on value of type null field.crud.inc:798                                                                                                                           [warning]
Trying to access array offset on value of type bool image.module:481                                                                                                                             [warning]
Trying to access array offset on value of type null field.crud.inc:804                                                                                                                           [warning]
WD php: TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in field_delete_instance() (line 804 of                                                             [error]
/.../mmoda-frontend-drupal/modules/field/field.crud.inc).
TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in field_delete_instance() (line 804 of /.../mmoda-frontend-drupal/modules/field/field.crud.inc).
Drush command terminated abnormally due to an unrecoverable error.  
dsavchenko commented 5 months ago

I saw some warnings (but not critical errors) about that some arguments must be of type Countable while reinstalling, but the main issue is still the same as before. (in the container built tonight)

burnout87 commented 5 months ago

it looks like we found the reason: one line of code within the mmoda_install hook was commented. this was the reason of all those issues .

So, on y local instance, I took a fresh new copy of the DB from github, re-enabled that line of code, and could disable/uninstall/reinstall the mmoda module.

This is the line of code: https://github.com/oda-hub/mmoda-frontend-module/blob/db9a0c994a91f48091851281e30944e7d2473d7f/mmoda.install#L177-L178

I am going to push the fix (simply un-commenting the line), then the installation should complete correctly.

dsavchenko commented 5 months ago

I confirm this fixes the issue. Thank you!