cloud-py-api / mediadc

Nextcloud Media Duplicate Collector application
https://apps.nextcloud.com/apps/mediadc
GNU Affero General Public License v3.0
93 stars 6 forks source link

MediaDC somehow messed up my Nextcloud instance #151

Closed 2br-2b closed 1 year ago

2br-2b commented 1 year ago

Describe the bug When MediaDC was enabled, my Snap Nextcloud instance wouldn't start. When I disabled it via OCC, everything now works.

To Reproduce Steps to reproduce the behavior:

  1. Do the below listed updates
  2. The server will enter maintenance mode and have high CPU usage
  3. Reboot the server
  4. There will be no HTTPS response

Expected behavior The server not die

Desktop:

Additional context

I'm sorry to open yet another bug report for MediaDC on Snap, but I've got another (somewhat major) issue to report. After I did some apt updates on my Nextcloud server, the server entered maintenance mode for an hour or so with nearly maximum CPU usage. I rebooted to see if that fixed the issue, and Nextcloud would not run (as in, the server wouldn't respond when I accessed it via HTTPS). When I disabled MediaDC from OCC and rebooted the system, everything worked fine.

I've left the environment otherwise untouched if we want to troubleshoot the issue; I haven't tried updating MediaDC again in case we wanted to test anything.

I know that this is not the most recent MediaDC version, but I wanted to see if we wanted to do any troubleshooting.

One thing I've certainly found: Nextcloud Snap seems to be having lots of compatibility issues. I may have to switch over to the normal version sometime in the future.

Thank you for all the work you're putting into MediaDC, and thank you for making it free!

Here's the troubleshooting I did from the command line (assisted by ChatGPT) ``` root@foo-server-name:~# snap refresh All snaps up to date. root@foo-server-name:~# sudo nextcloud.occ -v Nextcloud or one of the apps require upgrade - only a limited number of commands are available You may use your browser or the occ upgrade command to do the upgrade Nextcloud 25.0.4 Usage: command [options] [arguments] Options: -h, --help Display this help message -q, --quiet Do not output any message -V, --version Display this application version --ansi Force ANSI output --no-ansi Disable ANSI output -n, --no-interaction Do not ask any interactive question --no-warnings Skip global warnings, show command output only -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug Available commands: check check dependencies of the server environment help Display help for a command list List commands status show some status information upgrade run upgrade routines after installation of a new release. The release has to be installed before. app app:disable disable an app app:enable enable an app app:getpath Get an absolute path to the app directory app:install install an app app:list List all available apps app:remove remove an app app:update update an app or all apps background background:ajax Use ajax to run background jobs background:cron Use cron to run background jobs background:webcron Use webcron to run background jobs background-job background-job:execute Execute a single background job manually background-job:list List background jobs broadcast broadcast:test test the SSE broadcaster config config:app:delete Delete an app config value config:app:get Get an app config value config:app:set Set an app config value config:import Import a list of configs config:list List all configs config:system:delete Delete a system config value config:system:get Get a system config value config:system:set Set a system config value db db:add-missing-columns Add missing optional columns to the database tables db:add-missing-indices Add missing indices to the database tables db:add-missing-primary-keys Add missing primary keys to the database tables db:convert-filecache-bigint Convert the ID columns of the filecache to BigInt db:convert-mysql-charset Convert charset of MySQL/MariaDB to use utf8mb4 db:convert-type Convert the Nextcloud database to the newly configured one encryption encryption:change-key-storage-root Change key storage root encryption:decrypt-all Disable server-side encryption and decrypt all files encryption:disable Disable encryption encryption:enable Enable encryption encryption:encrypt-all Encrypt all files for all users encryption:list-modules List all available encryption modules encryption:migrate-key-storage-format Migrate the format of the keystorage to a newer format encryption:set-default-module Set the encryption default module encryption:show-key-storage-root Show current key storage root encryption:status Lists the current status of encryption group group:add Add a group group:adduser add a user to a group group:delete Remove a group group:info Show information about a group group:list list configured groups group:removeuser remove a user from a group integrity integrity:check-app Check integrity of an app using a signature. integrity:check-core Check integrity of core code using a signature. integrity:sign-app Signs an app using a private key. integrity:sign-core Sign core using a private key. l10n l10n:createjs Create javascript translation files for a given app log log:file manipulate logging backend log:manage manage logging configuration maintenance maintenance:data-fingerprint update the systems data-fingerprint after a backup is restored maintenance:mimetype:update-db Update database mimetypes and update filecache maintenance:mimetype:update-js Update mimetypelist.js maintenance:mode set maintenance mode maintenance:repair repair this installation maintenance:repair-share-owner repair invalid share-owner entries in the database maintenance:theme:update Apply custom theme changes maintenance:update:htaccess Updates the .htaccess file preview preview:repair distributes the existing previews into subfolders preview:reset-rendered-texts Deletes all generated avatars and previews of text and md files security security:bruteforce:reset resets bruteforce attemps for given IP address security:certificates list trusted certificates security:certificates:import import trusted certificate in PEM format security:certificates:remove remove trusted certificate tag tag:add Add new tag tag:delete delete a tag tag:edit edit tag attributes tag:list list tags twofactorauth twofactorauth:cleanup Clean up the two-factor user-provider association of an uninstalled/removed provider twofactorauth:disable Disable two-factor authentication for a user twofactorauth:enable Enable two-factor authentication for a user twofactorauth:enforce Enabled/disable enforced two-factor authentication twofactorauth:state Get the two-factor authentication (2FA) state of a user user user:add adds a user user:add-app-password Add app password for the named user user:delete deletes the specified user user:disable disables the specified user user:enable enables the specified user user:info show user info user:lastseen shows when the user was logged in last time user:list list configured users user:report shows how many users have access user:resetpassword Resets the password of the named user user:setting Read and modify user settings root@foo-server-name:~# sudo nextcloud.occ upgrade Nextcloud or one of the apps require upgrade - only a limited number of commands are available You may use your browser or the occ upgrade command to do the upgrade Setting log level to debug Updating database schema Updated database Updating ... Update settings and binaries along with MediaDC Update binaries (downloading pre-compiled binaries for this release) 2/2 [============================] 100%Repair warning: This step may take some time An unhandled exception has been thrown: Error: Class "PharData" not found in /var/snap/nextcloud/33908/nextcloud/extra-apps/cloud_py_api/lib/Service/UtilsService.php:411 Stack trace: #0 /var/snap/nextcloud/33908/nextcloud/extra-apps/cloud_py_api/lib/Service/UtilsService.php(384): OCA\Cloud_Py_API\Service\UtilsService->unTarGz() #1 /var/snap/nextcloud/33908/nextcloud/extra-apps/mediadc/lib/Migration/AppUpdateStep.php(85): OCA\Cloud_Py_API\Service\UtilsService->downloadPythonBinaryDir() #2 /snap/nextcloud/33908/htdocs/lib/private/Repair.php(127): OCA\MediaDC\Migration\AppUpdateStep->run() #3 /snap/nextcloud/33908/htdocs/lib/private/legacy/OC_App.php(1068): OC\Repair->run() #4 /snap/nextcloud/33908/htdocs/lib/private/legacy/OC_App.php(1010): OC_App::executeRepairSteps() #5 /snap/nextcloud/33908/htdocs/lib/private/Updater.php(361): OC_App::updateApp() #6 /snap/nextcloud/33908/htdocs/lib/private/Updater.php(273): OC\Updater->doAppUpgrade() #7 /snap/nextcloud/33908/htdocs/lib/private/Updater.php(141): OC\Updater->doUpgrade() #8 /snap/nextcloud/33908/htdocs/core/Command/Upgrade.php(225): OC\Updater->upgrade() #9 /snap/nextcloud/33908/htdocs/3rdparty/symfony/console/Command/Command.php(255): OC\Core\Command\Upgrade->execute() #10 /snap/nextcloud/33908/htdocs/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run() #11 /snap/nextcloud/33908/htdocs/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand() #12 /snap/nextcloud/33908/htdocs/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun() #13 /snap/nextcloud/33908/htdocs/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run() #14 /snap/nextcloud/33908/htdocs/console.php(100): OC\Console\Application->run() #15 /snap/nextcloud/33908/htdocs/occ(11): require_once('...') #16 {main}root@foo-server-name:~# root@foo-server-name:~# root@foo-server-name:~# root@foo-server-name:~# root@foo-server-name:~# php -m | grep Phar Phar root@foo-server-name:~# sudo apt-get install php-phar Reading package lists... Done Building dependency tree Reading state information... Done Note, selecting 'php7.4-common' instead of 'php-phar' php7.4-common is already the newest version (7.4.3-4ubuntu2.18). php7.4-common set to manually installed. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. root@foo-server-name:~# sudo nextcloud.occ app:disable mediadc Nextcloud or one of the apps require upgrade - only a limited number of commands are available You may use your browser or the occ upgrade command to do the upgrade mediadc 0.3.4 disabled root@foo-server-name:~# sudo nextcloud.occ upgrade Nextcloud is already latest version root@foo-server-name:~# reboot ```
Here are the relevant apt updates ``` Start-Date: 2023-03-24 03:11:37 Commandline: apt upgrade -y Upgrade: bind9-dnsutils:amd64 (1:9.16.1-0ubuntu2.12, 1:9.16.1-0ubuntu2.14), cloud-init:amd64 (22.4.2-0ubuntu0~20.04.2, 23.1.1-0ubuntu0~20.04.1), python3-software-properties:amd64 (0.99.9.10, 0.99.9.11), update-notifier-common:amd64 (3.192.30.16, 3.192.30.17), tcpdump:amd64 (4.9.3-4ubuntu0.1, 4.9.3-4ubuntu0.2), ubuntu-advantage-tools:amd64 (27.13.3~20.04.1, 27.13.6~20.04.1), bind9-host:amd64 (1:9.16.1-0ubuntu2.12, 1:9.16.1-0ubuntu2.14), motd-news-config:amd64 (11ubuntu5.6, 11ubuntu5.7), python-apt-common:amd64 (2.0.1, 2.0.1ubuntu0.20.04.1), isc-dhcp-common:amd64 (4.4.1-2.1ubuntu5.20.04.4, 4.4.1-2.1ubuntu5.20.04.5), grub-efi-amd64-bin:amd64 (2.06-2ubuntu14, 2.06-2ubuntu14.1), python3-distupgrade:amd64 (1:20.04.40, 1:20.04.41), ubuntu-release-upgrader-core:amd64 (1:20.04.40, 1:20.04.41), shim-signed:amd64 (1.40.7+15.4-0ubuntu9, 1.40.9+15.7-0ubuntu1), fwupd-signed:amd64 (1.27.1ubuntu7+1.2-2~20.04.1, 1.51~20.04.1+1.2-3ubuntu0.2), libunwind8:amd64 (1.2.1-9build1, 1.2.1-9ubuntu0.1), grub-efi-amd64-signed:amd64 (1.187.2~20.04.2+2.06-2ubuntu14, 1.187.3~20.04.1+2.06-2ubuntu14.1), isc-dhcp-client:amd64 (4.4.1-2.1ubuntu5.20.04.4, 4.4.1-2.1ubuntu5.20.04.5), bind9-libs:amd64 (1:9.16.1-0ubuntu2.12, 1:9.16.1-0ubuntu2.14), python3-apt:amd64 (2.0.1, 2.0.1ubuntu0.20.04.1), base-files:amd64 (11ubuntu5.6, 11ubuntu5.7), software-properties-common:amd64 (0.99.9.10, 0.99.9.11), shim:amd64 (15.4-0ubuntu9, 15.7-0ubuntu1) End-Date: 2023-03-24 03:12:25 ```
2br-2b commented 1 year ago
Update: I tried re-enabling it and got this error. Waiting to upgrade to see if there's any useful troubleshooting I could do before I make a major change to the system like that. ``` An unhandled exception has been thrown: Error: Class "PharData" not found in /var/snap/nextcloud/33908/nextcloud/extra-apps/cloud_py_api/lib/Service/UtilsService.php:411 Stack trace: #0 /var/snap/nextcloud/33908/nextcloud/extra-apps/cloud_py_api/lib/Service/UtilsService.php(384): OCA\Cloud_Py_API\Service\UtilsService->unTarGz() #1 /var/snap/nextcloud/33908/nextcloud/extra-apps/mediadc/lib/Migration/AppUpdateStep.php(86): OCA\Cloud_Py_API\Service\UtilsService->downloadPythonBinaryDir() #2 /snap/nextcloud/33908/htdocs/lib/private/Repair.php(127): OCA\MediaDC\Migration\AppUpdateStep->run() #3 /snap/nextcloud/33908/htdocs/lib/private/legacy/OC_App.php(1068): OC\Repair->run() #4 /snap/nextcloud/33908/htdocs/lib/private/Installer.php(156): OC_App::executeRepairSteps() #5 /snap/nextcloud/33908/htdocs/core/Command/App/Enable.php(111): OC\Installer->installApp() #6 /snap/nextcloud/33908/htdocs/core/Command/App/Enable.php(81): OC\Core\Command\App\Enable->enableApp() #7 /snap/nextcloud/33908/htdocs/3rdparty/symfony/console/Command/Command.php(255): OC\Core\Command\App\Enable->execute() #8 /snap/nextcloud/33908/htdocs/3rdparty/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run() #9 /snap/nextcloud/33908/htdocs/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand() #10 /snap/nextcloud/33908/htdocs/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun() #11 /snap/nextcloud/33908/htdocs/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run() #12 /snap/nextcloud/33908/htdocs/console.php(100): OC\Console\Application->run() #13 /snap/nextcloud/33908/htdocs/occ(11): require_once('...') #14 {main} ```
andrey18106 commented 1 year ago

@2br-2b Hi! Thanks for the issue. I'll check it out on snap tomorrow. For now, I think, it would be good to test the latest version, it should work.

Regarding log error: seems like your PHP configuration has disabled phar.

andrey18106 commented 1 year ago

@2br-2b I checked my snap - there is PHP builded with --disable-phar flag, so yes, it won't work (that's why class PharData not found). You can use previous working versions until I fix it in cloud_py_api. Thanks for pointing that to us, it's definitely important, as it could be not only in snap.

andrey18106 commented 1 year ago

@2br-2b I'll publish a new cloud_py_api version with fix soon, so you can check and verify if it works now.

2br-2b commented 1 year ago

It seems to be working again now. Thank you so much!