[PR #4792] [CLOSED] [Engine] serve: a failed engine start no longer crashes when another thread closed the process #5182

Closed
opened 2026-11-07 16:33:18 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4792
Author: @sdroege
Created: 10/31/2026
Status: ❌ Closed

Base: main ← Head: fix-serve-restart


📝 Commits (1)

  • 74debb2 serve: a failed engine start no longer crashes when another thread closed the process

📊 Changes

1 file changed (+11 additions, -9 deletions)

View changed files

📝 serve/server.py (+11 -9)

📄 Description

Problem and result

After an engine abort, StrataEngine.restart() calls __init__() again. If another thread had already called close() and set self.proc to None, the failed-start cleanup dereferenced it:

File "serve/server.py", line 1334, in restart
  self.__init__(*self.spawn)
File "serve/server.py", line 1106, in __init__
  self.proc.stdin.close()
AttributeError: 'NoneType' object has no attribute 'stdin'

A recoverable engine abort (exit -6 after a GPU hang) became a 400 and a stopped server. After the fix the same abort restarts the engine normally.

none

Approach

Keep the spawned process in a local (proc = self.proc) and use it in the failed-start cleanup, with None guards. If another thread has already closed the process, the cleanup is skipped. No behaviour change otherwise.

Validation

Passed:

  • Reproduced on a Radeon AI PRO R9700 (gfx1201), engine 0.1.54, with a GPU hang (engine exit -6); the traceback above is from that run.
  • After the fix, the same hang sequence restarts the engine normally (three aborts in one benchmark run, each followed by a restart).
  • python -m py_compile serve/server.py passes.

Failed:

  • none observed

Not run:

  • The full test suite. Only the server was exercised on the one machine.

Limits

This only prevents the AttributeError; it does not change the engine's behaviour or the GPU hang itself.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/4792 **Author:** [@sdroege](https://github.com/sdroege) **Created:** 10/31/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix-serve-restart` --- ### 📝 Commits (1) - [`74debb2`](https://github.com/Niko1221/Strata/commit/74debb29e5e2c5d09ca5bc7982fb5dc5fa7216c5) serve: a failed engine start no longer crashes when another thread closed the process ### 📊 Changes **1 file changed** (+11 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `serve/server.py` (+11 -9) </details> ### 📄 Description ## Problem and result After an engine abort, `StrataEngine.restart()` calls `__init__()` again. If another thread had already called `close()` and set `self.proc` to `None`, the failed-start cleanup dereferenced it: ``` File "serve/server.py", line 1334, in restart self.__init__(*self.spawn) File "serve/server.py", line 1106, in __init__ self.proc.stdin.close() AttributeError: 'NoneType' object has no attribute 'stdin' ``` A recoverable engine abort (exit -6 after a GPU hang) became a 400 and a stopped server. After the fix the same abort restarts the engine normally. ## Related discussion none ## Approach Keep the spawned process in a local (`proc = self.proc`) and use it in the failed-start cleanup, with `None` guards. If another thread has already closed the process, the cleanup is skipped. No behaviour change otherwise. ## Validation **Passed:** - Reproduced on a Radeon AI PRO R9700 (gfx1201), engine 0.1.54, with a GPU hang (engine exit -6); the traceback above is from that run. - After the fix, the same hang sequence restarts the engine normally (three aborts in one benchmark run, each followed by a restart). - `python -m py_compile serve/server.py` passes. **Failed:** - none observed **Not run:** - The full test suite. Only the server was exercised on the one machine. ## Limits This only prevents the `AttributeError`; it does not change the engine's behaviour or the GPU hang itself. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:33:18 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#5182
No description provided.