phoityne / ghci-dap

ghci having DAP interface.
https://hackage.haskell.org/package/ghci-dap
Other
19 stars 3 forks source link

cloud-native debugging app: heap overflow #7

Open gattytto opened 3 years ago

gattytto commented 3 years ago

hello, I have posted earlier about issues surrounding ghci-dap and eclipse che (web-based cloud-native IDE), those are fixed now.

current situation is a heap overflow inside the sidecar container for haskell, probably because it's getting the wrong available memory (host's) instead of the kubernete's namespace limited resources for the pod/container.

could there be a way to tell the debugger we're in a container so we can manually set the heap limits?.

screenshot: image image

this is proc/meminfo in the sidecar container(runc):

user@workspace8my3rva3bxml8pet:/projects/src/github.com/che-samples/haskell-demo$ cat /proc/meminfo 
MemTotal:       32105908 kB
MemFree:        18852320 kB
MemAvailable:   26451328 kB
Buffers:            2880 kB
Cached:          6740600 kB
SwapCached:            0 kB
Active:          6435680 kB
Inactive:        3846800 kB
Active(anon):    3051572 kB
Inactive(anon):    52984 kB
Active(file):    3384108 kB
Inactive(file):  3793816 kB
Unevictable:       73740 kB
Mlocked:           73740 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:             14836 kB
Writeback:             0 kB
AnonPages:       2967500 kB
Mapped:           944676 kB
Shmem:             57952 kB
KReclaimable:     877492 kB
Slab:            1599504 kB
SReclaimable:     877492 kB
SUnreclaim:       722012 kB
KernelStack:       35108 kB
PageTables:        45384 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:    16052952 kB
Committed_AS:   20420012 kB
VmallocTotal:   34359738367 kB
VmallocUsed:           0 kB
VmallocChunk:          0 kB
Percpu:           112736 kB
HardwareCorrupted:     0 kB
AnonHugePages:    923648 kB
ShmemHugePages:        0 kB
ShmemPmdMapped:        0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
Hugetlb:               0 kB
DirectMap4k:     3139556 kB
DirectMap2M:    12806144 kB
DirectMap1G:    17825792 kB

here's a "codeready workspaces" devfile so anyone can use their free service to start the ide with the projects and mentioned extensions/settings (even run/debug settings are preset).

apiVersion: 1.0.0
metadata:
  name: haskell1
projects:
  - name: haskell-demo
    source:
      location: 'git@github.com:gattytto/example-servant-minimal'
      type: github
      branch: 8.10.3
    clonePath: src/github.com/che-samples/haskell-demo
  - name: haskell-examples
    source:
      location: 'git@github.com:gattytto/haskell-examples'
      type: git
      branch: master
    clonePath: src/github.com/che-samples/haskell-examples
components:
  - cpuLimit: 1750m
    id: eclipse/che-theia/latest
    cpuRequest: 200m
    type: cheEditor
  - cpuLimit: 8001m
    memoryLimit: 4048Mi
    preferences:
      haskell.languageServerVariant: ghcide
    cpuRequest: 800m
    type: chePlugin
    reference: 'https://raw.githubusercontent.com/gattytto/cheplugins/master/haskell/meta-osio-8.10.3.yaml'
    memoryRequest: 512Mi
  - id: redhat/vscode-yaml/latest
    type: chePlugin
phoityne commented 3 years ago

Hi.

could there be a way to tell the debugger we're in a container so we can manually set the heap limits?.

I don't think there is a way to tell the ghci that.( tell in a container of k8s pod.) There are some stack options for ghc, ghci.

Regards.