google / gvisor

Application Kernel for Containers

Home Page:https://gvisor.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

epoll_wait does not return EPOLLHUP events on remote close

brianquinlan opened this issue · comments

Description

epoll_wait does not generate EPOLLHUP events when the server closes the associated file descriptor.

gVisor output:

main: running
server: running
server: waiting for a connection...
client: running
client: fd is: 4
client: connected.
Events received: 4
server: connected with 6.
Events received: 5
server: closed fd 6

Linux output:

main: running
server: running
server: waiting for a connection...
client: running
client: fd is: 5
server: connected with 4.
server: closed fd 4
client: connected.
Events received: 8213
Got close!

Note that the Got close! output is not present when run under gVisor, which corresponds to the lack of EPOLLHUP event.

The repro was reduced from the original bugs, where Postgres could not be used correctly on Google Cloud Run:
dart-lang/sdk#47899
GoogleCloudPlatform/functions-framework-dart#302

Steps to reproduce

repro.cc.zip

$ c++ -pthread repro.cc
$ ./a.out

runsc version

$ runsc --version
runsc version google-436818345
spec: 1.0.2-dev


### docker version (if using docker)

_No response_

### uname

Linux <host> 5.15.15-1rodete2-amd64 #1 SMP Debian 5.15.15-1rodete2 (2022-02-23) x86_64 GNU/Linux

### kubectl (if using Kubernetes)

_No response_

### repo state (if built from source)

_No response_

### runsc debug logs (if available)

_No response_

@nlacasse looks like UDS implementation maybe is missing a notify.

A friendly reminder that this issue had no activity for 120 days.

This issue has been closed due to lack of activity.

I can still reproduce this.

Thanks for investigating these Cloud Run issues and providing a reproducer, that was really helpful. I think #9870 should fix this issue.