Прерванная запись журнала процессов ломает восстановление всех сохранённых сессий

Open
#343 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
63/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp
Domain
backend

Research direction

Start with ProcessJournal.cs:143–169 and AppServices.cs:167–172 to trace how the journal is read, written, and used during startup cleanup. Then inspect the existing tests and add a case that interrupts saving after a valid snapshot exists. Done means the prior snapshot remains readable after a failed write, and an unrecoverable journal produces a diagnostic.

Written by the indexing model from the issue text.

Description

bug network

Приоритет P1 · milestone 0.4.1

Журнал процессов перезаписывается на месте. Сбой записи после обрезания файла может стереть сведения обо всех ранее зарегистрированных процессах. Например, оставшийся после сбоя retained TUN может блокировать трафик, а приложение не найдёт его по журналу.

Воспроизведение без процессов и сети

  1. Создать журнал с записью о фейковом PID.
  2. Подставить усечённый JSON, имитируя остановку процесса во время записи.
  3. Создать новый ProcessJournal и прочитать записи. Изолированная проверка вернула 0 вместо сохранённого снимка или явной ошибки.

Причина: ProcessJournal.cs:164–169 пишет File.WriteAllText прямо в рабочий файл и подавляет IOException. ReadUnsafe (:143–153) возвращает пустой список при испорченном JSON. Стартовая очистка retained guard зависит от этого журнала (AppServices.cs:167–172).

Ожидаемо: предыдущий валидный снимок доступен при сбое записи, а неисправимый журнал диагностируется.

Направление исправления: запись через временный файл с атомарной заменой, обработка ошибки и тест с прерыванием сохранения.

Аудит ffa65648867139f9e45c15f4b635a83c1ff52c1b.

Dominant language
C#
Stars
5
Forks
1
Avg merge
23m
Merged PRs (30d)
144

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from endercodezz/BYDLO

All issues in endercodezz/BYDLO

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.