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

[Bug] package upload will timeout when the package size is big #23547

Closed
3 tasks done
jiangpengcheng opened this issue Nov 4, 2024 · 0 comments · Fixed by #23548
Closed
3 tasks done

[Bug] package upload will timeout when the package size is big #23547

jiangpengcheng opened this issue Nov 4, 2024 · 0 comments · Fixed by #23548
Labels
type/bug The PR fixed a bug or issue reported a bug

Comments

@jiangpengcheng
Copy link
Contributor

jiangpengcheng commented Nov 4, 2024

Search before asking

  • I searched in the issues and found nothing similar.

Read release policy

  • I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.

Version

use the apachepulsar/pulsar:4.0.0 image, image index digest is: sha256:51e92bc45ba495b9753585b12625579ddaeea8e02d08aecd336ceff26e1099f1

Minimal reproduce step

  1. deploy pulsar using docker-compose, below is the compose yaml:
version: '3'
networks:
  pulsar:
    driver: bridge
services:
  # Start zookeeper
  zookeeper:
    image: apachepulsar/pulsar:4.0.0
    container_name: zookeeper
    restart: on-failure
    networks:
      - pulsar
    volumes:
      - ./data/zookeeper:/pulsar/data/zookeeper
    environment:
      - metadataStoreUrl=zk:zookeeper:2181
      - PULSAR_MEM=-Xms256m -Xmx256m -XX:MaxDirectMemorySize=256m
    command: >
      bash -c "bin/apply-config-from-env.py conf/zookeeper.conf && \
             bin/generate-zookeeper-config.sh conf/zookeeper.conf && \
             exec bin/pulsar zookeeper"
    healthcheck:
      test: ["CMD", "bin/pulsar-zookeeper-ruok.sh"]
      interval: 10s
      timeout: 5s
      retries: 30

  # Init cluster metadata
  pulsar-init:
    container_name: pulsar-init
    hostname: pulsar-init
    image: apachepulsar/pulsar:4.0.0
    networks:
      - pulsar
    command: >
      bin/pulsar initialize-cluster-metadata --cluster cluster-a --zookeeper zookeeper:2181 --configuration-store zookeeper:2181 --web-service-url http://broker:8080 --broker-service-url pulsar://broker:6650
    depends_on:
      zookeeper:
        condition: service_healthy

  # Start bookie
  bookie:
    image: apachepulsar/pulsar:4.0.0
    container_name: bookie
    restart: on-failure
    networks:
      - pulsar
    environment:
      - clusterName=cluster-a
      - zkServers=zookeeper:2181
      - metadataServiceUri=metadata-store:zk:zookeeper:2181
      # otherwise every time we run docker compose uo or down we fail to start due to Cookie
      # See: https://github.com/apache/bookkeeper/blob/405e72acf42bb1104296447ea8840d805094c787/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Cookie.java#L57-68
      - advertisedAddress=bookie
      - BOOKIE_MEM=-Xms512m -Xmx512m -XX:MaxDirectMemorySize=256m
    depends_on:
      zookeeper:
        condition: service_healthy
      pulsar-init:
        condition: service_completed_successfully
    # Map the local directory to the container to avoid bookie startup failure due to insufficient container disks.
    volumes:
      - ./data/bookkeeper:/pulsar/data/bookkeeper
    command: bash -c "bin/apply-config-from-env.py conf/bookkeeper.conf && exec bin/pulsar bookie"

  # Start broker
  broker:
    image: apachepulsar/pulsar:4.0.0
    container_name: broker
    hostname: broker
    restart: on-failure
    networks:
      - pulsar
    environment:
      - metadataStoreUrl=zk:zookeeper:2181
      - zookeeperServers=zookeeper:2181
      - clusterName=cluster-a
      - managedLedgerDefaultEnsembleSize=1
      - managedLedgerDefaultWriteQuorum=1
      - managedLedgerDefaultAckQuorum=1
      - advertisedAddress=broker
      - advertisedListeners=external:pulsar://127.0.0.1:6650
      - enablePackagesManagement=true
      - PULSAR_MEM=-Xms512m -Xmx512m -XX:MaxDirectMemorySize=256m
    depends_on:
      zookeeper:
        condition: service_healthy
      bookie:
        condition: service_started
    ports:
      - "6650:6650"
      - "8080:8080"
    command: bash -c "bin/apply-config-from-env.py conf/broker.conf && exec bin/pulsar broker"
  1. generate a 500MB file:
dd if=/dev/zero of=500MB_file bs=1M count=500
  1. upload this file to package service:
azureuser@dev-machie:~/pulsar$ ./bin/pulsar-admin packages upload --path ~/500MB_file --description "testing" function://public/default/test500

What did you expect to see?

The package 'function://public/default/test500' uploaded from path '/home/azureuser/500MB_file' successfully

What did you see instead?

null
Reason: java.util.concurrent.CompletionException: java.util.concurrent.TimeoutException: Read timeout to localhost/127.0.0.1:8080 after 60000 ms

Anything else?

The reason is that the DLOutputStream will read 8192 bytes each time, and write them to bk, so for a 500 MB file, it will write:

500 * 1024 * 1024 / 8192.0 = 64000.0 times

which leads to timeout

This error also happened in branch-3.0 and 3.3

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@jiangpengcheng jiangpengcheng added the type/bug The PR fixed a bug or issue reported a bug label Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant