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

panic: runtime error: slice bounds out of range [:-1] #99

Open
makeconfig2017 opened this issue Jun 2, 2021 · 2 comments
Open

panic: runtime error: slice bounds out of range [:-1] #99

makeconfig2017 opened this issue Jun 2, 2021 · 2 comments

Comments

@makeconfig2017
Copy link

Describe the bug
While switching pg_stat_statements switch with 'x' getting panic:
panic: runtime error: slice bounds out of range [:-1]

goroutine 1 [running]:
github.com/lesovsky/pgcenter/top.printStatData(0xc0001bc2d0, 0x4000666666666666, 0x40087ae147ae147b, 0x40095c28f5c28f5c, 0x3c6d, 0x3bd, 0x1839, 0x1e83, 0x1dfd, 0x86, ...)
/home/runner/work/pgcenter/pgcenter/top/stat.go:394 +0x677
github.com/lesovsky/pgcenter/top.printDbstat(0xc0001bc2d0, 0xc0001241c0, 0x4000666666666666, 0x40087ae147ae147b, 0x40095c28f5c28f5c, 0x3c6d, 0x3bd, 0x1839, 0x1e83, 0x1dfd, ...)
/home/runner/work/pgcenter/pgcenter/top/stat.go:309 +0x14f
github.com/lesovsky/pgcenter/top.printStat.func1(0xc0001b2000, 0xc0001d79e0, 0x0)
/home/runner/work/pgcenter/pgcenter/top/stat.go:135 +0x73b
github.com/jroimartin/gocui.(*Gui).consumeevents(0xc0001b2000, 0xc0001d7b10, 0x0)
/home/runner/go/pkg/mod/github.com/jroimartin/gocui@v0.4.0/gui.go:399 +0x1b4
github.com/jroimartin/gocui.(*Gui).MainLoop(0xc0001b2000, 0x946418, 0x9b5380)
/home/runner/go/pkg/mod/github.com/jroimartin/gocui@v0.4.0/gui.go:381 +0x1fa
github.com/lesovsky/pgcenter/top.mainLoop(0x9b53b8, 0xc0000b8010, 0xc000100780, 0x0, 0xc0000b8530)
/home/runner/work/pgcenter/pgcenter/top/ui.go:45 +0x225
github.com/lesovsky/pgcenter/top.RunMain(0xc000120000, 0x0, 0x0)
/home/runner/work/pgcenter/pgcenter/top/top.go:30 +0x19b
github.com/lesovsky/pgcenter/cmd/top.glob..func1(0xc19f20, 0xc0000c67e0, 0x0, 0x2, 0x0, 0x0)
/home/runner/work/pgcenter/pgcenter/cmd/top/top.go:31 +0xc5
github.com/spf13/cobra.(*Command).execute(0xc19f20, 0xc0000c67c0, 0x2, 0x2, 0xc19f20, 0xc0000c67c0)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v0.0.3/command.go:762 +0x472
github.com/spf13/cobra.(*Command).ExecuteC(0xc1a180, 0xc00004e778, 0xc000093f78, 0x406365)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v0.0.3/command.go:852 +0x2fe
github.com/spf13/cobra.(*Command).Execute(...)
/home/runner/go/pkg/mod/github.com/spf13/cobra@v0.0.3/command.go:800
main.main()
/home/runner/work/pgcenter/pgcenter/cmd/pgcenter.go:62 +0x31

Environment
Describe the environment where the bug occurred.

  • OS: [NAME=Fedora
    VERSION="29 (Twenty Nine)"
    ID=fedora
    VERSION_ID=29
    VERSION_CODENAME=""
    PLATFORM_ID="platform:f29"
    PRETTY_NAME="Fedora 29 (Twenty Nine)"
    ANSI_COLOR="0;34"
    LOGO=fedora-logo-icon
    CPE_NAME="cpe:/o:fedoraproject:fedora:29"
    HOME_URL="https://fedoraproject.org/"
    DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f29/system-administrators-guide/"
    SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"
    BUG_REPORT_URL="https://bugzilla.redhat.com/"
    REDHAT_BUGZILLA_PRODUCT="Fedora"
    REDHAT_BUGZILLA_PRODUCT_VERSION=29
    REDHAT_SUPPORT_PRODUCT="Fedora"
    REDHAT_SUPPORT_PRODUCT_VERSION=29
    PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"]
  • pgCenter Version [pgcenter v0.8.0 df1cea5-release]
  • pgCenter installation method: [https://github.com/lesovsky/pgcenter/releases/tag/v0.8.0]
  • PostgreSQL Version [PostgreSQL 10.17 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2), 64-bit]

To Reproduce
Run pgcenter top
Switch pg_stat_statements with 'x'

Expected behavior
Switching pg_stat_statements

@lesovsky
Copy link
Owner

lesovsky commented Jun 2, 2021

Hmm, is this occur every time you press 'x' or randomly?

@lesovsky
Copy link
Owner

lesovsky commented Jun 2, 2021

Could you try to reproduce the issue using the master branch? This should be fixed here 9adb560.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants