Skip to content

Conversation

@Amir-Zucker
Copy link
Contributor

Sometimes when we stop the engine and close the read pipe we receive a signal 13, which leads to the app being terminated. This happens because we are still receiving new data after the read pipe was already closed.

Admittedly this is more prevalent with Arasan Chess Engine which is not a part of this repo, but it might still happen with Stockfish and LC0.

Changes done and their purpose.

  • ignore SIGPIP if we encounter one during initialization.
  • Ensure we remove the read observer before we try to close the pipes.
  • Close and nullify write pipe and write file handler before closing read pipes.
  • Replaced the call to the deprecated closeFile method with closeAndReturnError:.
  • Added checks to ensure write pipe is still valid before sending new commands.

No new tests were added, as the changes that were made are already being covered by existing ones.

Cheers!

…om forked repo

- ignore SIGPIP if we encounter one during initialization
- Ensure we remove the read observer before we try to close the pipes
- Added checks to ensure write pipe is still valid before sending new commands.
@Amir-Zucker
Copy link
Contributor Author

This branch was created from the latest commit in the master branch of this repo, I then cherry picked the relevant commit from the bugfix branch and opened a PR back to this repo.

Not sure why codecov complains about reduction in code coverage on files that are unrelated to the commit nor were they changed at any point.


This PR might cause conflicts with PR #27 since we both made changes to line 29 of EngineMessenger.mm, but these are completely unrelated changes, just add one after the other.

@pdil pdil added the bug A bug or issue that should be resolved label Dec 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug A bug or issue that should be resolved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants