title: GKE: pods(dotnet application) often restart with error 139
body: <p>I have a private gke cluster. It contains 3 nodes (each has 2 CPUs and 7.5GB of memory) and 3 pods' replica (it's a .NET Core application). I've noticed that my containers sometimes restart with &quot;error 139 SIGSEGV&quot;, <a href="https://medium.com/better-programming/understanding-docker-container-exit-codes-5ee79a1d58f6" rel="nofollow noreferrer">which says that there is problem with accessing memory</a>:</p>
  <blockquote>
  <p>This occurs when a program attempts to access a memory location that it’s not allowed to access, or attempts to access a memory location in a way that’s not allowed.</p>
  </blockquote>
  <p>I don't have application logs with the error before restarting the container, therefore it's impossible to debug it.</p>
  <p>I've added a property false
  in application but it didn't solve the problem.</p>
  <p>How can I fix this problem?</p>
  <p>Manifest:</p>
  <pre><code>apiVersion: extensions/v1beta1
  kind: Deployment
  metadata:
    name: stage-deployment
    namespace: stage
  spec:
    replicas: 3
    minReadySeconds: 5
    strategy:
      type: RollingUpdate
      rollingUpdate:
        maxSurge: 1
        maxUnavailable: 0  
    selector:
      matchLabels:
        app: stage
    template:
      metadata:
        labels:
          app: stage
      spec:
        containers:
        - name: stage-container
          image: my.registry/stage/core:latest
          imagePullPolicy: &quot;Always&quot;
          ports:
          - containerPort: 5000
            name: http
          - containerPort: 22
            name: ssh
          readinessProbe:
            tcpSocket:
              port: 5000
            initialDelaySeconds: 5
            periodSeconds: 10
          livenessProbe:
            tcpSocket:
              port: 5000
            initialDelaySeconds: 5
            periodSeconds: 20
          env:
              - name: POSTGRES_DB_HOST
                value: 127.0.0.1:5432
              - name: POSTGRES_DB_USER
                valueFrom:
                  secretKeyRef:
                    name: db-credentials
                    key: username
              - name: POSTGRES_DB_PASSWORD
                valueFrom:
                  secretKeyRef:
                    name: db-credentials
                    key: password
              - name: DB_NAME
                valueFrom:
                  secretKeyRef:
                    name: db-credentials
                    key: dbname
        - name: cloudsql-proxy
          image: gcr.io/cloudsql-docker/gce-proxy:1.11
          command: [&quot;/cloud_sql_proxy&quot;,
                    &quot;-instances=my-instance:us-west1:dbserver=tcp:5432&quot;,
                    &quot;-credential_file=/secrets/cloudsql/credentials.json&quot;]
          volumeMounts:
            - name: instance-credentials
              mountPath: /secrets/cloudsql
              readOnly: true
        volumes:
          - name: instance-credentials
            secret:
              secretName: instance-credentials
        imagePullSecrets:
        - name: regcred
  ---
  
  apiVersion: v1
  kind: Service
  metadata:
    name: stage-service
    namespace: stage
  spec:
    type: NodePort
    selector:
      app: stage
    ports:
      - protocol: TCP
        port: 80
        targetPort: 5000
        name: https
  ---
  
  apiVersion: extensions/v1beta1
  kind: Ingress
  metadata:
    annotations:
      kubernetes.io/ingress.class: nginx
      nginx.ingress.kubernetes.io/ssl-redirect: &quot;true&quot;
      nginx.ingress.kubernetes.io/proxy-body-size: 300m
      nginx.ingress.kubernetes.io/proxy-buffer-size: 128k
      nginx.ingress.kubernetes.io/proxy-buffers-number: 4 256k
      nginx.org/client-max-body-size: 1000m
    name: ingress
    namespace: stage
  spec:
    rules:
      - host: my.site.com
        http:
          paths:
          - backend:
              serviceName: stage-service
              servicePort: 80
    tls:
      - hosts:
          - my.site.com
        secretName: my-certs
  </code></pre>