Skip to content

fix(runtime): disable debug mode in the Flask service - #3917

Closed
8079-debug wants to merge 1 commit into
modelscope:mainfrom
8079-debug:fix/flask-debug-default
Closed

8079-debug wants to merge 1 commit into
modelscope:mainfrom
8079-debug:fix/flask-debug-default

Conversation

@8079-debug

Copy link
Copy Markdown
Contributor

Summary

  • Set debug=False in the direct-launch entrypoint of runtime/python/websocket/funASR-Service.py, which retains its existing host and port. This prevents the launcher from unconditionally enabling Flask's development debugger and reloader.
  • Add regression tests that execute the complete script and the real Flask.run, including FLASK_DEBUG unset, 0, and 1. Also check existing missing-upload responses, a valid similarity request, and generic HTTP 500 handling.

Type of change

  • Bug fix
  • Runtime or deployment

Validation

Windows x64, Python 3.13.3, Flask 3.0.0. No model downloads or GPU inference.

  • Before the source change, PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python -m pytest -q tests/test_flask_service_debug.py: 4 failed, 1 passed, reproducing enabled debug mode and exception propagation.
  • After the change, PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 python -m pytest -q tests/test_flask_service_debug.py tests/test_websocket_server_asr_model.py tests/test_websocket_server_hotwords.py tests/test_websocket_file_finalization.py: 41 passed.
  • python -m compileall -q funasr examples tests runtime/python/websocket/funASR-Service.py: passed.

Model/dependency boundaries are stubbed; Flask, request dispatch, JSON responses and its startup option handling are real. Only werkzeug.serving.run_simple is intercepted at the socket-listening boundary, so these are local startup/WSGI regressions, not a deployed-server or ASR-quality test. The optional test dependencies are Flask, NumPy, SciPy and pytest.

User impact

Directly starting this example no longer enables its development debugger or automatic reloader. Existing binding, routes and successful response shapes are preserved. This does not make the development server a production deployment recommendation.

Notes for reviewers

This is a deliberately narrow, independently tested subset of the previously closed, unmerged #3877. It does not include that PR's upload/JSON/cleanup changes or claim to resolve the upload-cleanup review findings. Those require a separate fix and their own route/filesystem regressions.

Keep the directly launched service's debugger and reloader disabled, with regression coverage for startup settings and normal HTTP behavior.
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