Congrats and thank you @SychO, widgets together with the Core are great addition to Flarum. Mods and admins, please add sub-tag for widgets.

Also @luceos it would be great to have Widgets filter on Extiverse.

Ralkage you can always test mobile/responsive mode by finding the option in your browser

Thanks! I didn’t want to install it until I knew for sure you can put widgets on the bottom. I appreciate the extra screenshots very much. I’m sometimes shocked by the amazing extensions this community creates. Wow! 🤩

  • [deleted]

  • Edited

@SychO I'm getting the below message in the console whenever I try to place or save a widget

mount-redraw.js:15 TypeError: Cannot read properties of undefined (reading 'icon')
    at e.n.widget (WidgetEditor.tsx:201)
    at e.n.layoutWidget (WidgetEditor.tsx:220)
    at WidgetEditor.tsx:65
    at Array.map (<anonymous>)
    at e.n.editor (WidgetEditor.tsx:65)
    at e.n.content (WidgetEditor.tsx:35)
    at e.n.sections (ExtensionPage.js:96)
    at e.n.view (ExtensionPage.js:52)
    at Function.s (render.js:30)
    at render.js:482

Any thoughts ?

Thanks

EDIT - seems it caused by the news widget. I'll post there also.

    [deleted] EDIT - seems it caused by the news widget.

    How so ? does it not appear when moving other widgets ? where are you moving the widget from and to when the error occurs ?

    I've logged the issue afrux/forum-widgets-core5 but the above details will help a lot!

      • [deleted]

      SychO It appears, but the second you move it into one of the widget zones, you get that error in the console and are unable to save.

        Hi, I enabled these widgets on my forum and they produced a denial of service of the MySQL instance, with 100% CPU usage until I managed to disable the extensions. The forum was inaccessible during that time.

        Is there a chance that some kind of caching mechanism could be implemented? Thanks!

          matteocontrini I don't see how that's possible, these widgets are very light weight, the news one doesn't need any caching, as for the forum stats and top posters, they both cache the data for 10 minutes before refreshing, if there is an issue it would be the online users one, which doesn't cache data because then it wouldn't be accurate.

          How many online users would you say there were at the time?

            SychO ah, I see. I had "online users" enabled indeed. I usually have between 50 and 100 online users, or at least that's what Google Analytics tells me.

              SychO ah, it might also be useful to know that Flarum failed to boot because of "too many connections" to MySQL, according to the logs. Not sure how this is related honestly 🤔 but after disabling the widgets the problem disappeared.

              Good job anyway, thank you! 🙂

              SychO I'm afraid the problem is not in the "online users" extension. I enabled the "forum stats" extension again and while I was trying to enable "top posters" the forum was already down with MySQL going crazy...

                SychO only the too many connections error:

                [2021-08-16 21:11:08] flarum.ERROR: PDOException: SQLSTATE[HY000] [1040] Too many connections in /usr/local/openresty/nginx/www/fibraclick-forum/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:39
                ...omitted...

                SychO

                [2021-08-16 21:11:18] flarum.ERROR: PDOException: SQLSTATE[08004] [1040] Too many connections in /usr/local/openresty/nginx/www/fibraclick-forum/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:39
                Stack trace:
                #0 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(39): PDO->__construct('mysql:host=10.0...', 'flarum', '...', Array)
                #1 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/database/Connectors/Connector.php(67): Doctrine\DBAL\Driver\PDOConnection->__construct('mysql:host=10.0...', 'flarum', '...', Array)
                #2 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/database/Connectors/Connector.php(46): Illuminate\Database\Connectors\Connector->createPdoConnection('mysql:host=10.0...', 'flarum', '...', Array)
                #3 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/database/Connectors/MySqlConnector.php(24): Illuminate\Database\Connectors\Connector->createConnection('mysql:host=10.0...', Array, Array)
                #4 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/database/Connectors/ConnectionFactory.php(184): Illuminate\Database\Connectors\MySqlConnector->connect(Array)
                #5 [internal function]: Illuminate\Database\Connectors\ConnectionFactory->Illuminate\Database\Connectors\{closure}()
                #6 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/database/Connection.php(997): call_user_func(Object(Closure))
                #7 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/database/Connection.php(979): Illuminate\Database\Connection->getPdo()
                #8 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/database/Connection.php(959): Illuminate\Database\Connection->getDoctrineConnection()
                #9 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/flarum/core/src/Database/Migrator.php(72): Illuminate\Database\Connection->getDoctrineSchemaManager()
                #10 [internal function]: Flarum\Database\Migrator->__construct(Object(Flarum\Database\DatabaseMigrationRepository), Object(Illuminate\Database\MySqlConnection), Object(Illuminate\Filesystem\Filesystem))
                #11 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/container/Container.php(917): ReflectionClass->newInstanceArgs(Array)
                #12 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/container/Container.php(754): Illuminate\Container\Container->build('Flarum\\Database...')
                #13 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/container/Container.php(692): Illuminate\Container\Container->resolve('Flarum\\Database...', Array)
                #14 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/container/Container.php(1027): Illuminate\Container\Container->make('Flarum\\Database...')
                #15 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/container/Container.php(947): Illuminate\Container\Container->resolveClass(Object(ReflectionParameter))
                #16 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/container/Container.php(908): Illuminate\Container\Container->resolveDependencies(Array)
                #17 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/container/Container.php(290): Illuminate\Container\Container->build('Flarum\\Extensio...')
                #18 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/container/Container.php(869): Illuminate\Container\Container->Illuminate\Container\{closure}(Object(Illuminate\Container\Container), Array)
                #19 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/container/Container.php(754): Illuminate\Container\Container->build(Object(Closure))
                #20 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/container/Container.php(692): Illuminate\Container\Container->resolve('Flarum\\Extensio...', Array)
                #21 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/flarum/core/src/Extension/ExtensionServiceProvider.php(31): Illuminate\Container\Container->make('flarum.extensio...')
                #22 [internal function]: Flarum\Extension\ExtensionServiceProvider->Flarum\Extension\{closure}(Object(Flarum\Foundation\Application))
                #23 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/flarum/core/src/Foundation/Application.php(329): call_user_func(Object(Closure), Object(Flarum\Foundation\Application))
                #24 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/flarum/core/src/Foundation/Application.php(270): Flarum\Foundation\Application->fireAppCallbacks(Array)
                #25 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/flarum/core/src/Foundation/InstalledSite.php(151): Flarum\Foundation\Application->boot()
                #26 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/flarum/core/src/Foundation/InstalledSite.php(82): Flarum\Foundation\InstalledSite->bootLaravel()
                #27 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/flarum/core/src/Http/Server.php(58): Flarum\Foundation\InstalledSite->bootApp()
                #28 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/flarum/core/src/Http/Server.php(35): Flarum\Http\Server->safelyBootAndGetHandler()
                #29 /usr/local/openresty/nginx/www/fibraclick-forum/public/index.php(22): Flarum\Http\Server->listen()
                #30 {main}
                
                Next Doctrine\DBAL\Driver\PDO\Exception: SQLSTATE[08004] [1040] Too many connections in /usr/local/openresty/nginx/www/fibraclick-forum/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDO/Exception.php:18
                Stack trace:
                #0 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(43): Doctrine\DBAL\Driver\PDO\Exception::new(Object(PDOException))
                #1 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/database/Connectors/Connector.php(67): Doctrine\DBAL\Driver\PDOConnection->__construct('mysql:host=10.0...', 'flarum', '...', Array)
                #2 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/database/Connectors/Connector.php(46): Illuminate\Database\Connectors\Connector->createPdoConnection('mysql:host=10.0...', 'flarum', '...', Array)
                #3 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/database/Connectors/MySqlConnector.php(24): Illuminate\Database\Connectors\Connector->createConnection('mysql:host=10.0...', Array, Array)
                #4 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/database/Connectors/ConnectionFactory.php(184): Illuminate\Database\Connectors\MySqlConnector->connect(Array)
                #5 [internal function]: Illuminate\Database\Connectors\ConnectionFactory->Illuminate\Database\Connectors\{closure}()
                #6 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/database/Connection.php(997): call_user_func(Object(Closure))
                #7 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/database/Connection.php(979): Illuminate\Database\Connection->getPdo()
                #8 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/database/Connection.php(959): Illuminate\Database\Connection->getDoctrineConnection()
                #9 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/flarum/core/src/Database/Migrator.php(72): Illuminate\Database\Connection->getDoctrineSchemaManager()
                #10 [internal function]: Flarum\Database\Migrator->__construct(Object(Flarum\Database\DatabaseMigrationRepository), Object(Illuminate\Database\MySqlConnection), Object(Illuminate\Filesystem\Filesystem))
                #11 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/container/Container.php(917): ReflectionClass->newInstanceArgs(Array)
                #12 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/container/Container.php(754): Illuminate\Container\Container->build('Flarum\\Database...')
                #13 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/container/Container.php(692): Illuminate\Container\Container->resolve('Flarum\\Database...', Array)
                #14 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/container/Container.php(1027): Illuminate\Container\Container->make('Flarum\\Database...')
                #15 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/container/Container.php(947): Illuminate\Container\Container->resolveClass(Object(ReflectionParameter))
                #16 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/container/Container.php(908): Illuminate\Container\Container->resolveDependencies(Array)
                #17 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/container/Container.php(290): Illuminate\Container\Container->build('Flarum\\Extensio...')
                #18 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/container/Container.php(869): Illuminate\Container\Container->Illuminate\Container\{closure}(Object(Illuminate\Container\Container), Array)
                #19 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/container/Container.php(754): Illuminate\Container\Container->build(Object(Closure))
                #20 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/illuminate/container/Container.php(692): Illuminate\Container\Container->resolve('Flarum\\Extensio...', Array)
                #21 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/flarum/core/src/Extension/ExtensionServiceProvider.php(31): Illuminate\Container\Container->make('flarum.extensio...')
                #22 [internal function]: Flarum\Extension\ExtensionServiceProvider->Flarum\Extension\{closure}(Object(Flarum\Foundation\Application))
                #23 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/flarum/core/src/Foundation/Application.php(329): call_user_func(Object(Closure), Object(Flarum\Foundation\Application))
                #24 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/flarum/core/src/Foundation/Application.php(270): Flarum\Foundation\Application->fireAppCallbacks(Array)
                #25 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/flarum/core/src/Foundation/InstalledSite.php(151): Flarum\Foundation\Application->boot()
                #26 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/flarum/core/src/Foundation/InstalledSite.php(82): Flarum\Foundation\InstalledSite->bootLaravel()
                #27 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/flarum/core/src/Http/Server.php(58): Flarum\Foundation\InstalledSite->bootApp()
                #28 /usr/local/openresty/nginx/www/fibraclick-forum/vendor/flarum/core/src/Http/Server.php(35): Flarum\Http\Server->safelyBootAndGetHandler()
                #29 /usr/local/openresty/nginx/www/fibraclick-forum/public/index.php(22): Flarum\Http\Server->listen()
                #30 {main}

                  matteocontrini that doesn't seem to be caused by the extension itself (wouldn't make sense if it was) but there seems to be something very odd happening there, could be a core issue as well, but need to confirm, what's the output of php flarum info ?

                    SychO that doesn't seem to be caused by the extension itself

                    Uhm, unless I'm missing something it could just be caused by the MySQL overload deriving from other requests that are being processed. Some requests will timeout, some requests will fail at boot time because of too many db connections.

                    SychO what's the output of php flarum info ?

                    ...