Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blocking batch flow control belies async logging #701

Closed
benjaminp opened this issue Sep 30, 2021 · 5 comments
Closed

blocking batch flow control belies async logging #701

benjaminp opened this issue Sep 30, 2021 · 5 comments
Assignees
Labels
api: logging Issues related to the googleapis/java-logging API. lang: java Issues specific to Java. type: process A process-related concern. May include testing, release, or the like.

Comments

@benjaminp
Copy link

google-cloud-logging enables the blocking flow controller in the GAX batching library, going to lengths to modify the default gapic behavior:

BatchingSettings oldBatchSettings =
logBuilder.writeLogEntriesSettings().getBatchingSettings();
logBuilder
.writeLogEntriesSettings()
.setBatchingSettings(
oldBatchSettings
.toBuilder()
.setFlowControlSettings(
oldBatchSettings
.getFlowControlSettings()
.toBuilder()
.setLimitExceededBehavior(LimitExceededBehavior.Block)
.build())
.build());

The trouble with the blocking batch flow controller is that it can block LoggingImpl.writeAsync and thus any application code that happens to log after the flow controller is full. (That can happen either because of too much application logging or because of a slow-down in the logging service.) Preferable behavior would be dropping the log messages that cannot be uploaded and leaving a note about dropped messages in the next batch or stderr.

(This issue is notwithstanding a recent regression described in #632. That regression occludes the problematic behavior described here by removing the GAX batcher.)

@product-auto-label product-auto-label bot added the api: logging Issues related to the googleapis/java-logging API. label Sep 30, 2021
@minherz minherz added lang: java Issues specific to Java. type: process A process-related concern. May include testing, release, or the like. labels Sep 30, 2021
@minherz
Copy link
Contributor

minherz commented Sep 30, 2021

Hello, the gax batching logic cannot be controlled from the logging library because stubs are auto-generated. There is a planned work (ETA Q1'22) to migrate the batching logic from gax to the logging library. The batching configuration will be exposed to users avoiding discrepancies.
We will review the auto-generated code to ensure that its current version is synchronized with the settings of the gax-java.

@benjaminp
Copy link
Author

So, you're saying the code in the logging library I linked to in OP is a noop?

@minherz
Copy link
Contributor

minherz commented Oct 3, 2021

I'd confirmed that the code you referenced is not auto-generated. I understand your concern about being blocked although the blocking takes place until the current batch is sent, the default GAX behavior, throwing exception seems more dangerous since it can unexpectedly crash the application.
Other mechanisms for handling errors cannot be introduced until the batching logic will be transferred into the library (see #705)

@benjaminp
Copy link
Author

Thank you for the replies. It looks like implementing #705 would provide the behavior I desire.

@minherz
Copy link
Contributor

minherz commented Oct 4, 2021

One of its goals is to provide the control over batching configuration to the library users.

@minherz minherz closed this as completed Oct 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: logging Issues related to the googleapis/java-logging API. lang: java Issues specific to Java. type: process A process-related concern. May include testing, release, or the like.
Projects
None yet
Development

No branches or pull requests

3 participants