Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shared memory between containers in pod not working #8181

Closed
PinkJohnOfUs opened this issue Oct 29, 2020 · 2 comments · Fixed by #8192
Closed

shared memory between containers in pod not working #8181

PinkJohnOfUs opened this issue Oct 29, 2020 · 2 comments · Fixed by #8192
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@PinkJohnOfUs
Copy link

PinkJohnOfUs commented Oct 29, 2020

/kind bug

Description

Pod uses same IPC namespace, but it is not possible to use /dev/shm

Steps to reproduce the issue:

  1. create Pod
podman pod create --name shm-pod
  1. run sender and receiver container
podman run --name rx-shm -dt --pod shm-pod alpine
podman run --name tx-shm -dt --pod shm-pod alpine
  1. send data over /dev/shm
podman exec -it tx-shm /bin/sh
# echo "blub" > /dev/shm/test
  1. try receiving data over /dev/shm
podman exec -it rx-shm /bin/sh
# cat  /dev/shm/test

Describe the results you received:

cat: can't open '/dev/shm/test': No such file or directory

Describe the results you expected:

blub

output of podman pod inspect shm-pod

podman pod inspect shm-pod
{
    "Id": "7356e64626761ae9edab93677508f509c5eba6a234dc2786f1a3f77a4b3b451c",
    "Name": "shm-pod",
    "Created": "2020-10-29T12:24:36.872670983+01:00",
    "CreateCommand": [
        "podman",
        "pod",
        "create",
        "--name",
        "shm-pod"
    ],
    "State": "Running",
    "Hostname": "shm-pod",
    "CreateCgroup": true,
    "CgroupParent": "/libpod_parent",
    "CgroupPath": "/libpod_parent/7356e64626761ae9edab93677508f509c5eba6a234dc2786f1a3f77a4b3b451c",
    "CreateInfra": true,
    "InfraContainerID": "67ebfdee5ac797f63c792a59d9fb3e71cdb8ace0ba03dd5f08209d4848a9e744",
    "InfraConfig": {
        "PortBindings": {},
        "HostNetwork": false,
        "StaticIP": "",
        "StaticMAC": null,
        "NoManageResolvConf": false,
        "DNSServer": null,
        "DNSSearch": null,
        "DNSOption": null,
        "NoManageHosts": false,
        "HostAdd": null,
        "Networks": null
    },
    "SharedNamespaces": [
        "uts",
        "ipc",
        "net"
    ],
    "NumContainers": 3,
    "Containers": [
        {
            "Id": "67ebfdee5ac797f63c792a59d9fb3e71cdb8ace0ba03dd5f08209d4848a9e744",
            "Name": "7356e6462676-infra",
            "State": "running"
        },
        {
            "Id": "76cbe93efd3fae5186ecf5a7a2f2c85426bc8d9cabeb5c333416a179edf2566a",
            "Name": "tx-shm",
            "State": "running"
        },
        {
            "Id": "9d92be4a220664273abb660448ca01b20e299131e46b8c3db386dc7538488d94",
            "Name": "rx-shm",
            "State": "running"
        }
    ]
}

Output of podman version:

Version:      2.1.1
API Version:  2.0.0
Go Version:   go1.15.2
Built:        Thu Jan  1 01:00:00 1970
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.16.1
  cgroupManager: cgroupfs
  cgroupVersion: v1
  conmon:
    package: 'conmon: /usr/libexec/podman/conmon'
    path: /usr/libexec/podman/conmon
    version: 'conmon version 2.0.20, commit: '
  cpus: 12
  distribution:
    distribution: ubuntu
    version: "18.04"
  eventLogger: journald
  hostname: pop-os
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 5.4.0-52-generic
  linkmode: dynamic
  memFree: 5172588544
  memTotal: 33075073024
  ociRuntime:
    name: runc
    package: 'containerd.io: /usr/bin/runc'
    path: /usr/bin/runc
    version: |-
      runc version 1.0.0-rc10
      commit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
      spec: 1.0.1-dev
  os: linux
  remoteSocket:
    exists: true
    path: /run/user/1000/podman/podman.sock
  rootless: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: 'slirp4netns: /usr/bin/slirp4netns'
    version: |-
      slirp4netns version 1.1.4
      commit: unknown
      libslirp: 4.3.1-git
      SLIRP_CONFIG_VERSION_MAX: 3
  swapFree: 4293386240
  swapTotal: 4294434816
  uptime: 28h 50m 17.65s (Approximately 1.17 days)
registries:
  search:
  - docker.io
  - quay.io
store:
  configFile: /home/kiki/.config/containers/storage.conf
  containerStore:
    number: 12
    paused: 0
    running: 3
    stopped: 9
  graphDriverName: vfs
  graphOptions: {}
  graphRoot: /home/kiki/.local/share/containers/storage
  graphStatus: {}
  imageStore:
    number: 35
  runRoot: /run/user/1000/containers
  volumePath: /home/kiki/.local/share/containers/storage/volumes
version:
  APIVersion: 2.0.0
  Built: 0
  BuiltTime: Thu Jan  1 01:00:00 1970
  GitCommit: ""
  GoVersion: go1.15.2
  OsArch: linux/amd64
  Version: 2.1.1

Package info (e.g. output of rpm -q podman or apt list podman):

Listing... Done
podman/unknown,now 2.1.1~2 amd64 [installed]

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide?

Yes

tested on physical device

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Oct 29, 2020
rhatdan added a commit to rhatdan/podman that referenced this issue Oct 30, 2020
Containers that share IPC Namespaces share each others
/dev/shm, which means a private /dev/shm needs to be setup
for the infra container.

Added a system test and an e2e test to make sure the
/dev/shm is shared.

Fixes: containers#8181

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
@albertxos
Copy link

@rhatdan thank you for your great podman4soafee presentation today.
Looking forward to see podman in action.
Is there a way to make your own infra-container implementation?
^^that was my first podman issue ;)

@rhatdan
Copy link
Member

rhatdan commented Dec 12, 2022

Yes you can by modifying containers.conf

 grep infra /usr/share/containers/containers.conf 
# Default command to run the infra container
#infra_command = "/pause"
# Infra (pause) container image name for pod infra containers.  When running a
#infra_image = ""

But I am not sure what you are attempting to do. You might want to look into --init-ctr instead of changing infra image.

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 7, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants