opensearch-project/OpenSearch
Voir sur GitHub[BUG] Server errors propagated with index creation requests
Open
#7 096 ouverte le 11 avr. 2023
Indexingbuggood first issue
Métriques du dépôt
- Stars
- (8 123 stars)
- Métriques de merge PR
- (Merge moyen 5j 9h) (266 PRs mergées en 30 j)
Description
Describe the bug
Server errors within OpenSearch are exposed to the client when trying to create an index under certain conditions.
Condition 1: When the request body is numeric
PUT /testindex7?pretty HTTP/1.1
Host: ...
User-Agent: curl/7.86.0
Authorization: Basic [...]
Content-Type: application/json
Accept: application/xml
Connection: close
Content-Length: 1
0
Response:
HTTP/1.1 500 Internal Server Error
content-type: application/json; charset=UTF-8
content-length: 390
{
"error" : {
"root_cause" : [
{
"type" : "not_x_content_exception",
"reason" : "Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"
}
],
"type" : "not_x_content_exception",
"reason" : "Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"
},
"status" : 500
}
Condition 2: When cluster manager is unavailable Response:
HTTP/1.1 503 Service Unavailable
content-type: application/json; charset=UTF-8
content-length: 246
{
"error" : {
"root_cause" : [
{
"type" : "cluster_manager_not_discovered_exception",
"reason" : null
}
],
"type" : "cluster_manager_not_discovered_exception",
"reason" : null
},
"status" : 503
}
To Reproduce Steps to reproduce the behavior:
- Create an index with the above conditions
Expected behavior
- The response should abstract out the underlying reason for failure by sending a
400 (Bad Request)response back to the client - This behavior can be made configurable where setting a property on the server disables or enables the stack trace and detailed response
Host/Environment (please complete the following information):
- OS: AL2
Additional context
- N/A