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

deadlock on read from socket with later #170

Open
toomish opened this issue Dec 17, 2022 · 0 comments
Open

deadlock on read from socket with later #170

toomish opened this issue Dec 17, 2022 · 0 comments

Comments

@toomish
Copy link

toomish commented Dec 17, 2022

library(later)

serv <- serverSocket(2000)

f <- function() {
        sock <- socketConnection(port = 2000, blocking = TRUE, timeout = 1)
        recv <- readLines(sock)
        stopifnot(!length(recv))
        writeLines("timeout")
        close(sock)
}

later(f)
run_now()

f() called with later deadlock forever.
Without later will be timeout as expected after 1 second.

strace shows following constantly repeated lines:

pselect6(10, [4 6 9], [], NULL, {tv_sec=1, tv_nsec=0}, NULL) = 1 (in [4], left {tv_sec=0, tv_nsec=967908952})
...
read(4, "a", 256) 

Where 4, 6 are pipes and 9 is my socket descriptor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant