Skip to content

Panic - Index out of range #144

Open
@nikooo777

Description

@nikooo777

I was running a script to populate a minio bucket locally using the following script:

#!/bin/bash

db_file='db.sqlite'
bucket='local/reflector'

export bucket

copy_to_s3() {
  blob_hash=$1
  mc cp blob "${bucket}/${blob_hash}"
}

export -f copy_to_s3

sqlite3 -list -noheader "$db_file" "SELECT blob_hash FROM blobs" | xargs -I {} -P 16 bash -c 'copy_to_s3 "$@"' _ {}

the database contains 80k entries with random strings (hashes). for each single hash (you can just randomly generate them) it copies a small text file to the S3 bucket locally using the mc client

I suppose that the script causes some sort of race condition while printing to the terminal (using colors).

see this screenshot for when it happened: https://scrn.storni.info/2023-07-26_00-59-21-324108027.png

panic: runtime error: index out of range [2] with length 2

goroutine 1 [running]:
github.com/muesli/termenv.xTermColor({0xc000162240, 0x18})
        github.com/muesli/[email protected]/color.go:139 +0x394
github.com/muesli/termenv.Output.backgroundColor({0x0, {0x14a1d40, 0xc000116008}, {0x14a5678, 0x1d46250}, 0x0, 0x0, 0x0, 0xc00023ebe0, {0x14a2920, ...}, ...})
        github.com/muesli/[email protected]/termenv_unix.go:93 +0x4f
github.com/muesli/termenv.(*Output).BackgroundColor.func1()
        github.com/muesli/[email protected]/output.go:162 +0x78
github.com/muesli/termenv.(*Output).BackgroundColor(0xc000118c00)
        github.com/muesli/[email protected]/output.go:168 +0x64
github.com/muesli/termenv.(*Output).HasDarkBackground(0x40a84d?)
        github.com/muesli/[email protected]/output.go:176 +0x19
github.com/charmbracelet/lipgloss.(*Renderer).HasDarkBackground(...)
        github.com/charmbracelet/[email protected]/renderer.go:116
github.com/charmbracelet/lipgloss.AdaptiveColor.color({{0x1281f5f?, 0x112d560?}, {0x1281ccd?, 0x1?}}, 0x1d0d9d0?)
        github.com/charmbracelet/[email protected]/color.go:100 +0x51
github.com/charmbracelet/lipgloss.Style.Render({0x1d0d9d0?, 0xc0004e6060?, {0x127d528?, 0xc0004e6060?}}, {0x0?, 0xc0004c1b00?, 0x1199340?})
        github.com/charmbracelet/[email protected]/style.go:257 +0x1302
github.com/charmbracelet/lipgloss.Style.String({0x1d0d9d0?, 0xc0004e6060?, {0x127d528?, 0x3?}})
        github.com/charmbracelet/[email protected]/style.go:127 +0x30
github.com/minio/mc/cmd.init()
        github.com/minio/mc/cmd/replicate-backlog.go:442 +0x7cf9

I'm on Kubuntu 22.04 using konsole 21.12.3 if that helps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions