opengist icon indicating copy to clipboard operation
opengist copied to clipboard

panic serving xxx: runtime error: index out of range [-1]

Open UlyssesZh opened this issue 1 year ago • 2 comments

I am using almost the exact same docker compose contents from readme. At first everything looks good, but this error (or similar ones) occasionally occurs randomly, and then everything is 502:

Opengist v1.7.3
Using YAML config file: /config.yml
Using environment variables config: OG_OPENGIST_HOME
echo: http: panic serving 192.168.16.1:43572: runtime error: index out of range [-1]
goroutine 121 [running]:
net/http.(*conn).serve.func1()
    /usr/local/go/src/net/http/server.go:1898 +0xbe
panic({0x1395440?, 0xc000b560f0?})
    /usr/local/go/src/runtime/panic.go:770 +0x132
golang.org/x/text/cases.(*context).copyXOR(0x10?)
    /root/go/pkg/mod/golang.org/x/[email protected]/cases/context.go:143 +0x10b
golang.org/x/text/cases.title(0xc0003e6e60?)
    /root/go/pkg/mod/golang.org/x/[email protected]/cases/context.go:283 +0x1ca
golang.org/x/text/cases.(*titleCaser).Transform(0xc0003e6e60, {0xc000276b00?, 0x70f2df19fb2d?, 0x7?}, {0xc000276b80?, 0x10?, 0xc000680008?}, 0xce?)
    /root/go/pkg/mod/golang.org/x/[email protected]/cases/map.go:354 +0x24b
golang.org/x/text/transform.String({0x70f2df148dc0, 0xc0003e6e60}, {0xc000b4c200, 0x10})
    /root/go/pkg/mod/golang.org/x/[email protected]/transform/transform.go:601 +0x1f5
golang.org/x/text/cases.Caser.String(...)
    /root/go/pkg/mod/golang.org/x/[email protected]/cases/cases.go:51
github.com/thomiceli/opengist/internal/web.loadSettings({0x27f79a8, 0xc000643860})
    /opengist/internal/web/util.go:119 +0x145
github.com/thomiceli/opengist/internal/web.dataInit.func1({0x27f79a8, 0xc000643860})
    /opengist/internal/web/server.go:384 +0x1e7
github.com/labstack/echo/v4.(*Echo).ServeHTTP.func1({0x27f79a8, 0xc000643860})
    /root/go/pkg/mod/github.com/labstack/echo/[email protected]/echo.go:668 +0x127
github.com/labstack/echo/v4/middleware.RequestLoggerConfig.ToMiddleware.func1.1({0x27f79a8, 0xc000643860})
    /root/go/pkg/mod/github.com/labstack/echo/[email protected]/middleware/request_logger.go:286 +0x16b
github.com/labstack/echo/v4/middleware.CORSWithConfig.func1.1({0x27f79a8, 0xc000643860})
    /root/go/pkg/mod/github.com/labstack/echo/[email protected]/middleware/cors.go:203 +0x463
github.com/thomiceli/opengist/internal/web.NewServer.RemoveTrailingSlash.RemoveTrailingSlashWithConfig.func8.1({0x27f79a8, 0xc000643860})
    /root/go/pkg/mod/github.com/labstack/echo/[email protected]/middleware/slash.go:117 +0x1fd
github.com/thomiceli/opengist/internal/web.NewServer.MethodOverrideWithConfig.func6.1({0x27f79a8, 0xc000643860})
    /root/go/pkg/mod/github.com/labstack/echo/[email protected]/middleware/method_override.go:64 +0xc6
github.com/labstack/echo/v4.(*Echo).ServeHTTP(0xc0001f1688, {0x27dcbc8, 0xc0006fe000}, 0xc000ccc000)
    /root/go/pkg/mod/github.com/labstack/echo/[email protected]/echo.go:674 +0x327
net/http.serverHandler.ServeHTTP({0xc000b72030?}, {0x27dcbc8?, 0xc0006fe000?}, 0x6?)
    /usr/local/go/src/net/http/server.go:3137 +0x8e
net/http.(*conn).serve(0xc000b8e120, {0x27de6b8, 0xc000a30240})
    /usr/local/go/src/net/http/server.go:2039 +0x5e8
created by net/http.(*Server).Serve in goroutine 9
    /usr/local/go/src/net/http/server.go:3285 +0x4b4

UlyssesZh avatar Jul 11 '24 01:07 UlyssesZh

I don't know which version specifically introduced this bug, but I used to use 1.5.2 and it didn't have this bug. I currently downgraded the deployment on my home server to 1.5.2 and it works fine.

UlyssesZh avatar Jul 22 '24 10:07 UlyssesZh

same issue https://github.com/thomiceli/opengist/issues/298

qianlongzt avatar Aug 09 '24 19:08 qianlongzt

Sorry for the delay, can you drop your config.yaml if you changed it ?

thomiceli avatar Aug 28 '24 15:08 thomiceli

I configure everything in my docker compose file with env var. The only thing I configured is the external url.

UlyssesZh avatar Aug 29 '24 17:08 UlyssesZh

same here

echo: http: panic serving 172.20.0.3:41598: runtime error: slice bounds out of range [18:14]
goroutine 364 [running]:
net/http.(*conn).serve.func1()
	/usr/local/go/src/net/http/server.go:1898 +0xbe
panic({0x1395440?, 0xc0009289f0?})
	/usr/local/go/src/runtime/panic.go:770 +0x132
golang.org/x/text/transform.String({0x7028baf24198, 0xc0004fea00}, {0xc000e4f630, 0xe})
	/root/go/pkg/mod/golang.org/x/[email protected]/transform/transform.go:650 +0xbb0
golang.org/x/text/cases.Caser.String(...)
	/root/go/pkg/mod/golang.org/x/[email protected]/cases/cases.go:51
github.com/thomiceli/opengist/internal/web.loadSettings({0x27f79a8, 0xc000a6c000})
	/opengist/internal/web/util.go:119 +0x145
github.com/thomiceli/opengist/internal/web.dataInit.func1({0x27f79a8, 0xc000a6c000})
	/opengist/internal/web/server.go:384 +0x1e7
github.com/labstack/echo/v4.(*Echo).ServeHTTP.func1({0x27f79a8, 0xc000a6c000})
	/root/go/pkg/mod/github.com/labstack/echo/[email protected]/echo.go:668 +0x127
github.com/labstack/echo/v4/middleware.RequestLoggerConfig.ToMiddleware.func1.1({0x27f79a8, 0xc000a6c000})
	/root/go/pkg/mod/github.com/labstack/echo/[email protected]/middleware/request_logger.go:286 +0x16b
github.com/labstack/echo/v4/middleware.CORSWithConfig.func1.1({0x27f79a8, 0xc000a6c000})
	/root/go/pkg/mod/github.com/labstack/echo/[email protected]/middleware/cors.go:268 +0x87f
github.com/thomiceli/opengist/internal/web.NewServer.RemoveTrailingSlash.RemoveTrailingSlashWithConfig.func8.1({0x27f79a8, 0xc000a6c000})
	/root/go/pkg/mod/github.com/labstack/echo/[email protected]/middleware/slash.go:117 +0x1fd
github.com/thomiceli/opengist/internal/web.NewServer.MethodOverrideWithConfig.func6.1({0x27f79a8, 0xc000a6c000})
	/root/go/pkg/mod/github.com/labstack/echo/[email protected]/middleware/method_override.go:64 +0xc6
github.com/labstack/echo/v4.(*Echo).ServeHTTP(0xc0001f9b08, {0x27dcbc8, 0xc000ac4620}, 0xc000cb8480)
	/root/go/pkg/mod/github.com/labstack/echo/[email protected]/echo.go:674 +0x327
net/http.serverHandler.ServeHTTP({0xc000b048a0?}, {0x27dcbc8?, 0xc000ac4620?}, 0x6?)
	/usr/local/go/src/net/http/server.go:3137 +0x8e
net/http.(*conn).serve(0xc000b80a20, {0x27de6b8, 0xc000878240})
	/usr/local/go/src/net/http/server.go:2039 +0x5e8
created by net/http.(*Server).Serve in goroutine 54
	/usr/local/go/src/net/http/server.go:3285 +0x4b4

here is my docker-compose

    opengist:
    image: ghcr.io/thomiceli/opengist:latest
    container_name: opengist
    environment:
      - OG_EXTERNAL_URL=https://gist.*****
      - OG_OIDC_CLIENT_KEY=*****************************
      - OG_OIDC_SECRET=*****************************
      - OG_OIDC_DISCOVERY_URL=https://sso.*****.me/application/o/opengist/.well-known/openid-configuration
    restart: unless-stopped
    ports:
      - "6157:6157" # HTTP port
    volumes:
      - "/containers/opengist_data/:/opengist"
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:6157/healthcheck"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 5s 

i use nginx proxy manager to reverse proxy the port on 443

Smallinger avatar Sep 02 '24 18:09 Smallinger