fluent-bit icon indicating copy to clipboard operation
fluent-bit copied to clipboard

rpc error: code = ResourceExhausted desc = grpc: received message larger than max

Open ThomasFOC opened this issue 2 years ago • 4 comments

Bug Report

Describe the bug While using Fluent Bit together with Grafana Loki we encountered the following error when upgrading Grafana Loki:

level=error ts=2023-12-29T15:17:28.289720182Z caller=scheduler_processor.go:208 org_id=fake traceID=5755a56f67e932c3 frontend=172.23.0.5:9095 msg="error notifying frontend about finished query" err="rpc error: code = ResourceExhausted desc = grpc: received message larger than max (4307377 vs. 4194304)"

These messages were printed on the Grafana Loki side and only in the first view seconds on startup. On the side of Grafana Loki we found the following issue:

https://github.com/grafana/loki/issues/2271

As the messages are sent by Fluent Bit and there is a dedicated support for Grafana Loki through the Loki Output Plugin we investigated further into Fluent Bit.

To Reproduce As it seems to be connected to the log messages and their size, it was difficult to debug the reason for this error. The following setup may reproduce the error nevertheless. We use Docker to set up the situation with the provided configurations:

docker-compose.yml

services:
  fluent-bit:
    image: "fluent/fluent-bit:2.2.1"
    restart: unless-stopped
    volumes:
      - ./fluent-bit/:/fluent-bit/etc/

  loki:
    image: "grafana/loki:2.9.3"
    restart: unless-stopped
    ports:
      - "3100:3100"
    volumes:
      - ./loki/:/etc/loki/

fluent-bit/fluent-bit.conf

[INPUT]
    name   dummy
    dummy  {"message":"01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"} # Length of message may be important.
    copies 25000 # Number of messages may be important.

[OUTPUT]
    name   loki
    host   loki
    match  *

loki/local-config.yaml

auth_enabled: false

server:
  http_listen_port: 3100
  grpc_listen_port: 9096

common:
  instance_addr: 127.0.0.1
  path_prefix: /tmp/loki
  storage:
    filesystem:
      chunks_directory: /tmp/loki/chunks
      rules_directory: /tmp/loki/rules
  replication_factor: 1
  ring:
    kvstore:
      store: inmemory

query_range:
  results_cache:
    cache:
      embedded_cache:
        enabled: true
        max_size_mb: 100

schema_config:
  configs:
    - from: 2020-10-24
      store: boltdb-shipper
      object_store: filesystem
      schema: v11
      index:
        prefix: index_
        period: 24h

analytics:
  reporting_enabled: false

We use the sample Grafana Loki configuration from raw.githubusercontent.com/grafana/loki/v2.9.1/cmd/loki/loki-local-config.yaml.

When starting the Docker Compose Stack (docker compose up -d) we receive the following error messages:

fluent-bit-1  | rpc error: code = ResourceExhausted desc = grpc: received message larger than max (4350036 vs. 4194304)
loki-1        | level=warn ts=2024-01-05T13:48:22.381526758Z caller=logging.go:123 traceID=7891e1a5548831c4 orgID=fake msg="POST /loki/api/v1/push (500) 136.644694ms Response: \"rpc error: code = ResourceExhausted desc = grpc: received message larger than max (4350036 vs. 4194304)\\n\" ws: false; Connection: keep-alive; Content-Length: 4625056; Content-Type: application/json; User-Agent: Fluent-Bit; "

Expected behavior While reproducing the issue, the following error message was present, when using larger sizes of the message:

fluent-bit-1  | [2024/01/05 13:40:28] [error] [output:loki:loki.0] loki:3100, HTTP status=429
fluent-bit-1  | Ingestion rate limit exceeded for user fake (limit: 4194304 bytes/sec) while attempting to ingest '25000' lines totaling '4225000' bytes, reduce log volume or contact your Loki administrator to see if the limit can be increased

It does look as if there are already fail-safes in place. They do not seem to work in this specific situation.

Your Environment

  • Version used: 2.2.1
  • Configuration: see above
  • Environment name and version (e.g. Kubernetes? What version?): Client: Docker Engine - Community - Version: 24.0.7
  • Server type and version: Docker installation
  • Operating System and version: Docker installation
  • Filters and plugins: INPUT: dummy, OUTPUT: loki

Additional context As there may get log messages lost due to the chunk size, maybe there is a solution to this issue. Our suggestion is, in some cases, the chunks are too small to trigger Grafana Loki's rate limit but are too large to be ingested by Grafana Loki.

ThomasFOC avatar Jan 05 '24 14:01 ThomasFOC

the exactly same issue

dongnak avatar Jan 10 '24 07:01 dongnak

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days. Maintainers can add the exempt-stale label.

github-actions[bot] avatar Apr 11 '24 01:04 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar Apr 17 '24 01:04 github-actions[bot]

not stale the bug is still here

jehutyy avatar Aug 08 '24 09:08 jehutyy