funasr support payload.input and bug fix in transcription#230
funasr support payload.input and bug fix in transcription#230songguocola wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces timeout support for asynchronous task waiting across several classes, including AsynchronousApi, Transcription, and QwenTranscription, by adding a timeoutSeconds parameter. It also adds input mapping and custom WebSocket URL configuration to the audio recognition classes. A critical issue was identified in AsynchronousApi.java where catching InterruptedException and restoring the interrupt status inside a while(true) loop without exiting will cause subsequent iterations to immediately throw InterruptedException, leading to an infinite loop and high CPU usage. It is recommended to propagate the exception or break the loop.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| try { | ||
| Thread.sleep(waitMilliseconds); | ||
| } catch (InterruptedException ignored) { | ||
| Thread.sleep(sleepMs); | ||
| } catch (InterruptedException e) { | ||
| Thread.currentThread().interrupt(); | ||
| } |
There was a problem hiding this comment.
When Thread.sleep(sleepMs) is interrupted, it throws an InterruptedException and clears the thread's interrupted status. In the catch block, calling Thread.currentThread().interrupt() sets the interrupted status back to true.
However, because this is inside a while (true) loop and there is no break, return, or exception thrown to exit the loop, the loop will continue to the next iteration. In the next iteration, when Thread.sleep is called again, it will immediately throw InterruptedException because the interrupted status is set. This creates an infinite loop that spins rapidly, consuming 100% CPU and repeatedly calling client.send(req) without any delay, effectively spamming the server.
To fix this, you should propagate the interruption by throwing an ApiException (which is already declared in the method signature) or breaking out of the loop.
try {
Thread.sleep(sleepMs);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new ApiException(e);
}
No description provided.