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

Top is not working when starting using docker #87

Open
strav66 opened this issue Mar 4, 2021 · 20 comments
Open

Top is not working when starting using docker #87

strav66 opened this issue Mar 4, 2021 · 20 comments

Comments

@strav66
Copy link

strav66 commented Mar 4, 2021

Docker postgrespro-standard work in centos 8.3

pgcenter 0.6.6 work in docker

docker exec -it srv-db-APSD-VO pgcenter --version
pgcenter v0.6.6 4f87424-master
docker exec -it srv-db-APSD-VO pgcenter top

изображение

pgcenter 0.7.0 not work docker:

docker exec -it srv-db-APSD-VO /opt/pgpro/data/pgcenter --version
pgcenter v0.7.0 45c8bf0d0098f377692be886691eba9ee6005808-release
docker exec -it srv-db-APSD-VO /opt/pgpro/data/pgcenter top -h localhost
panic: send on closed channel

goroutine 65 [running]:
github.com/lesovsky/pgcenter/top.collectStat(0x9e5620, 0xc000138c40, 0xc000122080, 0xc000382000, 0xc0001281e0)
        /home/runner/work/pgcenter/pgcenter/top/stat.go:57 +0x371
github.com/lesovsky/pgcenter/top.doWork.func1(0x9e5620, 0xc000138c40, 0xc000148000, 0xc000382000, 0xc000380000)
        /home/runner/work/pgcenter/pgcenter/top/ui.go:77 +0x65
created by github.com/lesovsky/pgcenter/top.doWork
        /home/runner/work/pgcenter/pgcenter/top/ui.go:76 +0xeb
@lesovsky
Copy link
Owner

lesovsky commented Mar 4, 2021

Hi, thanks for report,
What docker image is used?

@strav66
Copy link
Author

strav66 commented Mar 4, 2021

my build docker

Dockerfile.zip

@lesovsky
Copy link
Owner

lesovsky commented Mar 4, 2021

What happen if run container and then run pgcenter being inside?
Like:

docker run --rm -ti IMAGE /bin/bash
pgcenter top ...

@strav66
Copy link
Author

strav66 commented Mar 4, 2021

Работает, но странно:
/opt/pgpro/data/pgcenter top -h localhost

изображение

нет статистики: процессор, память и т.д.

Если запускать так (внутри docker):
/opt/pgpro/data/pgcenter top

тогда ругается:
failed to connect to host=/var/run/postgresql user=postgres database=: dial error (dial unix /var/run/postgresql/.s.PGSQL.5432: connect: no such file or directory)

для 0.6.6 соответственно:
pgcenter top -h localhost

изображение

pgcenter top

изображение

Всё отлично и со статистикой

@lesovsky
Copy link
Owner

lesovsky commented Mar 4, 2021

I tested various cases using different docker images and bug reproduced in most of cases. Sometimes pgcenter starts as expected but at next, the same attempt it crashed again (even 0.6.6 might hang with black screen). I suspect there something related to UI processing when docker starts, but need to dig deeper.
I changed the title of the issue to reflect the problem more precisely.

Also I strongly recommended to avoid using national languages and post comments using English.

@lesovsky lesovsky changed the title Not work in centos 8.3 docker postgrespro-standard Top is not working when starting using docker Mar 4, 2021
@strav66
Copy link
Author

strav66 commented Mar 4, 2021

OK

tried 10 times sequentially run pgcenter 0.7.0:
docker exec -it srv-db-APSD-VO /opt/pgpro/data/pgcenter top -h localhost
6 times started with errors, 4 times - ok (but without CPU statistics, etc.)

error:
panic: send on closed channel

goroutine 53 [running]:
github.com/lesovsky/pgcenter/top.collectStat(0x9e5620, 0xc000310040, 0xc000122080, 0xc000326000, 0xc0001281e0)
/home/runner/work/pgcenter/pgcenter/top/stat.go:57 +0x371
github.com/lesovsky/pgcenter/top.doWork.func1(0x9e5620, 0xc000310040, 0xc000140000, 0xc000326000, 0xc000318010)
/home/runner/work/pgcenter/pgcenter/top/ui.go:77 +0x65
created by github.com/lesovsky/pgcenter/top.doWork
/home/runner/work/pgcenter/pgcenter/top/ui.go:76 +0xeb

pgcentert 0.6.6 - never broke (maybe I was just lucky)

@lesovsky
Copy link
Owner

lesovsky commented Mar 8, 2021

Hi,
check out new v0.8.0 release, both issues related to absence of stats and panic are fixed. Waiting for testing and feedback.

@strav66
Copy link
Author

strav66 commented Mar 9, 2021

pgcenter 0.8.0 works fine!

изображение

@strav66
Copy link
Author

strav66 commented Mar 9, 2021

Addition:
when exiting (closing pgcenter) an error occurs:

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

goroutine 49 [running]:
github.com/nsf/termbox-go.Init.func1()
        /home/runner/go/pkg/mod/github.com/nsf/termbox-go@v0.0.0-20180819125858-b66b20ab708e/api.go:95 +0x36a
created by github.com/nsf/termbox-go.Init
        /home/runner/go/pkg/mod/github.com/nsf/termbox-go@v0.0.0-20180819125858-b66b20ab708e/api.go:84 +0x730

@lesovsky
Copy link
Owner

lesovsky commented Mar 9, 2021

Panic occurs at every time or spontaneously? What docker image do you use?
Try to reproduce error using lesovsky/pgcenter:v0.8.0 image.

@strav66
Copy link
Author

strav66 commented Mar 9, 2021

Panic occurs at every time or spontaneously?

spontaneously

What docker image do you use?

my docker image

@lesovsky
Copy link
Owner

lesovsky commented Mar 9, 2021

What about attempt to reproduce using lesovsky/pgcenter:v0.8.0 image?

my docker image

It is insufficient information, provide more details... base image, full command definition of how pgcenter was started (including docker opts).

@strav66
Copy link
Author

strav66 commented Mar 9, 2021

What about attempt to reproduce using lesovsky/pgcenter:v0.8.0 image?

tried lesovsky / pgcenter: v0.8.0 image
The error was not reproduced

but it is not possible to use the name localhost with it!
I think the error is related to localhost

my docker image

#87 (comment)

It is insufficient information, provide more details... base image, full command definition of how pgcenter was started (including docker opts).

docker runs via docker-compose (docker-compose.yml.tar.gz):
docker-compose up -d

pgcenter upload volume PGDATA
run pgcenter and connect to a running docker with the command:

docker exec -it srv-db1C-ERP /opt/pgpro/data/pgcenter top -h localhost

after a few minutes (3-4), sometimes an error occurs (pgcenter continues to work!):

kernel:unregister_netdevice: waiting for lo to become free. Usage count = 1

If it is ok to exit pgcenter (with the q key) the message appears:

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

goroutine 49 [running]:
github.com/nsf/termbox-go.Init.func1()
        /home/runner/go/pkg/mod/github.com/nsf/termbox-go@v0.0.0-20180819125858-b66b20ab708e/api.go:95 +0x36a
created by github.com/nsf/termbox-go.Init
        /home/runner/go/pkg/mod/github.com/nsf/termbox-go@v0.0.0-20180819125858-b66b20ab708e/api.go:84 +0x730


@lesovsky
Copy link
Owner

lesovsky commented Mar 9, 2021

Trying to build the image, need the values of variables from docker-compose:

    build:
      context: ../docker/postgrespro-standard

      dockerfile: Dockerfile.${PG_Version}
      args: 
        - SERVER_VERSION=${PG_Version}
        - SERVER_VERSION_DOT=${PG_Version_dot}
        - KEYS_DOT=${rpm_keys_dot}

No need SERVER_VERSION, but need other values of SERVER_VERSION_DOT, KEYS_DOT and maybe content of ../docker/postgrespro-standard (but not sure).

@strav66
Copy link
Author

strav66 commented Mar 9, 2021

If you carefully look at the attached archive (docker-compose.yml.tar.gz), you can see the .env file in which the necessary variables are registered

@lesovsky
Copy link
Owner

lesovsky commented Mar 9, 2021

Oh, hidden file ))) yep, found now

@lesovsky
Copy link
Owner

lesovsky commented Mar 9, 2021

Both ways failed due to necessary files are not exist.

  1. using docker-compose build
docker-compose build
ERROR: build path /tmp/docker/postgrespro-standard either does not exist, is not accessible, or is not a valid URL
  1. manual docker build also fails
docker build --build-arg SERVER_VERSION=12 --build-arg SERVER_VERSION_DOT=6.1 --build-arg KEYS_DOT=0.3 -t local/pg1c:dev -f Dockerfile.10 .
... too many lines ...
COPY failed: file not found in build context or excluded by .dockerignore: stat container/docker-entrypoint.sh: file does not exist

Also such files are not found in attached archives. Maybe you just build and publish the image on DockerHub?

@strav66
Copy link
Author

strav66 commented Mar 9, 2021

Complete set of everything you need for build image
docker-compose-build.tar.gz

Unpack it into some folder
go to the ERP folder
we give the command:

docker-compose build

Profit

@lesovsky
Copy link
Owner

lesovsky commented Mar 9, 2021

Thanks, build successful.

Upd. I've just updated pgcenter download links in Dockerfiles, from 0.6.x to 0.8.0.

@lesovsky
Copy link
Owner

Spent a quite lot of time for testing and could not reproduce the panic at quit. Also I have no idea how to catch this using unit-tests.

Would like to clarify, are you sure you build the image with proper version of pgcenter (v0.8.0)? Because I manually changed pgcenter's version in your files before build. Maybe you catch error with old version (the similarly as it was here)?

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