This is an automated email from the ASF dual-hosted git repository.

abhishek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/master by this push:
     new 4ab0b715131 Fix missing task failure error message on Overlord caused 
by MessageBodyWriter not found error on Middle Manager (#15412)
4ab0b715131 is described below

commit 4ab0b71513132e6cef38483253aeaeacb84a15e7
Author: Vishesh Garg <[email protected]>
AuthorDate: Fri Nov 24 11:35:56 2023 +0530

    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.
---
 .../apache/druid/indexing/worker/http/TaskManagementResource.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/indexing-service/src/main/java/org/apache/druid/indexing/worker/http/TaskManagementResource.java
 
b/indexing-service/src/main/java/org/apache/druid/indexing/worker/http/TaskManagementResource.java
index fc6d6dc2381..4c2e9237a81 100644
--- 
a/indexing-service/src/main/java/org/apache/druid/indexing/worker/http/TaskManagementResource.java
+++ 
b/indexing-service/src/main/java/org/apache/druid/indexing/worker/http/TaskManagementResource.java
@@ -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();
     }
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to