Skip to content
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

[Serve] fix logging error on passing traceback object into exc_info #46105

Merged
merged 2 commits into from
Jun 18, 2024

Conversation

GeneDer
Copy link
Contributor

@GeneDer GeneDer commented Jun 18, 2024

Why are these changes needed?

The root cause for the logging error we saw was due to the client passing traceback object into exc_info during logging. In serve logger we do a deepcopy on the log record's __dict__ attribute which was unable to pickle the traceback for the deep copy. This PR removed the deepcopy completely since we do not modify to the copied dict at all. Also added a test to ensure the regression doesn't happen.

Related issue number

Closes #45912

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: Gene Su <e870252314@gmail.com>
@GeneDer GeneDer added bug Something that is supposed to be working; but isn't serve Ray Serve Related Issue labels Jun 18, 2024
@GeneDer GeneDer requested a review from edoakes June 18, 2024 00:08
class MyDeployment:
def __call__(self) -> str:
return "Hello world!"
# Set log directory for the deployment.
@serve.deployment(LoggingConfig(logs_dir="/my_dir")
@serve.deployment(LoggingConfig(logs_dir="/my_dir"))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a doc change, since I saw it while reading it. Unrelated to the actual bug.

@@ -100,7 +100,7 @@ def format(self, record: logging.LogRecord) -> str:
The formatted log record in json format.
"""
record_format = copy.deepcopy(self.component_log_fmt)
record_attributes = copy.deepcopy(record.__dict__)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no idea why this was here in the first place...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel it's probably a copy pasta from the line above 😅

python/ray/serve/_private/logging_utils.py Outdated Show resolved Hide resolved
Signed-off-by: Gene Su <e870252314@gmail.com>
@GeneDer GeneDer added the go add ONLY when ready to merge, run all tests label Jun 18, 2024
@edoakes edoakes merged commit b420726 into ray-project:master Jun 18, 2024
7 checks passed
@GeneDer GeneDer deleted the fix-logging-error branch June 18, 2024 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that is supposed to be working; but isn't go add ONLY when ready to merge, run all tests serve Ray Serve Related Issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Logs] Look into OpenAIHTTPException logging error
2 participants