pitrou commented on issue #35318:
URL: https://github.com/apache/arrow/issues/35318#issuecomment-1552745718

   Ok, I took a brief tour through the libcurl source code:
   * The "Unrecoverable error in select/poll" error is generated in 
`curl_multi_wait` if `Curl_poll` returns -1
   * `Curl_poll` (which, understably, is a wrapper around `poll` on Unix) 
returns 1 in three situations:
     1. `nfds` is non-zero and `poll` returns an error that's not EINTR
     2. `nfds` is zero and the given timeout is negative
     3. `nfds` is zero and `poll` returns an error _including EINTR_
   
   Let's dive a bit into google-cloud-cpp. There are two similar functions 
named `WaitForHandles` (`CurlImpl::WaitForHandles` and 
`CurlDownloadRequest::WaitForHandles). Both call `curl_multi_wait` with zero 
extra file descriptors and a hard-coded positive timeout. This eliminates the 
"negative timeout" situation above.
   
   We are left with an error returned from `poll`. According to the Linux man 
page, these can be:
   ```
          EFAULT fds points outside the process's accessible address space.  The
                 array given as argument was not contained in the  calling  pro‐
                 gram's address space.
   
          EINTR  A signal occurred before any requested event; see signal(7).
   
          EINVAL The nfds value exceeds the RLIMIT_NOFILE value.
   
          ENOMEM Unable to allocate memory for kernel data structures.
   ```
   
   We can eliminate EFAULT as `curl_poll` ensures the fds point to accessible 
memory.
   EINVAL is extremely unlikely given a limit of 1048576 open files in 
https://github.com/apache/arrow/issues/35318#issuecomment-1552161651 .
   ENOMEM cannot be ruled out, but I guess exhaustion of kernel data space 
would manifest randomly in other ways?
   
   This leaves us with EINTR, which can happen in the case that 
`curl_multi_wait` [doesn't find any file 
descriptors](https://github.com/curl/curl/blob/a9f8fe28481fef7c28d85b4a12a3a35521408eaf/lib/multi.c#L1185-L1207)
 to wait for.
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to