You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I observed in one long-running application that if the application uses the git2go library to clone the repo or compute the last commit hash from branch/tag then memory is constantly increasing. We run our application in Kubernetes so it leads the pod to out of memory error.
I prepared the hello world application that can easily reproduce the problem. The application clones the repo in the infinite loop and after that, it will remove the tmp directory and run the Free method on every git2go object:
The app can be built by running docker build -t <tag> . on this Dockerfile (or you can simply reuse my image pprecel/git2go:latest):
FROM golang:1.22.3-alpine3.20 as builder
WORKDIR /app
RUN apk add --no-cache gcc libc-dev
RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.18/community libgit2-dev=1.5.2-r0
COPY . /app
RUN pwd
RUN go mod tidy
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o /app/main /app/main.go
FROM alpine:latest
RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/v3.18/community libgit2-dev=1.5.2-r0
COPY --from=builder /app /app
CMD ["/app/main"]
The application can be run in every container ecosystem, so docker or Kubernetes systems will show the right results:
docker run -d --name git2go-2 pprecel/git2go:latest
or
kubectl run git2go --image=pprecel/git2go:latest
On my machine, I observed that after a night the memory usage increased from 28Mi to almost 3000Mi and it's still increasing.
. Example:
kubectl top pods
NAME CPU(cores) MEMORY(bytes)
git2go 532m 20Mi
after a night
kubectl top pods
NAME CPU(cores) MEMORY(bytes)
git2go 532m 3012Mi
The text was updated successfully, but these errors were encountered:
Description:
I observed in one long-running application that if the application uses the git2go library to clone the repo or compute the last commit hash from branch/tag then memory is constantly increasing. We run our application in Kubernetes so it leads the pod to
out of memory
error.I prepared the
hello world
application that can easily reproduce the problem. The application clones the repo in the infinite loop and after that, it will remove the tmp directory and run theFree
method on every git2go object:The app can be built by running
docker build -t <tag> .
on this Dockerfile (or you can simply reuse my imagepprecel/git2go:latest
):The application can be run in every container ecosystem, so docker or Kubernetes systems will show the right results:
or
On my machine, I observed that after a night the memory usage increased from 28Mi to almost 3000Mi and it's still increasing.
. Example:
after a night
The text was updated successfully, but these errors were encountered: