Server errors and restarts after Docker rebuild #9868

Closed
opened 2025-11-02 08:51:52 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @babinos87 on GitHub (Nov 21, 2022).

Description

I am using the Docker setup on an arm64 processor. Setting up and spawning server and postgres containers work great. I am able to setup gitea etc.

The problem arises after I rebuild docker (stop and build the compose again). I get the below error on the server:

Server listening on :: port 22.
Server listening on 0.0.0.0 port 22.
2022/11/21 23:02:26 cmd/web.go:106:runWeb() [I] Starting Gitea on PID: 17
2022/11/21 23:02:26 cmd/web.go:95:func1() [F] PANIC: runtime error: index out of range [2] with length 2
	/usr/local/go/src/runtime/panic.go:89 (0x43d71b)
	/usr/local/go/src/encoding/base64/base64.go:360 (0x58b7f7)
	/usr/local/go/src/encoding/base64/base64.go:528 (0x58c51f)
	/go/src/code.gitea.io/gitea/modules/setting/lfs.go:55 (0x96f637)
	/go/src/code.gitea.io/gitea/modules/setting/setting.go:953 (0x9808eb)
	/go/src/code.gitea.io/gitea/modules/setting/setting.go:583 (0x1fae86b)
	/go/src/code.gitea.io/gitea/routers/install/setting.go:19 (0x1fae85c)
	/go/src/code.gitea.io/gitea/cmd/web.go:116 (0x20744a3)
	/go/pkg/mod/github.com/urfave/cli@v1.22.9/app.go:524 (0x1a6387b)
	/go/pkg/mod/github.com/urfave/cli@v1.22.9/command.go:173 (0x1a644b3)
	/go/pkg/mod/github.com/urfave/cli@v1.22.9/app.go:277 (0x1a6169f)
	/go/src/code.gitea.io/gitea/main.go:116 (0x20ad027)
	/usr/local/go/src/runtime/proc.go:250 (0x442587)
	/usr/local/go/src/runtime/asm_arm64.s:1270 (0x473cc3)
	
Received signal 15; terminating.
Server listening on :: port 22.
Server listening on 0.0.0.0 port 22.
2022/11/21 23:03:27 cmd/web.go:106:runWeb() [I] Starting Gitea on PID: 17
2022/11/21 23:03:27 ...eful/manager_unix.go:158:handleSignals() [W] [637c03bf-4] PID: 17. Background context for manager closed - context canceled - Shutting down...
2022/11/21 23:03:27 cmd/web.go:95:func1() [F] PANIC: runtime error: index out of range [2] with length 2
	/usr/local/go/src/runtime/panic.go:89 (0x43d71b)
	/usr/local/go/src/encoding/base64/base64.go:360 (0x58b7f7)
	/usr/local/go/src/encoding/base64/base64.go:528 (0x58c51f)
	/go/src/code.gitea.io/gitea/modules/setting/lfs.go:55 (0x96f637)
	/go/src/code.gitea.io/gitea/modules/setting/setting.go:953 (0x9808eb)
	/go/src/code.gitea.io/gitea/modules/setting/setting.go:583 (0x1fae86b)
	/go/src/code.gitea.io/gitea/routers/install/setting.go:19 (0x1fae85c)
	/go/src/code.gitea.io/gitea/cmd/web.go:116 (0x20744a3)
	/go/pkg/mod/github.com/urfave/cli@v1.22.9/app.go:524 (0x1a6387b)
	/go/pkg/mod/github.com/urfave/cli@v1.22.9/command.go:173 (0x1a644b3)
	/go/pkg/mod/github.com/urfave/cli@v1.22.9/app.go:277 (0x1a6169f)
	/go/src/code.gitea.io/gitea/main.go:116 (0x20ad027)
	/usr/local/go/src/runtime/proc.go:250 (0x442587)
	/usr/local/go/src/runtime/asm_arm64.s:1270 (0x473cc3)
	
Received signal 15; terminating.

No idea how to fix this. If I delete the volume and rebuild the containers, it works, but then all my repos are gone, this is not ideal.

Any ideas what the issue is, or at least how I can troubleshot that?

I have posted how I run gitea in below section of the form.

Thanks!

Gitea Version

1.17

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

2.30.2

Operating System

Raspberry Pi OS 64 bit

How are you running Gitea?

Below is my docker-compose:

version: "3.8"

services:
  gitea-server:
    build:
      context: .
      dockerfile: gitea.Dockerfile  # This just uses official image, no other commands running apart from a useless COPY of certificates
    container_name: gitea_server
    depends_on:
      - postgres-db
    env_file: .prod-server.env
    networks:
      - gitea
    ports:
      - "3033:3033"
      - "2202:22"
    restart: always
    volumes:
      - type: volume
        source: gitea_server_data
        target: /data
      - type: bind
        source: ./cert
        target: /ssl-certs
        read_only: true
      - type: bind
        source: /etc/timezone
        target: /etc/timezone
        read_only: true
      - type: bind
        source: /etc/localtime
        target: /etc/localtime
        read_only: true

  postgres-db:
    image: postgres:14.6
    container_name: gitea_postgres
    command:
      postgres -c config_file=/etc/postgresql.conf   # nothing special here, default config
    env_file: .prod-postgres.env
    networks:
      - gitea
    ports:
      - "5440:5432"
    restart: always
    volumes:
      - type: volume
        source: gitea_postgres_data
        target: /var/lib/postgresql/data
      - type: bind
        source: ./postgres/prod/postgresql.conf
        target: /etc/postgresql.conf
        read_only: true
      - type: bind
        source: ./postgres/prod/pg_hba.conf
        target: /etc/pg_hba.conf
        read_only: true

volumes:
  gitea_postgres_data:
  gitea_server_data:

networks:
  gitea:
    external: false

And I spawn it by

#!/bin/bash
docker compose --file=prod-docker-compose.yml down --remove-orphans
docker compose --file=prod-docker-compose.yml up --build -d --remove-orphans --force-recreate

gitea.Dockerfile:

FROM gitea/gitea:1.17

# Copy self-signed certificate to ca-certificates so the app trusts it
# NOTE: Doesn't seem to work!
COPY cert/private_gitea.crt /etc/ssl/certs/private_gitea.crt
RUN update-ca-certificates

Database

PostgreSQL

Originally created by @babinos87 on GitHub (Nov 21, 2022). ### Description I am using the Docker setup on an arm64 processor. Setting up and spawning server and postgres containers work great. I am able to setup gitea etc. The problem arises after I rebuild docker (stop and build the compose again). I get the below error on the server: ``` Server listening on :: port 22. Server listening on 0.0.0.0 port 22. 2022/11/21 23:02:26 cmd/web.go:106:runWeb() [I] Starting Gitea on PID: 17 2022/11/21 23:02:26 cmd/web.go:95:func1() [F] PANIC: runtime error: index out of range [2] with length 2 /usr/local/go/src/runtime/panic.go:89 (0x43d71b) /usr/local/go/src/encoding/base64/base64.go:360 (0x58b7f7) /usr/local/go/src/encoding/base64/base64.go:528 (0x58c51f) /go/src/code.gitea.io/gitea/modules/setting/lfs.go:55 (0x96f637) /go/src/code.gitea.io/gitea/modules/setting/setting.go:953 (0x9808eb) /go/src/code.gitea.io/gitea/modules/setting/setting.go:583 (0x1fae86b) /go/src/code.gitea.io/gitea/routers/install/setting.go:19 (0x1fae85c) /go/src/code.gitea.io/gitea/cmd/web.go:116 (0x20744a3) /go/pkg/mod/github.com/urfave/cli@v1.22.9/app.go:524 (0x1a6387b) /go/pkg/mod/github.com/urfave/cli@v1.22.9/command.go:173 (0x1a644b3) /go/pkg/mod/github.com/urfave/cli@v1.22.9/app.go:277 (0x1a6169f) /go/src/code.gitea.io/gitea/main.go:116 (0x20ad027) /usr/local/go/src/runtime/proc.go:250 (0x442587) /usr/local/go/src/runtime/asm_arm64.s:1270 (0x473cc3) Received signal 15; terminating. Server listening on :: port 22. Server listening on 0.0.0.0 port 22. 2022/11/21 23:03:27 cmd/web.go:106:runWeb() [I] Starting Gitea on PID: 17 2022/11/21 23:03:27 ...eful/manager_unix.go:158:handleSignals() [W] [637c03bf-4] PID: 17. Background context for manager closed - context canceled - Shutting down... 2022/11/21 23:03:27 cmd/web.go:95:func1() [F] PANIC: runtime error: index out of range [2] with length 2 /usr/local/go/src/runtime/panic.go:89 (0x43d71b) /usr/local/go/src/encoding/base64/base64.go:360 (0x58b7f7) /usr/local/go/src/encoding/base64/base64.go:528 (0x58c51f) /go/src/code.gitea.io/gitea/modules/setting/lfs.go:55 (0x96f637) /go/src/code.gitea.io/gitea/modules/setting/setting.go:953 (0x9808eb) /go/src/code.gitea.io/gitea/modules/setting/setting.go:583 (0x1fae86b) /go/src/code.gitea.io/gitea/routers/install/setting.go:19 (0x1fae85c) /go/src/code.gitea.io/gitea/cmd/web.go:116 (0x20744a3) /go/pkg/mod/github.com/urfave/cli@v1.22.9/app.go:524 (0x1a6387b) /go/pkg/mod/github.com/urfave/cli@v1.22.9/command.go:173 (0x1a644b3) /go/pkg/mod/github.com/urfave/cli@v1.22.9/app.go:277 (0x1a6169f) /go/src/code.gitea.io/gitea/main.go:116 (0x20ad027) /usr/local/go/src/runtime/proc.go:250 (0x442587) /usr/local/go/src/runtime/asm_arm64.s:1270 (0x473cc3) Received signal 15; terminating. ``` No idea how to fix this. If I delete the volume and rebuild the containers, it works, but then all my repos are gone, this is not ideal. Any ideas what the issue is, or at least how I can troubleshot that? I have posted how I run gitea in below section of the form. Thanks! ### Gitea Version 1.17 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version 2.30.2 ### Operating System Raspberry Pi OS 64 bit ### How are you running Gitea? Below is my docker-compose: ``` version: "3.8" services: gitea-server: build: context: . dockerfile: gitea.Dockerfile # This just uses official image, no other commands running apart from a useless COPY of certificates container_name: gitea_server depends_on: - postgres-db env_file: .prod-server.env networks: - gitea ports: - "3033:3033" - "2202:22" restart: always volumes: - type: volume source: gitea_server_data target: /data - type: bind source: ./cert target: /ssl-certs read_only: true - type: bind source: /etc/timezone target: /etc/timezone read_only: true - type: bind source: /etc/localtime target: /etc/localtime read_only: true postgres-db: image: postgres:14.6 container_name: gitea_postgres command: postgres -c config_file=/etc/postgresql.conf # nothing special here, default config env_file: .prod-postgres.env networks: - gitea ports: - "5440:5432" restart: always volumes: - type: volume source: gitea_postgres_data target: /var/lib/postgresql/data - type: bind source: ./postgres/prod/postgresql.conf target: /etc/postgresql.conf read_only: true - type: bind source: ./postgres/prod/pg_hba.conf target: /etc/pg_hba.conf read_only: true volumes: gitea_postgres_data: gitea_server_data: networks: gitea: external: false ``` And I spawn it by ``` #!/bin/bash docker compose --file=prod-docker-compose.yml down --remove-orphans docker compose --file=prod-docker-compose.yml up --build -d --remove-orphans --force-recreate ``` gitea.Dockerfile: ``` FROM gitea/gitea:1.17 # Copy self-signed certificate to ca-certificates so the app trusts it # NOTE: Doesn't seem to work! COPY cert/private_gitea.crt /etc/ssl/certs/private_gitea.crt RUN update-ca-certificates ``` ### Database PostgreSQL
GiteaMirror added the type/bug label 2025-11-02 08:51:52 -06:00
Author
Owner

@lunny commented on GitHub (Nov 21, 2022):

Looks like it's a bug of Golang

@lunny commented on GitHub (Nov 21, 2022): Looks like it's a bug of Golang
Author
Owner

@zeripath commented on GitHub (Nov 22, 2022):

I think there's likely something wrong with the value of your LFS_JWT_SECRET in your app.ini.

Now that shouldn't cause a panic and the fact that it does is a bug in go - as it should return an err not a panic. If you're able to show us the value and repeatably isolate and cause this problem we should report it upstream.

@zeripath commented on GitHub (Nov 22, 2022): I think there's likely something wrong with the value of your LFS_JWT_SECRET in your app.ini. Now that shouldn't cause a panic and the fact that it does is a bug in go - as it should return an err not a panic. If you're able to show us the value and repeatably isolate and cause this problem we should report it upstream.
Author
Owner

@babinos87 commented on GitHub (Nov 23, 2022):

Oh I see... I have changed this value to a random string, here is the value I set to it:

sUUdA9oChdFMzHkqDiPhF89JVJqmjTbem3CBKpiVjfYhuJqM7ijqHZ3h3M4jba7m

Should this be a JWT string? In the docs I see:

LFS_JWT_SECRET: : LFS authentication secret, change this a unique string.

So I am not sure, should I leave this empty? I hadn't noticed this error before setting this value manually.

EDIT: I changed this value to another with less characters (32 chars instead of 64) and now this error is gone when I rebuild the server! Strange thing... Thanks for pointing out to the right direction!

@babinos87 commented on GitHub (Nov 23, 2022): Oh I see... I have changed this value to a random string, here is the value I set to it: > sUUdA9oChdFMzHkqDiPhF89JVJqmjTbem3CBKpiVjfYhuJqM7ijqHZ3h3M4jba7m Should this be a JWT string? In the docs I see: > LFS_JWT_SECRET: <empty>: LFS authentication secret, change this a unique string. So I am not sure, should I leave this empty? I hadn't noticed this error before setting this value manually. EDIT: I changed this value to another with less characters (32 chars instead of 64) and now this error is gone when I rebuild the server! Strange thing... Thanks for pointing out to the right direction!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#9868