Start ConnectionWatcher before the application starts
まだ誰も着手していません。
評価
調査の方向性
Issue では Yii2::_before() が特定され、関連する起動順序が示されています。このメソッドを読み、_after() が ConnectionWatcher::closeAll() をどのように使うか確認してください。watcher の起動を recreateClient() と startApp() の間に移動してください。アプリの作成中に開かれた接続が追跡され、テスト後に閉じられれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Problem
Yii2::_before() starts the ConnectionWatcher only after startApp():
$this->recreateClient();
$this->yiiLogger = new Yii2Connector\Logger();
$this->getClient()->startApp($this->yiiLogger);
$this->connectionWatcher = new ConnectionWatcher();
$this->connectionWatcher->start();
If a connection is opened while the application is being created, the watcher never sees its EVENT_AFTER_OPEN, and closeAll() in _after() does not close it. The application is reset after each test, but the old Connection objects are not always freed, so the PDO handle stays open until the process ends. That leaks one connection per test, and a large enough suite fails with SQLSTATE[HY000] [1040] Too many connections.
Fix
Start the watcher after recreateClient() and before startApp():
$this->recreateClient();
+
+ $this->connectionWatcher = new ConnectionWatcher();
+ $this->connectionWatcher->start();
+
$this->yiiLogger = new Yii2Connector\Logger();
$this->getClient()->startApp($this->yiiLogger);
-
- $this->connectionWatcher = new ConnectionWatcher();
- $this->connectionWatcher->start();
- 主要言語
- PHP
- スター
- 19
- フォーク
- 43
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Codeception/module-yii2 のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
Codeception/module-yii2#145 · リアクション 1 件 ·
-
`closeSession()` rebuilds a throwaway Application every test (redundant boot + memory leak)対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Codeception/module-yii2#144 · コメント 1 件 · リアクション 1 件 ·
-
MongoDB supportオープン
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
Codeception/module-yii2#142 · コメント 4 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 38/100
Codeception/module-yii2#141 · コメント 1 件 ·
-
Unable to load yii\elasticsearch\ActiveRecord-based fixtures再び着手できるかも @Mikk36 が 427 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
Codeception/module-yii2#134 · コメント 4 件 · 担当者 1 名 ·
Codeception/module-yii2 の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
taskforcesh/bullmq#5238 ·
メンテナーはふだん 1 日以内に返信
-
[Bug] v-change-database-password reports success but doesn't change the password when MySQL validate_password rejects it対応中かも @bfs2021 が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Automattic/jetpack#55517 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 84/100
-
area/import type/enhancement when/later
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 1 日以内に返信