Skip to content

fix: temporary file pattern to prevent race condition between async save and player join - #31

Closed
sysnote8main wants to merge 1 commit into
dev/1.21.11from
fix/race-parsing-1.21.11
Closed

fix: temporary file pattern to prevent race condition between async save and player join#31
sysnote8main wants to merge 1 commit into
dev/1.21.11from
fix/race-parsing-1.21.11

Conversation

@sysnote8main

Copy link
Copy Markdown
Contributor

概要

非同期セーブとプレイヤー参加時の読み込みレースコンディションを修正します。

修正内容

MySQL 移行済みのコードベースに合わせて、loadLegacyYaml() に stale .tmp ファイルのクリーンアップ処理を追加しました。

  • 以前のバージョン(YAML 保存時代)でクラッシュが発生した際に残った .tmp ファイルを、レガシーデータ読み込み前に削除します
  • これにより、書き込み途中のファイルを読み込んで InvalidConfigurationException が発生する問題を防止します

関連

元の fix commit: 129e9d2 (fix/race-parsing ブランチ)

…ave and player join

InventoryData.save() was writing directly to the target .yml file,
creating a race condition: while the async save thread was still writing,
another thread (e.g. player join → onJoin → loadInventoryData) could read
the partially written file, causing InvalidConfigurationException.

Fix (adapted for MySQL-migrated codebase):
- loadLegacyYaml() now cleans up stale .tmp files left from a previous crash,
  before reading the target .yml file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant