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

Normalize timeval timeout before select() #41

Closed
wants to merge 1 commit into from
Closed

Conversation

jeroen
Copy link
Member

@jeroen jeroen commented Jun 1, 2021

This fixes rstudio/rstudio#6692 and rstudio/rstudio#1997.

I think what happens is that select() returns immediately EINVAL instead of waiting when timeout is not “normalized”. I can’t find a canonical reference that this is required but for example https://www.gnu.org/software/libc/manual/html_node/Time-Types.html says:

When struct timeval values are produced by GNU C Library functions, the value in this field will always be greater than or equal to zero, and less than 1,000,000. When struct timeval values are supplied to GNU C Library functions, the value in this field must be in the same range.

It seems that the problem was diagnosed 3 years ago, not sure why it wasn't reported in R.

@ltierney @kalibera

@jeroen jeroen changed the title do not overflow for timeout timeval > 1s Normalize timeval timeout before select() Jun 1, 2021
@jeroen
Copy link
Member Author

jeroen commented Jun 10, 2021

Fixed (for r-devel) in 753f2b9

@jeroen jeroen closed this Jun 10, 2021
@jeroen jeroen deleted the timeval branch February 12, 2022 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant