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] Port 8000 GET root endpoint should not be exposed #47317

Closed
MortalHappiness opened this issue Aug 24, 2024 · 7 comments
Closed

[Serve] Port 8000 GET root endpoint should not be exposed #47317

MortalHappiness opened this issue Aug 24, 2024 · 7 comments
Assignees
Labels
bug Something that is supposed to be working; but isn't serve Ray Serve Related Issue triage Needs triage (eg: priority, bug/not-bug, and owning component)

Comments

@MortalHappiness
Copy link
Member

MortalHappiness commented Aug 24, 2024

What happened + What you expected to happen

Sends a GET request to localhost:8000 shows the following error.

Unexpected error, traceback: �[36mray::ServeReplica:mobilenet:ImageClassifier.handle_request_streaming()�[39m (pid=768, ip=10.244.0.18)
  File "/home/ray/anaconda3/lib/python3.8/site-packages/ray/serve/_private/utils.py", line 165, in wrap_to_ray_error
    raise exception
  File "/home/ray/anaconda3/lib/python3.8/site-packages/ray/serve/_private/replica.py", line 895, in call_user_method
    result = await method_to_call(*request_args, **request_kwargs)
  File "/tmp/ray/session_2024-08-23_21-13-49_235633_14/runtime_resources/working_dir_files/https_github_com_ray-project_serve_config_examples_archive_b393e77bbd6aba0881e3d94c05f968f05a387b96/mobilenet/mobilenet.py", line 25, in __call__
    image_file = await request["image"].read()
  File "/home/ray/anaconda3/lib/python3.8/site-packages/starlette/datastructures.py", line 310, in __getitem__
    return self._dict[key]
KeyError: 'image'.

This REST endpoint should not be exposed to users.

Note: I would like to work on this issue if this behavior is not expected.

Versions / Dependencies

2.34.0

Reproduction script

Follow this doc https://docs.ray.io/en/releases-2.34.0/cluster/kubernetes/examples/mobilenet-rayservice.html

Issue Severity

None

@MortalHappiness MortalHappiness added bug Something that is supposed to be working; but isn't triage Needs triage (eg: priority, bug/not-bug, and owning component) labels Aug 24, 2024
@MortalHappiness
Copy link
Member Author

cc @kevin85421

@kevin85421
Copy link
Member

cc @edoakes is this an expected behavior? If so, should we expose a better error message?

@edoakes
Copy link
Contributor

edoakes commented Aug 26, 2024

I don't understand the issue, it looks like the example code is just not gracefully handling the case where image isn't provided in the request body?

@MortalHappiness
Copy link
Member Author

@edoakes Is the GET / endpoint used? @kevin85421 told me that only the POST / endpoint is used. So if this endpoint is not used, it should better be hiden from the user. If this endpoint is used, then I'll change the issue description or close this issue.

@kevin85421
Copy link
Member

There seem to be some examples (https://docs.ray.io/en/latest/serve/key-concepts.html) using GET in the Ray Serve examples. It’s unclear to me when to use GET and when to use POST and which API endpoints will be created.

@edoakes
Copy link
Contributor

edoakes commented Aug 27, 2024

This is up to the application's REST API design

@MortalHappiness
Copy link
Member Author

MortalHappiness commented Aug 31, 2024

@edoakes Thank you for your clarification. I closed this and opened a new one in ray-project/serve_config_examples#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 serve Ray Serve Related Issue triage Needs triage (eg: priority, bug/not-bug, and owning component)
Projects
None yet
Development

No branches or pull requests

3 participants