mirror of https://github.com/apache/druid.git
Fix missing task failure error message on Overlord caused by MessageBodyWriter not found error on Middle Manager (#15412)
Fixes missing task failure error message on Overlord. The error message was missing since TaskManagementResource#assignTask API wasn't annotated with @Produces(MediaType.APPLICATION_JSON) resulting in the response being treated as application/octet-stream, that in turn lead to MessageBodyWriter not found error on the middle manager. The exception is not logged on the middle manager itself since it happens even before entering the assignTask function -- while mapping arg Task -> MSQControllerTask.
This commit is contained in:
parent
75d6993da9
commit
4ab0b71513
|
@ -203,13 +203,19 @@ public class TaskManagementResource
|
|||
@POST
|
||||
@Path("/assignTask")
|
||||
@Consumes({MediaType.APPLICATION_JSON, SmileMediaTypes.APPLICATION_JACKSON_SMILE})
|
||||
@Produces({MediaType.APPLICATION_JSON, SmileMediaTypes.APPLICATION_JACKSON_SMILE})
|
||||
public Response assignTask(Task task)
|
||||
{
|
||||
// Sometimes assignTask API can fail when the supplied task arg can't be interpreted due to some missing extension(s).
|
||||
// In such cases, the call produces an error response without entering the function.
|
||||
// @Produces helps to correctly write back this error response as JSON which otherwise ends up in an empty response
|
||||
// message due to "MessageBodyWriter not found for SingletonImmutableBiMap" error.
|
||||
// Ref: https://github.com/apache/druid/pull/15412.
|
||||
try {
|
||||
workerTaskManager.assignTask(task);
|
||||
return Response.ok().build();
|
||||
}
|
||||
catch (RuntimeException ex) {
|
||||
catch (Exception ex) {
|
||||
return Response.serverError().entity(ex.getMessage()).build();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue