humhub / calendar

Create one-time or recurring events, invite and manage attendees, and keep track of all your events with the Calendar module.
28 stars 46 forks source link

Calendar module constraint missing #192

Closed kenthejr closed 4 years ago

kenthejr commented 4 years ago

What steps will reproduce the problem?

  1. Create a calendar event
  2. Accept the calendar event
  3. Set up a reminder for the calendar event

What is the expected result?

A calendar event with a reminder.

What do you get instead?

The entire platform is locked up with a server error and the following DB validation error:

Validating: Calendar Module (1 reminder entries)
PHP Notice 'yii\base\ErrorException' with message 'Undefined index: constraint_name' in /var/www/html/protected/vendor/yiisoft/yii2/db/mysql/Schema.php:394

Additional info

I've been running Humhub for almost a year now. I've updated/upgraded core + modules whenever prompted. This is the first time I've tried creating an event on the calendar. I'm guessing it is a failed constraint check because it triggers while testing the DB integrity on the Calendar Module (reminder entry).

Q A
HumHub version 1.5.3
PHP version 7.3.14-1~deb10u1
Operating system Debian 10

Full stack trace


#1 /var/www/html/protected/vendor/yiisoft/yii2/db/mysql/Schema.php(126): yii\db\mysql\Schema->findConstraints(Object(yii\db\TableSchema))
#2 /var/www/html/protected/vendor/yiisoft/yii2/db/Schema.php(754): yii\db\mysql\Schema->loadTableSchema('calendar_remind...')
#3 /var/www/html/protected/vendor/yiisoft/yii2/db/Schema.php(193): yii\db\Schema->getTableMetadata('calendar_remind...', 'schema', false)
#4 /var/www/html/protected/vendor/yiisoft/yii2/db/ActiveRecord.php(435): yii\db\Schema->getTableSchema('calendar_remind...')
#5 /var/www/html/protected/vendor/yiisoft/yii2/db/ActiveRecord.php(469): yii\db\ActiveRecord::getTableSchema()
#6 /var/www/html/protected/vendor/yiisoft/yii2/db/BaseActiveRecord.php(500): yii\db\ActiveRecord->attributes()
#7 /var/www/html/protected/vendor/yiisoft/yii2/db/BaseActiveRecord.php(291): yii\db\BaseActiveRecord->hasAttribute('active')
#8 /var/www/html/protected/modules/calendar/models/reminder/CalendarReminder.php(136): yii\db\BaseActiveRecord->__get('active')
#9 /var/www/html/protected/vendor/yiisoft/yii2/base/BaseObject.php(109): humhub\modules\calendar\models\reminder\CalendarReminder->init()
#10 /var/www/html/protected/vendor/yiisoft/yii2/db/BaseActiveRecord.php(1215): yii\base\BaseObject->__construct()
#11 /var/www/html/protected/vendor/yiisoft/yii2/db/ActiveQueryTrait.php(121): yii\db\BaseActiveRecord::instantiate(Array)
#12 /var/www/html/protected/vendor/yiisoft/yii2/db/ActiveQuery.php(219): yii\db\ActiveQuery->createModels(Array)
#13 /var/www/html/protected/vendor/yiisoft/yii2/db/Query.php(249): yii\db\ActiveQuery->populate(Array)
#14 /var/www/html/protected/vendor/yiisoft/yii2/db/ActiveQuery.php(133): yii\db\Query->all(NULL)
#15 /var/www/html/protected/modules/calendar/Events.php(295): yii\db\ActiveQuery->all()
#16 [internal function]: humhub\modules\calendar\Events::onIntegrityCheck(Object(yii\base\Event))
#17 /var/www/html/protected/vendor/yiisoft/yii2/base/Event.php(312): call_user_func(Array, Object(yii\base\Event))
#18 /var/www/html/protected/vendor/yiisoft/yii2/base/Component.php(636): yii\base\Event::trigger('humhub\\commands...', 'run', Object(yii\base\Event))
#19 /var/www/html/protected/humhub/commands/IntegrityController.php(39): yii\base\Component->trigger('run')
#20 [internal function]: humhub\commands\IntegrityController->actionRun()
#21 /var/www/html/protected/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#22 /var/www/html/protected/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array)
#23 /var/www/html/protected/vendor/yiisoft/yii2/console/Controller.php(164): yii\base\Controller->runAction('run', Array)
#24 /var/www/html/protected/vendor/yiisoft/yii2/base/Module.php(528): yii\console\Controller->runAction('run', Array)
#25 /var/www/html/protected/vendor/yiisoft/yii2/console/Application.php(180): yii\base\Module->runAction('integrity/run', Array)
#26 /var/www/html/protected/vendor/yiisoft/yii2/console/Application.php(147): yii\console\Application->runAction('integrity/run', Array)
#27 /var/www/html/protected/vendor/yiisoft/yii2/base/Application.php(386): yii\console\Application->handleRequest(Object(yii\console\Request))
#28 /var/www/html/protected/yii(29): yii\base\Application->run()
#29 {main}```
kenthejr commented 4 years ago

I was actually going to close this one, but I decided to update with the detail of the other.

UtmostCreator commented 4 years ago

Hello, @kenthejr!

Could you please let me know which values I should specify to get the error? Here is how I set up it: image

Best regards, Roman

kenthejr commented 4 years ago

I can't get to that screen anymore, but I did set a specific time of day. I believe the Reminder was set to custom and something like "1 day" or something like that. I did set up to recur every month on the same Sunday of each month. I'm not sure if that made a difference.

One thing I did update after setting the calendar item and reminder is I updated the server time from Pacific to UTC (because everything showing 7 hours behind in the UI).

Other than some messages and posts, those are the only things I touched before the server error showed up.

UtmostCreator commented 4 years ago

Good day!

Thank you so much for your detailed description, I will take it into consideration.

Best regards, Roman

On Tue, Jul 21, 2020, 12:51 AM Ken Anderson notifications@github.com wrote:

I can't get to that screen anymore, but I did set a specific time of day. I believe the Reminder was set to custom and something like "1 day" or something like that. I did set up to recur every month on the same Sunday of each month. I'm not sure if that made a difference.

One thing I did update after setting the calendar item and reminder is I updated the server time from Pacific to UTC (because everything showing 7 hours behind in the UI).

Other than some messages and posts, those are the only things I touched before the server error showed up.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/humhub/humhub-modules-calendar/issues/192#issuecomment-661352322, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFKP7HCNEETU5QC5CNCE4LTR4S36XANCNFSM4PCPZHVQ .

kenthejr commented 4 years ago

This may be relevant https://github.com/yiisoft/yii2/issues/18171

kenthejr commented 4 years ago

New information...it may very well have to do with me upgrading to MySQL 8.0.21. It was a problem two days ago when I upgraded but didn't manifest until I tried to add a Calendar Reminder.

kenthejr commented 4 years ago

Okay...in the protected/config/dynamic.php file I edited the db section to:

'db' =>
    array (
      'class' => 'yii\\db\\Connection',
      'dsn' => 'mysql:host=localhost;dbname=humhub',
      'username' => 'username',
      'password' => '******',
      'attributes' => [PDO::ATTR_CASE => PDO::CASE_LOWER],
    ),

This seemed to fix part of the problem. I can now run php yii integrity/run and all integrity tests pass.

New problem though. Now I'm getting a jobCount undefined index error:

yii\base\ErrorException: Undefined index: jobCount in /var/www/html/protected/humhub/modules/admin/widgets/IncompleteSetupWarning.php:100 Stack trace: #0 /var/www/html/protected/humhub/modules/admin/widgets/IncompleteSetupWarning.php(100): yii\base\ErrorHandler->handleError(8, 'Undefined index...', '/var/www/html/p...', 100, Array) #1 /var/www/html/protected/humhub/modules/admin/widgets/IncompleteSetupWarning.php(68): humhub\modules\admin\widgets\IncompleteSetupWarning->checkQueue() #2 /var/www/html/protected/humhub/modules/admin/widgets/IncompleteSetupWarning.php(47): humhub\modules\admin\widgets\IncompleteSetupWarning->getProblems() #3 /var/www/html/protected/humhub/components/Widget.php(63): humhub\modules\admin\widgets\IncompleteSetupWarning->run() #4 /var/www/html/protected/humhub/widgets/BaseStack.php(85): humhub\components\Widget::widget(Array) #5 /var/www/html/protected/humhub/components/Widget.php(63): humhub\widgets\BaseStack->run() #6 /var/www/html/protected/humhub/modules/dashboard/views/dashboard/index.php(28): humhub\components\Widget::widget(Array) #7 /var/www/html/protected/vendor/yiisoft/yii2/base/View.php(348): require('/var/www/html/p...') #8 /var/www/html/protected/vendor/yiisoft/yii2/base/View.php(257): yii\base\View->renderPhpFile('/var/www/html/p...', Array) #9 /var/www/html/protected/vendor/yiisoft/yii2/base/View.php(156): yii\base\View->renderFile('/var/www/html/p...', Array, Object(humhub\modules\dashboard\controllers\DashboardController)) #10 /var/www/html/protected/vendor/yiisoft/yii2/base/Controller.php(386): yii\base\View->render('index', Array, Object(humhub\modules\dashboard\controllers\DashboardController)) #11 /var/www/html/protected/humhub/modules/dashboard/controllers/DashboardController.php(69): yii\base\Controller->render('index', Array) #12 [internal function]: humhub\modules\dashboard\controllers\DashboardController->actionIndex() #13 /var/www/html/protected/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array) #14 /var/www/html/protected/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array) #15 /var/www/html/protected/vendor/yiisoft/yii2/base/Module.php(528): yii\base\Controller->runAction('', Array) #16 /var/www/html/protected/vendor/yiisoft/yii2/web/Application.php(103): yii\base\Module->runAction('dashboard/dashb...', Array) #17 /var/www/html/protected/vendor/yiisoft/yii2/base/Application.php(386): yii\web\Application->handleRequest(Object(humhub\components\Request)) #18 /var/www/html/index.php(25): yii\base\Application->run() #19 {main}
kenthejr commented 4 years ago

Okay...this could be me...I deleted the entry in calendar_reminder that I thought was the original problem. I'm guessing that when it generates my dashboard view it now breaks again because it can't find the activity of me setting a reminder. Is there a way to reset everyone's dashboard without erasing everything that is there?

kenthejr commented 4 years ago

Okay...I'm 90% sure this is my activity stream. I deleted the calendar reminder in the calendar_reminder table which broke the index for my activity stream on my dashboard. Is there a way to correct that?

It seems that there is still a requirement to set PDO::CASE_LOWER to make Humhub work w/ the latest MySQL version, but it's clear that I broke my own activity stream (and no one else's).

buddh4 commented 4 years ago

Is there only the integrity check error or are there errors when accessing your network? If yes, which errors are logged when trying to access the network. If you can't access the admin interface anymore you can also check the log file

kenthejr commented 4 years ago

After changing the lower case setting, integrity passes. Admin interface logs now show:

yii\base\ErrorException: Undefined index: jobCount in /var/www/html/protected/humhub/modules/admin/widgets/IncompleteSetupWarning.php:100 Stack trace: #0 /var/www/html/protected/humhub/modules/admin/widgets/IncompleteSetupWarning.php(100): yii\base\ErrorHandler->handleError(8, 'Undefined index...', '/var/www/html/p...', 100, Array) #1 /var/www/html/protected/humhub/modules/admin/widgets/IncompleteSetupWarning.php(68): humhub\modules\admin\widgets\IncompleteSetupWarning->checkQueue() #2 /var/www/html/protected/humhub/modules/admin/widgets/IncompleteSetupWarning.php(47): humhub\modules\admin\widgets\IncompleteSetupWarning->getProblems() #3 /var/www/html/protected/humhub/components/Widget.php(63): humhub\modules\admin\widgets\IncompleteSetupWarning->run() #4 /var/www/html/protected/humhub/widgets/BaseStack.php(85): humhub\components\Widget::widget(Array) #5 /var/www/html/protected/humhub/components/Widget.php(63): humhub\widgets\BaseStack->run() #6 /var/www/html/protected/humhub/modules/dashboard/views/dashboard/index.php(28): humhub\components\Widget::widget(Array) #7 /var/www/html/protected/vendor/yiisoft/yii2/base/View.php(348): require('/var/www/html/p...') #8 /var/www/html/protected/vendor/yiisoft/yii2/base/View.php(257): yii\base\View->renderPhpFile('/var/www/html/p...', Array) #9 /var/www/html/protected/vendor/yiisoft/yii2/base/View.php(156): yii\base\View->renderFile('/var/www/html/p...', Array, Object(humhub\modules\dashboard\controllers\DashboardController)) #10 /var/www/html/protected/vendor/yiisoft/yii2/base/Controller.php(386): yii\base\View->render('index', Array, Object(humhub\modules\dashboard\controllers\DashboardController)) #11 /var/www/html/protected/humhub/modules/dashboard/controllers/DashboardController.php(69): yii\base\Controller->render('index', Array) #12 [internal function]: humhub\modules\dashboard\controllers\DashboardController->actionIndex() #13 /var/www/html/protected/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array) #14 /var/www/html/protected/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array) #15 /var/www/html/protected/vendor/yiisoft/yii2/base/Module.php(528): yii\base\Controller->runAction('', Array) #16 /var/www/html/protected/vendor/yiisoft/yii2/web/Application.php(103): yii\base\Module->runAction('dashboard/dashb...', Array) #17 /var/www/html/protected/vendor/yiisoft/yii2/base/Application.php(386): yii\web\Application->handleRequest(Object(humhub\components\Request)) #18 /var/www/html/index.php(25): yii\base\Application->run() #19 {main}
kenthejr commented 4 years ago

Is there a way to rebuild / fix that index so I can see my dashboard again?

UtmostCreator commented 4 years ago

Is there a way to rebuild/fix that index so I can see my dashboard again?

Good day, @kenthejr!

Did you try to clear the cache? It can be done in the console from your protected folder. just type or copy this command: php yii cache/flush-all

Let me know if this helps. If this does not help, please let us know this and we will proceed with further investigation. You have also mentioned, you have got the same error, but which one of them, please quote it or add it, here again, thank you!

We do appreciate your business!

kenthejr commented 4 years ago

php yii cache/flush-all

That did not work. Same error.

luke- commented 4 years ago

Can you please run, following two commands and post the result: https://github.com/humhub/documentation/blob/master/docs/admin/troubleshooting.md#data-integrity

kenthejr commented 4 years ago

I just ran that but still no luck.

Screen Shot 2020-07-24 at 9 40 46 AM

luke- commented 4 years ago

Can you please post the result of the commands? Are all migrations up to date?

kenthejr commented 4 years ago

Screen Shot 2020-07-24 at 9 54 53 AM

buddh4 commented 4 years ago

Core issue related to Mysql 8.0.21 https://github.com/humhub/humhub/issues/4287