Thank you for submitting an issue. Please refer to our issue policy for additional information about bug reports. For help with debugging your code, please refer to Stack Overflow.
Please fill in this bug report template to ensure a timely and thorough response.
Willingness to contribute
The MLflow Community encourages bug fix contributions. Would you or another member of your organization be willing to contribute a fix for this bug to the MLflow code base?
System information
- Have I written custom code (as opposed to using a stock example script provided in MLflow): yes
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): windows 10
- MLflow installed from (source or binary): binary
- MLflow version (run
mlflow --version): 1.20.2
- Python version: 3.8
- npm version, if running the dev UI: N/A
- Exact command to reproduce:
- Start server:
mlflow models serve -m runs:/5f8aee52fcb442388368af4da658b398/model --no-conda
- Submit an inference request:
curl -i -X POST -d "{\"data\":0.0199132142]}" -H "Content-Type: application/json" http://localhost:5000/invocations
Describe the problem
Describe the problem clearly here. Include descriptions of the expected behavior and the actual behavior.
Submitting an inference requests to the MLFlow model server with invalid content returns HTTP error 500 'Internal Server Error' instead of HTTP error 400 'Bad Request'. This prevents proper error handling on the client side and blocks REST API fuzzing.
Ex:
curl -i -X POST -d "{\"data\":0.0199132142]}" -H "Content-Type: application/json" http://localhost:5000/invocations
HTTP/1.1 500 INTERNAL SERVER ERROR
Content-Length: 901
Content-Type: application/json
Date: Wed, 13 Oct 2021 22:16:44 GMT
Server: mlflow
{"error_code": "MALFORMED_REQUEST", "message": "Failed to parse input from JSON. Ensure that input is a valid JSON formatted string.", "stack_trace": "Traceback (most recent call last):\n File \"C:\\Source\\local_training_mlflow_project\\.venv\\lib\\site-packages\\mlflow\\pyfunc\\scoring_server\\__init__.py\", line 81, in infer_and_parse_json_input\n decoded_input = json.loads(json_input)\n File \"C:\\Users\\mmaitre\\Anaconda3\\lib\\json\\__init__.py\", line 357, in loads\n return _default_decoder.decode(s)\n File \"C:\\Users\\mmaitre\\Anaconda3\\lib\\json\\decoder.py\", line 337, in decode\n obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n File \"C:\\Users\\mmaitre\\Anaconda3\\lib\\json\\decoder.py\", line 353, in raw_decode\n obj, end = self.scan_once(s, idx)\njson.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 21 (char 20)\n"}
Code to reproduce issue
Provide a reproducible test case that is the bare minimum necessary to generate the problem.'
curl -i -X POST -d "{\"data\":0.0199132142]}" -H "Content-Type: application/json" http://localhost:5000/invocations
Other info / logs
Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.
What component(s), interfaces, languages, and integrations does this bug affect?
Components
Interface
Language
Integrations
Thank you for submitting an issue. Please refer to our issue policy for additional information about bug reports. For help with debugging your code, please refer to Stack Overflow.
Please fill in this bug report template to ensure a timely and thorough response.
Willingness to contribute
The MLflow Community encourages bug fix contributions. Would you or another member of your organization be willing to contribute a fix for this bug to the MLflow code base?
System information
mlflow --version): 1.20.2mlflow models serve -m runs:/5f8aee52fcb442388368af4da658b398/model --no-condacurl -i -X POST -d "{\"data\":0.0199132142]}" -H "Content-Type: application/json" http://localhost:5000/invocationsDescribe the problem
Describe the problem clearly here. Include descriptions of the expected behavior and the actual behavior.
Submitting an inference requests to the MLFlow model server with invalid content returns HTTP error 500 'Internal Server Error' instead of HTTP error 400 'Bad Request'. This prevents proper error handling on the client side and blocks REST API fuzzing.
Ex:
Code to reproduce issue
Provide a reproducible test case that is the bare minimum necessary to generate the problem.'
Other info / logs
Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.
What component(s), interfaces, languages, and integrations does this bug affect?
Components
area/artifacts: Artifact stores and artifact loggingarea/build: Build and test infrastructure for MLflowarea/docs: MLflow documentation pagesarea/examples: Example codearea/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registryarea/models: MLmodel format, model serialization/deserialization, flavorsarea/projects: MLproject format, project running backendsarea/scoring: MLflow Model server, model deployment tools, Spark UDFsarea/server-infra: MLflow Tracking server backendarea/tracking: Tracking Service, tracking client APIs, autologgingInterface
area/uiux: Front-end, user experience, plotting, JavaScript, JavaScript dev serverarea/docker: Docker use across MLflow's components, such as MLflow Projects and MLflow Modelsarea/sqlalchemy: Use of SQLAlchemy in the Tracking Service or Model Registryarea/windows: Windows supportLanguage
language/r: R APIs and clientslanguage/java: Java APIs and clientslanguage/new: Proposals for new client languagesIntegrations
integrations/azure: Azure and Azure ML integrationsintegrations/sagemaker: SageMaker integrationsintegrations/databricks: Databricks integrations