Error i/o timeout between 2 Docker container #444
Replies: 7 comments
-
It looks like you have a pretty complicated docker networking setup which is most likely to blame for the problem. What compose version are you running? On 1.29.0 it says your compose config is invalid, cannot start containers: |
Beta Was this translation helpful? Give feedback.
-
I defined hardcoded IPs to setup network configuration in my code with well known IP and not docker hostname internal resolution. I didn't know defining 2 IP addresses in compose file was a pretty complicated setup, do you suggest using Docker internal hostname resolution and not IP addresses should fix the problem ? docker-compose -v docker -v /etc/docker/daemon.json {
"default-runtime": "nvidia",
"runtimes": {
"nvidia": {
"path": "/usr/bin/nvidia-container-runtime",
"runtimeArgs": []
}
},
"features": {
"buildkit": true
}
} |
Beta Was this translation helpful? Give feedback.
-
Why don't you try with this config: version: "3.9"
services:
dev:
image: video-extractor/cuda-10.2:latest
container_name: video-extractor-dev
build: .
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [ gpu ]
ports:
- "2222:22" # SSH binding port for host IDE integration
- "1234:1234" # Remote GDB binding port for host IDE integration
security_opt:
- seccomp:unconfined
cap_add:
- SYS_PTRACE
command: >
sh -c "service ssh start &&
while true
do
/usr/local/bin/gdbserver :1234 /app/build/run /app/resources/videos/720P.mp4
done"
stream:
image: aler9/rtsp-simple-server:latest-amd64
container_name: video-extractor-stream
volumes:
- ./rtsp-simple-server.yml:/rtsp-simple-server.yml
ports:
- "1935:1935" # exposing the RTMP port Also be aware that In any case I am not able to replicate since your extractor image is private, and also you did not share the server config yml. |
Beta Was this translation helpful? Give feedback.
-
Ok so I just tried this config : docker-compose.yaml version: "3.9"
services:
dev:
image: video-extractor/cuda-10.2:latest
container_name: video-extractor-dev
hostname: video-extractor-dev
build: .
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [ gpu ]
ports:
- "2222:22" # SSH binding port for host IDE integration
- "1234:1234" # Remote GDB binding port for host IDE integration
security_opt:
- seccomp:unconfined
cap_add:
- SYS_PTRACE
command: >
sh -c "service ssh start &&
while true
do
/usr/local/bin/gdbserver :1234 /app/build/run /app/resources/videos/720P.mp4
done"
stream:
image: aler9/rtsp-simple-server:latest-amd64
container_name: video-extractor-stream
hostname: video-extractor-stream
volumes:
- ./rtsp-simple-server.yml:/rtsp-simple-server.yml
ports:
# - "8554:8554" # exposing the RTSP port
# - "8000:8000/udp" # exposing the RTP port
# - "8001:8001/udp" # exposing the RTCP port
- "1935:1935" # exposing the RTMP port docker network inspect video-extractor_default [
{
"Name": "video-extractor_default",
"Id": "21fa30311acf4feab8ec3a28aabe4ebef7b4317035519767b7cc59d0c5a17047",
"Created": "2021-06-17T16:55:18.277503986+02:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.20.0.0/16",
"Gateway": "172.20.0.1"
}
]
},
"Internal": false,
"Attachable": true,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"ad56001245cc0b7e0a2c25128d8e6071757414fee10a9aa72525c31feda79cb7": {
"Name": "video-extractor-stream",
"EndpointID": "bec652a42c730b4a141f733543eea45e293a49ae48dd4070050cfae9479409aa",
"MacAddress": "02:42:ac:14:00:02",
"IPv4Address": "172.20.0.2/16",
"IPv6Address": ""
},
"dd564fbf36fe2a346d49a4f1062ea5b3eb4b65e1a72fbf55e6e9da65fe320a41": {
"Name": "video-extractor-dev",
"EndpointID": "f20d7ff63703bab2354b8d3a1479f57bdbc66fb1df623c3c8d5f87fdfd0e264d",
"MacAddress": "02:42:ac:14:00:03",
"IPv4Address": "172.20.0.3/16",
"IPv6Address": ""
}
},
"Options": {},
"Labels": {
"com.docker.compose.network": "default",
"com.docker.compose.project": "video-extractor",
"com.docker.compose.version": "1.29.0"
}
}
] server container output
frames feeder container
So i'm now connecting to the RTMP server with |
Beta Was this translation helpful? Give feedback.
-
Sorry, can't help without a replicable setup. |
Beta Was this translation helpful? Give feedback.
-
I can provide a minimal reproducible example and build a public Docker image with it (trimming all my cuda stuff etc). |
Beta Was this translation helpful? Give feedback.
-
Hello, first of all i don't think the issue is related to Docker or docker-compose; i always use rtsp-simple-server in a container and it doesn't have any problem when talking to other containers in the same virtual network, even when ports are not published. Furthermore, RTMP works by using a single TCP connection, and this connection is indeed opened between the client and the server. In my opinion, the issue lies in your client that doesn't perform correctly the RTMP initialization procedure, that is composed of:
Judging by the error (i/o timeout), probably the 4th or 5th point are missing. The server discards any incoming packet until H264 infos and AAC infos are found, and when this doesn't happen within a timeout, that error is thrown. My advice is: try to analyze the packets exchanged between a standard instance of ffmpeg and the server, and then try to analyze the packets exchanged between your client and the server. If you still think this is a server issue, feel free to open another issue. |
Beta Was this translation helpful? Give feedback.
-
Which version are you using?
v0.16.0
Which operating system are you using?
Ubuntu 20.04 LTS
OS
Architecture
Describe the issue
The RTMP server does not recieve frames from other Docker container.
The server is starting with
docker-compose up stream
and gives the following output.In the client Docker container pushing the H264 frames, the handshake seems to work well with
avio_open(&formatContext->pb, formatContext->url, AVIO_FLAG_WRITE)
andavformat_write_header(formatContext, nullptr)
resulting invideo-extractor-stream | 2021/06/15 09:45:48 I [0/0] [RTMP] [conn 172.20.0.2:60012] opened
on the server.Then, the client pushes H264 frames with
av_write_frame(formatContext, &packet)
andav_write_frame(formatContext, nullptr)
but it seems like none of the frames are received from the server, resulting invideo-extractor-stream | 2021/06/15 09:45:58 I [0/0] [RTMP] [conn 172.20.0.2:60012] ERR: read tcp 172.20.0.4:1935->172.20.0.2:60012: i/o timeout
. Theav_write_frame
calls are successful.I did not open client port on my
docker-compose.yaml
as the containers inside the same network should be able to talk with each others. Here is the Docker network config :docker-compose.yaml
Beta Was this translation helpful? Give feedback.
All reactions