Aias00 opened a new issue, #6842:
URL: https://github.com/apache/shenyu/issues/6842

   ## Description
   `HttpSyncDataService.doLongPolling` does `JsonElement element = 
responseFromServer.get("data")` which returns null when the `"data"` key is 
absent (Gson `JsonObject.get` returns null for missing keys, distinct from 
`JsonNull`). The next line `element.isJsonNull()` dereferences null → NPE. If 
the response body is empty/`"null"`, `fromJson(...)` returns null at `:239` and 
`responseFromServer.get("data")` NPEs on the null `JsonObject`.
   
   ## Location
   - 
`shenyu-sync-data-center/shenyu-sync-data-http/src/main/java/org/apache/shenyu/sync/data/http/HttpSyncDataService.java:239-244`
   
   ## Impact
   A non-standard admin response (e.g. `{"code":500,"message":"error"}` without 
`"data"`) crashes the long-polling thread with NPE; retries hit the same NPE 
for 10 attempts (50 s) then sleep 5 min, stalling config sync.
   
   ## Suggested fix
   Null-check `responseFromServer` and `element` before use; treat missing/null 
data as "no change".
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to