Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Federated setup broken since RELEASE.2024-10-02T17-50-41Z #21541

@mannreis

Description

@mannreis

When trying the federated setup, the last working version is RELEASE.2024-09-22T00-33-43Z

Expected Behavior

Current Behavior

The server panics when running github.com/minio/minio/internal/config/dns.msgUnPath because a single word is passed. The issue was introduced in a84cbab where the where msgUnPath was rewritten and it's behaviour changed. Before it was simply swapping the segments of the splitted string, whereas now it is also skipping the first one (/skydns).

Possible Solution

Reverting the implementation of the function seems to work on the setup I use below. ✔️

I'll open a PR to adjust the unit tests and restore the behaviour of msgUnPath()

Steps to Reproduce (for bugs)

Comparing versions RELEASE.2024-09-22T00-33-43Z with RELEASE.2024-10-02T17-50-41Z using docker:

services:
  etcd-server:
    image: quay.io/coreos/etcd:v3.5.9
    container_name: etcd-server
    hostname: etcd-server
    ports:
      - "2379:2379"
    command: >
      /usr/local/bin/etcd
      --name etcd0
      --listen-client-urls http://0.0.0.0:2379
      --advertise-client-urls http://0.0.0.0:2379
    networks:
      minio-net:
        ipv4_address: 172.28.0.10
        aliases:
          - etcd-server

  cluster1:
    image: minio/minio:${VERSION:-RELEASE.2024-09-22T00-33-43Z}
    container_name: cluster1
    hostname: cluster1.local
    environment:
      MINIO_ETCD_ENDPOINTS: http://etcd-server:2379
      MINIO_ETCD_COREDNS_PATH: /skydns
      MINIO_DOMAIN: local
      MINIO_PUBLIC_IPS: 172.28.0.11
      MINIO_ROOT_USER: minioadmin
      MINIO_ROOT_PASSWORD: minioadmin
    command: ["server", "http://cluster1.local/data/disk{1...4}"]
    ports:
      - "9001:9000"   # API
      - "9010:9001"   # Console
    networks:
      minio-net:
        ipv4_address: 172.28.0.11
        aliases:
          - cluster1.local

  cluster2:
    image: minio/minio:${VERSION:-RELEASE.2024-09-22T00-33-43Z}
    container_name: cluster2
    hostname: cluster2.local
    environment:
      MINIO_ETCD_ENDPOINTS: http://etcd-server:2379
      MINIO_ETCD_COREDNS_PATH: /skydns
      MINIO_DOMAIN: local
      MINIO_PUBLIC_IPS: 172.28.0.12
      MINIO_ROOT_USER: minioadmin
      MINIO_ROOT_PASSWORD: minioadmin
    command: ["server", "http://cluster2.local/data/disk{1...4}"]
    ports:
      - "9002:9000"   # API
      - "9012:9001"   # Console
    networks:
      minio-net:
        ipv4_address: 172.28.0.12
        aliases:
          - cluster2.local

networks:
  minio-net:
    driver: bridge
    ipam:
      config:
        - subnet: 172.28.0.0/16

Running the faulty release (by default 2024-09-22T00-33-43Z is used):

VERSION=RELEASE.2024-10-02T17-50-41Z docker-compose  up --build --force-recreate

And running the script, should cause mc: <ERROR> Unable to list folder. We encountered an internal error, please try again.

set -e
ENDPOINT_1="http://localhost:9001"
ENDPOINT_2="http://localhost:9002"
mc alias set cluster1 ${ENDPOINT_1} minioadmin minioadmin
mc alias set cluster2 ${ENDPOINT_2} minioadmin minioadmin
mc admin user add cluster1 testuser1 passuser1
mc admin policy attach cluster1 readwrite --user testuser1
mc alias set minio1 ${ENDPOINT_1} testuser1 passuser1
mc mb minio1/bucket1 || true
mc admin user add cluster2 testuser2 passuser2
mc admin policy attach cluster2 readwrite --user testuser2
mc alias set minio2 ${ENDPOINT_2} testuser2 passuser2
mc mb minio2/bucket2 || truemc ls minio1/
mc ls minio2/
echo 'hi!' | mc pipe minio1/bucket1/test.txt
echo 'bye!' | mc pipe minio2/bucket2/test.txt
mc cat minio1/bucket1/test.txt
mc cat minio1/bucket2/test.txt
mc cat minio2/bucket1/test.txt
mc cat minio2/bucket2/test.txt 

on the server logs

cluster1     | ERRO: panic: "GET /": runtime error: slice bounds out of range [1:0]
cluster1     | goroutine 1016 [running]:
cluster1     | runtime/debug.Stack()
cluster1     |  runtime/debug/stack.go:24 +0x5e
cluster1     | github.com/minio/minio/cmd.serverMain.func9.setCriticalErrorHandler.2.1()
cluster1     |  github.com/minio/minio/cmd/generic-handlers.go:571 +0x99
cluster1     | panic({0x2cd1040?, 0xc002b88900?})
cluster1     |  runtime/panic.go:770 +0x132
cluster1     | github.com/minio/minio/internal/config/dns.msgUnPath({0xc0011cb11e?, 0xc0011cb020?})
...

Context

Regression

Your Environment

  • Version used (minio --version):
  • Server setup and configuration:
  • Operating System and version (uname -a):

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions