Skip to content

funasr support payload.input and bug fix in transcription#230

Closed
songguocola wants to merge 2 commits into
dashscope:mainfrom
songguocola:dev/audio_0618
Closed

funasr support payload.input and bug fix in transcription#230
songguocola wants to merge 2 commits into
dashscope:mainfrom
songguocola:dev/audio_0618

Conversation

@songguocola

Copy link
Copy Markdown
Contributor

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines 156 to 160
try {
Thread.sleep(waitMilliseconds);
} catch (InterruptedException ignored) {
Thread.sleep(sleepMs);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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);
          }

@songguocola songguocola deleted the dev/audio_0618 branch June 16, 2026 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant