-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix RemoteProtocolError: Server disconnected without sending a response.
#753
Comments
The change above results in a failure during logging that causes the server not to send a response. The key section is:
Full output expandable here:
This fix ensures that a (500) response is sent. It's probably worth having this in place as a fail-safe, but I think we should also try to set the principal even for 500 responses if possible. diff --git a/tiled/server/principal_log_filter.py b/tiled/server/principal_log_filter.py
index faf4f0fd..2580ea3f 100644
--- a/tiled/server/principal_log_filter.py
+++ b/tiled/server/principal_log_filter.py
@@ -8,8 +8,10 @@ class PrincipalFilter(Filter):
"""Logging filter to attach username or Service Principal UUID to LogRecord"""
def filter(self, record: LogRecord) -> bool:
- principal = current_principal.get()
- if isinstance(principal, SpecialUsers):
+ principal = current_principal.get(None)
+ if principal is None:
+ short_name = "unset"
+ elif isinstance(principal, SpecialUsers):
short_name = f"{principal.value}"
elif principal.type == "service":
short_name = f"service:{principal.uuid}" |
2 tasks
Closed by #754 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This seems to be a regression introduced by #750. I can reproduce it by raising an exception in exactly the right place in the middleware:
The text was updated successfully, but these errors were encountered: