Skip to content

When the Live API unexpectedly shuts down during communication, it fails to receive the callback for the connection closure. #914

@alinemeng

Description

@alinemeng

Environment details

  • Programming language: Java
  • OS: Linux/Windows
  • Language runtime version: 11
  • Package version: 1.46.0

Steps to reproduce

  1. Create a live API Session
  2. Start the conversation
  3. During the conversation, the connection unexpectedly disconnected
  4. The console printed an exception for the disconnection, but was unable to receive a message similar to GoAway

In the following class:com.google.genai.AsyncLive.GenAiWebSocketClient

        @Override
        public void onClose(int code, String reason, boolean remote) {
            logger.log(
                    Level.INFO,
                    "Live session closed with code: {0} and reason: {1}",
                    new Object[]{code, reason});
            if (!sessionFuture.isDone()) {
                sessionFuture.completeExceptionally(
                        new GenAiIOException("WebSocket closed unexpectedly: " + reason));
            }
        }

This sessionFuture is already in the "Done" state after the connection is successful. If the communication is unexpectedly terminated during the process, the client will not be able to receive the callback again.

Metadata

Metadata

Assignees

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.status:awaiting user responsetype: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions