Skip to content

deadlock on read from socket with later #170

Open
@toomish

Description

@toomish
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions