title: R, httr, and an unstoppable error message
body: <p>In summary, I'm finding that when running httr::POST against a plumber api, within an R.utils::withTimeout, the post is throwing an error message which can't be suppressed. The error message is:</p>
  <pre><code>Error in .Call(R_curl_fetch_memory, enc2utf8(url), handle, nonblocking) : reached elapsed time limit
  </code></pre>
  <p>Things I've tried:</p>
  <ol>
  <li>suppressmessages/warnings</li>
  <li>tryCatch with no error response</li>
  <li>Using sinks</li>
  </ol>
  <p>I can't think of any other way of stopping this error. The code carries on running but it's resulting in users of the api getting spammed with error messages when checking for an available port to call. Any ideas welcome.</p>
  <p>Reproducible example (note this uses rstudio jobs pkg and a separate plumber file, but i've tried without the jobs pkg and the issue persists so it's not connected to that.) :</p>
  <p>plumber.R:</p>
  <pre><code>#* quick ping
  #* @post /ping
  function() {
      list(msg = &quot;you got here!&quot;)
  }
  
  #* slow 10s call
  #* @post /slowfxn
  function() {
      Sys.sleep(10)
      1
  }
  </code></pre>
  <p>code which calls and produces errors:</p>
  <pre><code>#run the plumber file in a separate job: 
  r &lt;- plumber::plumb(&quot;errortest/plumber.R&quot;)
  job::job({r$run(swagger = F,port = 1111)})
  
  #this function will throw the error if no response comes within 3s: 
  call_with_timeout = function() { 
    R.utils::withTimeout(
      rawToChar(httr::POST(&quot;http://127.0.0.1:1111/echo&quot;)$content)
      ,timeout = 3,onTimeout = &quot;silent&quot;)
  }
  
  #now call the fxn (again in a job) which takes 10 s to run: 
  job::job({httr::POST(url = &quot;http://127.0.0.1:1111/slowfxn&quot;)})
  
  #wait a second for that job to be initiated: 
  Sys.sleep(1)
  #while that's running, try and call the quick fxn, with a 3 second timeout: 
  
     
  #try wrap it in a trycatch to suppress: 
  tryCatch( {
    call_with_timeout()
    },
    error = function(x) {},
    TimeoutException = function(x){},
    warning = function(x) {}
  )
  
  suppressMessages(suppressWarnings(call_with_timeout()))
  
  #not even a sink can stop it! 
  sink(&quot;delete.txt&quot;)
  
  call_with_timeout()
  
  sink(NULL)
  
   
  </code></pre>