From 0070ee1d2411a1f67eb797692d26a5cb36101e87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20One=C8=9B?= Date: Wed, 12 Jul 2023 15:01:21 +0300 Subject: [PATCH 1/9] fix: libretime process leaks and lsof high cpu usage (#2615) --- docker-compose.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 934265881..eed3c4d26 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,6 +22,9 @@ services: playout: image: ghcr.io/libretime/libretime-playout:${LIBRETIME_VERSION:-latest} + init: true + ulimits: + nofile: 1024 depends_on: - rabbitmq volumes: @@ -33,6 +36,9 @@ services: liquidsoap: image: ghcr.io/libretime/libretime-playout:${LIBRETIME_VERSION:-latest} command: /usr/local/bin/libretime-liquidsoap + init: true + ulimits: + nofile: 1024 ports: - 8001:8001 - 8002:8002 @@ -46,6 +52,9 @@ services: analyzer: image: ghcr.io/libretime/libretime-analyzer:${LIBRETIME_VERSION:-latest} + init: true + ulimits: + nofile: 1024 depends_on: - rabbitmq volumes: @@ -56,6 +65,9 @@ services: worker: image: ghcr.io/libretime/libretime-worker:${LIBRETIME_VERSION:-latest} + init: true + ulimits: + nofile: 1024 depends_on: - rabbitmq volumes: @@ -65,6 +77,9 @@ services: api: image: ghcr.io/libretime/libretime-api:${LIBRETIME_VERSION:-latest} + init: true + ulimits: + nofile: 1024 depends_on: - postgres - rabbitmq @@ -74,6 +89,9 @@ services: legacy: image: ghcr.io/libretime/libretime-legacy:${LIBRETIME_VERSION:-latest} + init: true + ulimits: + nofile: 1024 depends_on: - postgres - rabbitmq From 55a1684d815fece4cadf7738c9ab82df8c2a6e2e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 31 Jul 2023 02:16:08 +0000 Subject: [PATCH 2/9] chore(deps): update pre-commit hook asottile/pyupgrade to v3.10.1 --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index df6107124..ed3386f85 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -36,7 +36,7 @@ repos: exclude: ^legacy/public(?!/js/airtime) - repo: https://github.com/asottile/pyupgrade - rev: v3.9.0 + rev: v3.10.1 hooks: - id: pyupgrade args: [--py38-plus] From 4d4df95852951e7074b119d94e3b2792443c27ac Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 29 Jul 2023 19:44:06 +0000 Subject: [PATCH 3/9] chore(deps): update dependency flake8 to >=6.0.0,<6.2 --- tools/python-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/python-requirements.txt b/tools/python-requirements.txt index 1248311a4..0f7f09bd6 100644 --- a/tools/python-requirements.txt +++ b/tools/python-requirements.txt @@ -1,6 +1,6 @@ bandit>=1.7.4,<1.8 black>=23.1.0,<24.0 -flake8>=6.0.0,<6.1 +flake8>=6.0.0,<6.2 isort>=5.12.0,<5.13 mypy==1.4.1 pylint>=2.16.1,<2.18 From 9d80d894f4abb9a3cbe39dbb43bc89c37a6431bd Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 3 Aug 2023 08:46:41 +0000 Subject: [PATCH 4/9] chore(deps): update pre-commit hook pre-commit/mirrors-prettier to v3.0.1 --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ed3386f85..d41cc202a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,7 +29,7 @@ repos: exclude: ^api - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.0 + rev: v3.0.1 hooks: - id: prettier files: \.(md|mdx|yml|yaml|js|jsx|ts|tsx|json|css)$ From 5f8639ce61b169a72f95792ba029f5c0b19ce532 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 5 Aug 2023 09:29:33 +0200 Subject: [PATCH 5/9] chore(deps): update dependency model_bakery to >=1.10.1,<1.14 (#2646) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- api/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/setup.py b/api/setup.py index 3bf084a87..b8ed1218b 100644 --- a/api/setup.py +++ b/api/setup.py @@ -41,7 +41,7 @@ setup( "django-coverage-plugin>=3.0.0,<3.2", "django-stubs>=1.14.0,<4.3", "djangorestframework-stubs>=1.8.0,<3.15", - "model_bakery>=1.10.1,<1.13", + "model_bakery>=1.10.1,<1.14", "psycopg[binary]>=3.1.8,<3.2", "pylint-django>=2.5.3,<2.6", "pytest-django>=4.5.2,<4.6", From 372fb9e76c2d18aef339223859464619a106aa18 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 5 Aug 2023 09:29:41 +0200 Subject: [PATCH 6/9] chore(deps): update dependency sentry-sdk to >=1.15.0,<1.30 (#2642) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- analyzer/setup.py | 2 +- api/setup.py | 2 +- playout/setup.py | 2 +- worker/setup.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/analyzer/setup.py b/analyzer/setup.py index 84fbef517..a5dac92ff 100644 --- a/analyzer/setup.py +++ b/analyzer/setup.py @@ -31,7 +31,7 @@ setup( "types-requests>=2.31.0,<2.32", ], "sentry": [ - "sentry-sdk>=1.15.0,<1.29", + "sentry-sdk>=1.15.0,<1.30", ], }, zip_safe=False, diff --git a/api/setup.py b/api/setup.py index b8ed1218b..26438ce89 100644 --- a/api/setup.py +++ b/api/setup.py @@ -48,7 +48,7 @@ setup( "requests-mock>=1.10.0,<1.12", ], "sentry": [ - "sentry-sdk[django]>=1.15.0,<1.29", + "sentry-sdk[django]>=1.15.0,<1.30", ], }, ) diff --git a/playout/setup.py b/playout/setup.py index 27b2815ec..dd39527b2 100644 --- a/playout/setup.py +++ b/playout/setup.py @@ -42,7 +42,7 @@ setup( "types-requests>=2.31.0,<2.32", ], "sentry": [ - "sentry-sdk>=1.15.0,<1.29", + "sentry-sdk>=1.15.0,<1.30", ], }, zip_safe=False, diff --git a/worker/setup.py b/worker/setup.py index 399b165bd..c534e1fb4 100644 --- a/worker/setup.py +++ b/worker/setup.py @@ -26,7 +26,7 @@ setup( "types-requests>=2.31.0,<2.32", ], "sentry": [ - "sentry-sdk>=1.15.0,<1.29", + "sentry-sdk>=1.15.0,<1.30", ], }, zip_safe=False, From 5bac175bf0d207ceff8511fe239d57e317fcfe46 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 15 Aug 2023 18:04:08 +0200 Subject: [PATCH 7/9] chore(deps): lock file maintenance (legacy/composer.json) (#2649) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- legacy/composer.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/legacy/composer.lock b/legacy/composer.lock index f97a9cbe1..f9456c263 100644 --- a/legacy/composer.lock +++ b/legacy/composer.lock @@ -1080,16 +1080,16 @@ }, { "name": "symfony/config", - "version": "v5.4.21", + "version": "v5.4.26", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "2a6b1111d038adfa15d52c0871e540f3b352d1e4" + "reference": "8109892f27beed9252bd1f1c1880aeb4ad842650" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/2a6b1111d038adfa15d52c0871e540f3b352d1e4", - "reference": "2a6b1111d038adfa15d52c0871e540f3b352d1e4", + "url": "https://api.github.com/repos/symfony/config/zipball/8109892f27beed9252bd1f1c1880aeb4ad842650", + "reference": "8109892f27beed9252bd1f1c1880aeb4ad842650", "shasum": "" }, "require": { @@ -1139,7 +1139,7 @@ "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/config/tree/v5.4.21" + "source": "https://github.com/symfony/config/tree/v5.4.26" }, "funding": [ { @@ -1155,7 +1155,7 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:03:56+00:00" + "time": "2023-07-19T20:21:11+00:00" }, { "name": "symfony/deprecation-contracts", @@ -3711,16 +3711,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.22.1", + "version": "1.23.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "65c39594fbd8c67abfc68bb323f86447bab79cc0" + "reference": "846ae76eef31c6d7790fac9bc399ecee45160b26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/65c39594fbd8c67abfc68bb323f86447bab79cc0", - "reference": "65c39594fbd8c67abfc68bb323f86447bab79cc0", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/846ae76eef31c6d7790fac9bc399ecee45160b26", + "reference": "846ae76eef31c6d7790fac9bc399ecee45160b26", "shasum": "" }, "require": { @@ -3752,9 +3752,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.22.1" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.23.1" }, - "time": "2023-06-29T20:46:06+00:00" + "time": "2023-08-03T16:32:59+00:00" }, { "name": "phpunit/dbunit", From a5cc52e9a94fb587193719a2d03f101b3197e467 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 15 Aug 2023 18:04:23 +0200 Subject: [PATCH 8/9] chore(deps): update dependency mypy to v1.5.0 (#2651) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- tools/python-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/python-requirements.txt b/tools/python-requirements.txt index 0f7f09bd6..3b0445af3 100644 --- a/tools/python-requirements.txt +++ b/tools/python-requirements.txt @@ -2,7 +2,7 @@ bandit>=1.7.4,<1.8 black>=23.1.0,<24.0 flake8>=6.0.0,<6.2 isort>=5.12.0,<5.13 -mypy==1.4.1 +mypy==1.5.0 pylint>=2.16.1,<2.18 pytest-cov>=4.0.0,<4.2 pytest-xdist>=3.1.0,<3.4 From ab16cb47c5c4b4a1d183d00570a0ef87224657c2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 15 Aug 2023 18:28:18 +0200 Subject: [PATCH 9/9] fix(deps): update dependency friendsofphp/php-cs-fixer to <3.23.1 (stable) (#2656) * fix(deps): update dependency friendsofphp/php-cs-fixer to <3.23.1 * style: format files using php-cs-fixer --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: jo --- legacy/application/check.php | 1 + legacy/application/common/CeleryManager.php | 1 + legacy/application/common/HTTPHelper.php | 7 +++---- legacy/application/controllers/WebstreamController.php | 2 ++ legacy/application/models/ListenerStat.php | 1 + legacy/application/models/Show.php | 1 + legacy/application/models/User.php | 1 + legacy/application/services/ShowFormService.php | 1 + legacy/tools/composer.json | 2 +- 9 files changed, 12 insertions(+), 5 deletions(-) diff --git a/legacy/application/check.php b/legacy/application/check.php index 1269109fd..7f8ba5b75 100644 --- a/legacy/application/check.php +++ b/legacy/application/check.php @@ -40,6 +40,7 @@ function checkPhpDependencies() function checkDatabaseDependencies() { global $extensions; + // Check the PHP extension list for the Postgres db extensions return in_array('pdo_pgsql', $extensions) && in_array('pgsql', $extensions); diff --git a/legacy/application/common/CeleryManager.php b/legacy/application/common/CeleryManager.php index 3a4fa785a..70406667d 100644 --- a/legacy/application/common/CeleryManager.php +++ b/legacy/application/common/CeleryManager.php @@ -98,6 +98,7 @@ class CeleryManager throw new CeleryTimeoutException('Celery task ' . $task->getDbName() . ' with ID ' . $task->getDbTaskId() . ' timed out'); } + // The message hasn't timed out, but it's still false, which means it hasn't been // sent back from Celery yet. throw new CeleryException('Waiting on Celery task ' . $task->getDbName() . ' with ID ' . $task->getDbTaskId()); diff --git a/legacy/application/common/HTTPHelper.php b/legacy/application/common/HTTPHelper.php index 1db6eed4b..3047685cc 100644 --- a/legacy/application/common/HTTPHelper.php +++ b/legacy/application/common/HTTPHelper.php @@ -52,10 +52,9 @@ class Application_Common_HTTPHelper class ZendActionHttpException extends Exception { /** - * @param int $statusCode - * @param string $message - * @param int $code - * @param Exception $previous + * @param int $statusCode + * @param string $message + * @param int $code * * @throws Zend_Controller_Response_Exception */ diff --git a/legacy/application/controllers/WebstreamController.php b/legacy/application/controllers/WebstreamController.php index a823511bf..a7ec0698e 100644 --- a/legacy/application/controllers/WebstreamController.php +++ b/legacy/application/controllers/WebstreamController.php @@ -116,9 +116,11 @@ class WebstreamController extends Zend_Controller_Action /*we are updating a playlist. Ensure that if the user is a host/dj, that he has the correct permission.*/ $user = Application_Model_User::getCurrentUser(); + // only allow when webstream belongs to the DJ return $webstream->getDbCreatorId() == $user->getId(); } + /*we are creating a new stream. Don't need to check whether the DJ/Host owns the stream*/ return true; diff --git a/legacy/application/models/ListenerStat.php b/legacy/application/models/ListenerStat.php index 96713ffc7..ec19fb4f6 100644 --- a/legacy/application/models/ListenerStat.php +++ b/legacy/application/models/ListenerStat.php @@ -125,6 +125,7 @@ SQL; foreach ($data as $show_id) { $all_show_data = array_merge(self::getShowDataPointsWithinRange($p_start, $p_end, $show_id['show_id']), $all_show_data); } + /* option to sort by number of listeners currently commented out usort($all_show_data, function($a, $b) { return $a['average_number_of_listeners'] - $b['average_number_of_listeners']; diff --git a/legacy/application/models/Show.php b/legacy/application/models/Show.php index 8efef314d..50a6c2451 100644 --- a/legacy/application/models/Show.php +++ b/legacy/application/models/Show.php @@ -1209,6 +1209,7 @@ SQL; $row = intval($date->format('w')) % count($palette); $foo = $date->format('H'); $col = intval(intval($date->format('H')) / 24.0 * count($palette[0])); + // $color = $palette[$hashValue % sizeof($palette)]; return $palette[$row][$col]; } diff --git a/legacy/application/models/User.php b/legacy/application/models/User.php index aac98773e..2326a1414 100644 --- a/legacy/application/models/User.php +++ b/legacy/application/models/User.php @@ -227,6 +227,7 @@ class Application_Model_User public function getOwnedFiles() { $user = $this->_userInstance; + // do we need a find call at the end here? return $user->getCcFilessRelatedByDbOwnerId(); } diff --git a/legacy/application/services/ShowFormService.php b/legacy/application/services/ShowFormService.php index ba207389c..3935a4189 100644 --- a/legacy/application/services/ShowFormService.php +++ b/legacy/application/services/ShowFormService.php @@ -401,6 +401,7 @@ class Application_Service_ShowFormService Logging::error('Failed to read image: ' . $path); $imageData = null; } + // return the data URI - data:{mime};base64,{data} return ($imageData === null || $imageData === '') ? '' : 'data: ' . mime_content_type($path) . ';base64,' . $imageData; diff --git a/legacy/tools/composer.json b/legacy/tools/composer.json index a7bc871cb..8f7076440 100644 --- a/legacy/tools/composer.json +++ b/legacy/tools/composer.json @@ -1,6 +1,6 @@ { "require": { "php": "^7.4", - "friendsofphp/php-cs-fixer": "<3.22.1" + "friendsofphp/php-cs-fixer": "<3.23.1" } }