Comments (5)
I was able to further narrow it down, and create a simple C reproducer that demonstrates the issue. It seems as if MongoDB Unix-domain sockets are marked non-blocking, and then epoll_wait
is used to wait for a new client (before calling accept
). It also seems like MongoDB uses epoll_ctl
to track the socket, and it does so immediately after creating the socket, and before calling bind
on the socket. When re-ordering the calls, moving the epoll_ctl
call after bind
, everything seems to work perfectly. I'm not entirely certain what component in the gVisor code base is responsible for this, but I'll try and take a look.
#define _GNU_SOURCE
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/epoll.h>
int main(int argc, char *argv[]) {
int sock_fd = -1;
int flags = 0;
int ret = -1;
int client_fd = -1;
int epoll_fd = -1;
struct epoll_event epoll_read = {
.events = EPOLLIN|EPOLLPRI|EPOLLERR|EPOLLHUP|EPOLLET,
};
struct sockaddr_un addr = {0};
char *sock_path = NULL;
char *msg = NULL;
if (argc < 3) {
printf("<socket_path> <msg>\n");
return 1;
}
sock_path = argv[1];
msg = argv[2];
epoll_fd = epoll_create1(EPOLL_CLOEXEC);
if (epoll_fd < 0) {
perror("epoll_create");
return 1;
}
printf("socket\n");
sock_fd = socket(AF_UNIX, SOCK_STREAM|SOCK_NONBLOCK, 0);
if (sock_fd < 0) {
perror("socket");
return 1;
}
if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, sock_fd, &epoll_read) < 0) {
perror("epoll_ctl");
return 1;
}
printf("bind\n");
unlink(sock_path);
addr.sun_family = AF_UNIX;
strcpy(addr.sun_path, sock_path);
if (bind(sock_fd, &addr, sizeof(addr)) < 0) {
perror("bind");
return 1;
}
printf("listen\n");
if (listen(sock_fd, 128) < 0) {
perror("listen");
return 1;
}
do {
struct epoll_event ev[128] = {0};
ret = epoll_wait(epoll_fd, ev, 128, -1);
} while (ret < 0 && errno == EINTR);
if (ret <= 0) {
perror("epoll_wait");
return 1;
}
printf("accept\n");
client_fd = accept(sock_fd, NULL, NULL);
if (client_fd < 0) {
perror("accept");
return 1;
}
printf("send: %s\n", msg);
send(client_fd, msg, strlen(msg), 0);
printf("done!\n");
return 0;
}
from gvisor.
Hi @ayushr2
Thank you so much for the super fast fix!!! That's amazing!
Do you happen to have an estimation of when will this patch be included in the next official release?
TIA
from gvisor.
Thanks for the bug report, and for narrowing it down with the reproducer. That was really helpful.
I think I have fixed the issue in #9849. Lets see if the e2e test concur.
from gvisor.
Hoping to have a release on Jan 3rd. cc @manninglucas
from gvisor.
Ah, we released the Monday candidate (which doesn't contain the fix). You can expect us to make a release for 01/08 candidate next Wednesday.
from gvisor.
Related Issues (20)
- cudaMallocManaged() is unsupported in nvproxy
- text-embeddings-inference fails with error attempting to alloc NV_CONFIDENTIAL_COMPUTE object HOT 4
- gvisor panic: Invalid MmapLayout HOT 7
- gVisor start failed in Rasberry Pi 3b+ HOT 3
- not able to install any package using apt on Debian 12 container - Setting TIOCSCTTY for slave fd 23 failed! - ioctl HOT 3
- Unable to checkpoint container with `-nvproxy` after the introduction of `driverABI` HOT 3
- gVisor failed to use host network silently HOT 6
- OOM OCI Events Broken for Kubernetes + CgroupsV2
- `xxx | grep > /dev/null` randomly fails HOT 2
- runsc fails on GCP c3 and EC2 m7i instances with status code 137 (i.e. sigkill) HOT 13
- Unable to restore containers checkpointed with `-nvproxy` and `-nvproxy-docker` HOT 3
- netstack: performance w/TCP-RACK on Windows HOT 7
- Segmentation fault when using powershell with GKE sandboxed nodes HOT 5
- checklocksignore only seems to work as a postfix field comment HOT 1
- gVisor on GCP with gVNIC has long epoll_wait() delays when sending HTTP data HOT 16
- NV50_P2P allocation class unimplemented in nvproxy HOT 19
- Pods stuck in Terminating state due to process not being killed HOT 38
- Nvidia H100 nvproxy: unknown control command 0x20801230 HOT 8
- Istio 1.18 iptable rules fail due to inverted destination port match HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gvisor.