Skip to content

RStudio 2026.05.0 — 60s startup delay on PPM vulnerability check after upgrade from 2026.04.0 #17807

Closed

Description

@hunk383

Summary

After upgrading RStudio Desktop from 2026.04.0-526 to 2026.05.0-218 on Ubuntu 24.04 (Noble),
RStudio takes exactly 60 seconds to become usable at startup (Packages pane empty, all menus
unresponsive) when both of the following conditions are true:

  • The R curl package is installed
  • .Rprofile sets the repo to Posit Package Manager (PPM) for Noble

Removing either condition eliminates the delay. Rolling back to 2026.04.0 eliminates the delay.
Three other systems upgraded from 2026.01.x → 2026.05.0 (skipping 2026.04.0) do not
exhibit this issue, despite identical curl installation and .Rprofile configuration.


Environment

Property Value
OS Ubuntu 24.04 LTS (Noble)
RStudio affected 2026.05.0-218
RStudio prior 2026.04.0-526
Upgrade path 2026.04.0-526 → 2026.05.0-218
R version (system R on Noble)
curl R package installed
.Rprofile repo https://packagemanager.posit.co/cran/__linux__/noble/latest

Steps to reproduce

  1. Install RStudio 2026.04.0-526 on Ubuntu 24.04
  2. Use .Rprofile with:
    options(repos = c(CRAN = "https://packagemanager.posit.co/cran/__linux__/noble/latest"))
  3. Ensure R curl package is installed
  4. Upgrade to RStudio 2026.05.0-218
  5. Start RStudio Desktop with no project open
  6. Observe ~60s delay before Packages pane populates and menus become responsive

Observed behaviour

  • RStudio starts but is unresponsive for exactly 60 seconds
  • During the delay, ss -tp shows rsession holding an established HTTPS connection to
    packagemanager.posit.co (AWS us-east-2 range)
  • After 60 seconds, startup completes normally
  • rsession-user.log shows no relevant entries during the delay

After flushing OS-level TCP connection metrics (sudo ip tcp_metrics flush) and adding
temporary curl tracing to .Rprofile, the delay disappears and the following error appears
in rsession-user.log:

ERROR PPM vulnerability request to https://packagemanager.posit.co/__api__/filter/packages
failed: subscript out of bounds

(logged twice per startup)


Root cause analysis

The issue has two distinct components:

1. OS-level TCP connection state poisoned by 2026.04.0

RStudio 2026.04.0 inadvertently removed the /repos/{repo}/vulns endpoint (per issue #17446).
During normal use under 2026.04.0, the Linux kernel cached a broken/timed-out TCP connection
metric for packagemanager.posit.co. When 2026.05.0 starts and attempts the vulnerability
check, the OS reuses this cached metric, causing the connection to hang for a full 60s TCP
timeout rather than failing fast.

Systems that never ran 2026.04.0 (upgraded from 2026.01.x) do not have this poisoned TCP
state and therefore do not exhibit the delay.

Workaround for the TCP state: sudo ip tcp_metrics flush

2. "subscript out of bounds" error in the vulnerability check R code

Once the TCP state is flushed, RStudio 2026.05.0 correctly calls the new
/__api__/filter/packages endpoint (as intended by the fix in #17446). However, the R code
that parses the JSON response from this endpoint throws subscript out of bounds, meaning
it indexes into the response object incorrectly. The vulnerability check therefore always
fails silently on this system, even when the network call completes.

This second bug means the vulnerability check is never actually completing successfully
on systems with this configuration.


Additional observations

  • With options(repos = c(CRAN = "https://cran.rstudio.com")) (non-PPM URL), no delay and
    no error — the vulnerability check is skipped entirely when a non-PPM repo is configured
  • The error fires twice per startup (possibly once per library path)
  • No relevant state is stored in ~/.config/rstudio/rstudio-prefs.json,
    ~/.local/share/rstudio/persistent-state, or ~/.local/share/rstudio/rstudio-desktop.json
    — this is not a cached configuration issue

Related


Suggested fixes

  1. RStudio installer / upgrade script: flush OS TCP metrics for packagemanager.posit.co
    when upgrading from 2026.04.0, or document this as a required post-upgrade step
  2. Vulnerability check R code: fix the subscript out of bounds error when parsing the
    /__api__/filter/packages JSON response
  3. Timeout: reduce the vulnerability check HTTP timeout from 60s to something shorter
    (e.g. 5s) so that network failures do not block RStudio startup

Activity

  1. added
    new
    on Jun 1, 2026
  2. added
    startup
    on Jun 1, 2026
  3. added theissue type on Jun 1, 2026
  4. self-assigned this
    on Jun 1, 2026
  5. added this to the Golden Wattle milestone on Jun 1, 2026
  6. kevinushey commented on Jun 4, 2026

    @kevinushey
    Collaborator

    Fixed in #17808.

  7. hunk383 commented on Jun 18, 2026

    @hunk383
    Author

    Follow-up after upgrading to 2026.05.1-225:

    The 60s startup freeze is gone — the async fix works correctly.

    However the vulnerability check still times out on every startup:

    ERROR PPM vulnerability request to https://packagemanager.posit.co/__api__/filter/packages 
    timed out after 30s; closing connection
    

    System curl POSTs to the same endpoint return instantly (HTTP 400 — missing required fields, as expected for a bare request). So PPM is reachable and responsive. The timeout is specific to RStudio's TcpIpAsyncClientSsl client.

    Environment:

    The feature appears partially fixed — no freeze, but no badges either. System curl negotiates HTTP/2 via ALPN with PPM. If TcpIpAsyncClientSsl is HTTP/1.1 only, a protocol mismatch after TLS handshake would explain the 30s stall — matching the scenario described in the kRequestTimeout comment in SessionPPM.cpp.

  8. gtritchie commented on Jun 18, 2026

    @gtritchie
    Member

    Cross reference: #18021

    Related defect found during investigation (trailing-slash detection):

    .rs.ppm.fromRepositoryUrl matched with a fully-anchored regex ending in (?[^/]+)$, so a PPM repo URL with a trailing slash (e.g. .../cran/latest/) did not match. RStudio's own CRAN-mirror UI normalizes repo URLs with a trailing slash, so users who configured a PPM repo that way silently received no vulnerability badges -- the feature #17823 was meant to deliver to desktop. The detection regex now tolerates an optional trailing slash.

  9. kevinushey commented on Jun 19, 2026

    @kevinushey
    Collaborator

    Thanks for the detailed follow-up and for digging into this -- the curl comparison and the TcpIpAsyncClientSsl-specific observation are really helpful.

    I spent some time investigating the HTTP/2 hypothesis and I don't think it's the culprit, though for a reason that turns out to be useful. ALPN is a negotiation: the server only selects a protocol the client advertises in its ClientHello. RStudio's client doesn't advertise h2 at all, so PPM falls back to HTTP/1.1 -- the fact that your curl negotiates h2 just means the server supports it, not that RStudio's connection uses it. (And if a server ever did speak HTTP/2 to an HTTP/1.1 client, you'd see an immediate response-parse error, not a 30s stall.)

    To check this concretely, I drove the actual TcpIpAsyncClientSsl against packagemanager.posit.co with the same request RStudio sends, and it completed in ~0.3s with a normal 200 and the expected NDJSON body. Forcing curl --http1.1 to PPM also shows the server returning Connection: close and closing the socket cleanly. So PPM itself looks healthy over HTTP/1.1 from where I'm testing.

    That said, your report did surface a genuine latent issue. RStudio's async HTTP client terminates a non-chunked response only when the connection closes (EOF) -- it doesn't stop early based on Content-Length. It sends Connection: close and depends on the server honoring it. I reproduced this with a local server: when the server returns a complete Content-Length response but holds the socket open, the client hangs for the full timeout and then discards the (already fully received) body -- which matches your symptoms exactly, including why no badges appear.

    The piece that would explain your environment specifically is something keeping that connection open -- typically a proxy or a TLS-terminating middlebox between rsession and PPM that doesn't honor (or strips) Connection: close. curl survives this because libcurl stops reading once it has Content-Length bytes; our client currently doesn't. This also fits your earlier observation that the OS TCP state mattered.

    A couple of things that would help confirm:

    1. Do you have an http_proxy / https_proxy set, or a corporate proxy/firewall in front of packagemanager.posit.co?
    2. If feasible, a short tcpdump/Wireshark capture of the PPM connection during startup -- specifically whether the response is Content-Length vs chunked, and whether the server actually sends a FIN after the body.

    Independently, I think it's worth making the client stop reading once a Content-Length-delimited body is fully received, so a connection that's held open fails fast (or better, succeeds) instead of stalling. I'll look into that as a robustness fix regardless of the proxy question.

    Thanks again for the thorough analysis -- it pointed at a real gap even though the HTTP/2 angle wasn't the cause.

  10. hunk383 commented on Jun 19, 2026

    @hunk383
    Author

    Thank you and all the team for your work and the time you are spending on this. Please note that I usually run updates regularly. That also could explain why there are no badges, though not the delays or timeouts.

    1. Do you have an http_proxy / https_proxy set, or a corporate proxy/firewall in front of packagemanager.posit.co?

    No. EliteBook laptop but not used with business or corporate settings/firewall. I do not have any system proxy variables set.

    Before going on with the capture of the PPM connection, I wanted to rule out one thing. And I did a direct httr2/OSV check. If these are not sufficient, I'll do the capture.

    Ruling out ISP/CGNAT/MTU

    In order to rule out ISP potential issues, I used a phone's hotspot (shared wifi from LTE) and a desktop PC. I installed R and the same deb 1-225 on a desktop Ubuntu 26.04 (R and RStudio Desktop are installed for the first time on that system).

    First, there were no badges. Then I added options to use PPM in Rprofile. Still no badges appeared.

    So I installed a known vulnerable commonmark package (version 1.8.1), and a badge did show (yellow warning sign). I did the same on the 30s timeout system, the timeouts persisted.

    The test established the following:

    • New Ubuntu 26.04 system, same phone LTE, badges work ✓
    • Affected system, same phone LTE, still 30s timeout ✗

    The ISP/CGNAT/MTU theory is eliminated. Both systems use the identical network path (same phone, same LTE connection). The problem is specific to the affected machine, not the network.

    httr2/OSV check:

    The affected system has more than 220 packages. Could the high number of packages or some specific packages be related to the issue? I started with eliminating httr2. Hiding its folder did not prevent the 30s timeout.

    So I went on with a direct check:

    install.packages("httr2")
    library(httr2)
    
    check_osv <- function(pkg) {
      resp <- request("https://api.osv.dev/v1/query") |>
        req_body_json(list(package = list(name = pkg, ecosystem = "CRAN"))) |>
        req_perform()
      resp_body_json(resp)
    }
    
    check_osv("commonmark")

    check_osv("commonmark") returned vulnerability data instantly from the R console on the affected machine. Does it prove that the network stack works fine for R-level HTTP calls, and that the issue is isolated purely to TcpIpAsyncClientSsl ?

  11. kevinushey commented on Jun 19, 2026

    @kevinushey
    Collaborator

    That also could explain why there are no badges, though not the delays or timeouts.

    The other possibility is an unfortunate bug that slipped through, where repository URLs with a trailing slash, e.g. https://packagemanager.posit.co/cran/latest/ were inadvertently ignored when determining if vulnerability data might be available.

    If that might be the case, there's a fix for this in the latest daily builds here:

    https://dailies.rstudio.com

    and will be part of an upcoming release.

  12. hunk383 commented on Jun 19, 2026

    @hunk383
    Author

    Thanks for the heads-up regarding the trailing slash bug! For reference, my .Rprofile is set to options(repos = c(CRAN = "https://packagemanager.posit.co/cran/__linux__/noble/latest")) (no trailing slash), so I don't believe I was hitting that specific edge case.

    To further isolate the issue, I ran an additional test. I used standard httr2 (backed by libcurl) to query the exact same Posit Package Manager endpoint that RStudio is choking on: https://packagemanager.posit.co/__api__/filter/packages.

    The httr2 result:

    [1] "HTTP Error: HTTP 404 Not Found."
       user  system elapsed 
      0.284   0.008   0.913 

    The network transaction completes in less than 1 second. (The 404 is expected without the proper POST body/params, but the connection works instantly). I have also verified my ufw/iptables rules are default, and direct api.osv.dev queries return massive JSON payloads instantly.

    The RStudio result:
    As seen in my previous logs, RStudio hangs for exactly 30 seconds on that exact endpoint:

    ERROR PPM vulnerability request to https://packagemanager.posit.co/__api__/filter/packages timed out after 30s; closing connection; LOGGED FROM: void rstudio::session::modules::ppm::{anonymous}::onVulnerabilityTimeout(...) src/cpp/session/modules/SessionPPM.cpp:277
    

    Conclusion:
    Because the request is being attempted (it's not silently ignored due to a trailing slash), this proves the timeout is isolated to TcpIpAsyncClientSsl. Posit's servers are using standard HTTP Keep-Alive and holding the TCP socket open. libcurl respects the Content-Length header and terminates the read successfully. RStudio's custom client appears to be waiting for an EOF (TCP FIN) that the server isn't sending, causing it to hit the hardcoded 30s timeout in SessionPPM.cpp and discard the data.

    I'll hold off on testing the daily builds for now to see if the team has any other insights or if they can confirm whether the Content-Length fix for TcpIpAsyncClientSsl has already been merged into the current dailies.

  13. kevinushey commented on Jun 19, 2026

    @kevinushey
    Collaborator

    Thanks for digging into this. One thing about the OSV check that I think makes it inconclusive:

    check_osv() hits https://api.osv.dev/v1/query -- a different service entirely from the one RStudio's vulnerability check uses, which is https://packagemanager.posit.co/__api__/filter/packages. Different host, different TLS endpoint, different network path. So an instant response from OSV tells us libcurl-over-HTTPS works on the box in general, but it doesn't exercise the connection that's actually timing out. (Your earlier system-curl POST to the real PPM endpoint -- the instant HTTP 400 -- is the more relevant data point.)

    But there's a deeper reason the httr2 route is unlikely to settle it even if you point it at the correct PPM endpoint: libcurl and our client terminate a response differently. libcurl stops reading as soon as it has received Content-Length bytes. Our TcpIpAsyncClientSsl keeps reading until the server actually closes the connection (EOF) -- which is why we send Connection: close and rely on the server honoring it. The failure mode I suspect here is a complete response body followed by the socket being held open instead of closed. libcurl wouldn't notice that (it already has all the bytes and moves on), so an httr2 call would succeed regardless. In other words, httr2 succeeding is consistent both with "the network is fine and our client has a bug" and with "something is holding the connection open and libcurl just tolerates it" -- it can't distinguish the two.

    That's why the packet capture is still the thing that would actually resolve it: during startup, is the PPM response Content-Length-delimited or chunked, and does a FIN arrive right after the body, or does the socket stay open until the 30s timeout fires?

  14. hunk383 commented on Jun 20, 2026

    @hunk383
    Author

    Thank you Kevin for the detailed explanation and for driving TcpIpAsyncClientSsl directly against PPM — that level of investigation goes well beyond what I expected.

    I ran the tcpdump capture as requested. The results confirm your hypothesis precisely.

    Two connections to 3.140.36.90 show identical behavior:

    • TCP handshake completes ✓
    • TLS completes ✓
    • POST sent, server returns 8680 bytes ✓
    • Server then holds the socket open — no FIN
    • Exactly 30 seconds later, RStudio sends FIN
    • Server responds with RST

    For contrast, a simultaneous connection to 18.225.141.164 completes successfully with a clean FIN after receiving a large response.

    This matches your description exactly: complete Content-Length response body received, socket held open, TcpIpAsyncClientSsl waits for EOF that never arrives, 30s timeout fires.

    Could you let me know the best way to share the full capture privately? I'd prefer not to post it publicly due to the hostname visible in the text output.

  15. hunk383 commented on Jun 21, 2026

    @hunk383
    Author

    Following up with additional findings from progressive package library testing.

    Setup: Started with an empty R library. Confirmed badges work correctly with commonmark 1.8.1 installed (yellow warning badge appears immediately). The timeout is therefore not a machine-level network issue but triggered by the package list sent to PPM.

    Progressive testing results:

    • 0 packages → no timeout, badges work ✓
    • 1–35 packages (a–curl alphabetically) → no timeout ✓
    • fAsianOptions added to 49 others → timeout ✗
    • 49 packages without fAsianOptions → no timeout ✓
    • 49 + 50 additional packages (without fAsianOptions) → timeout ✗

    Observations:

    1. fAsianOptions appears to be a specific trigger — its presence alone causes timeout when combined with ~49 other packages
    2. A sufficiently large package list (~100+) also triggers the timeout independently
    3. The behavior has some non-determinism — the same package set occasionally does not timeout, consistent with CDN pool rotation (different PPM server instances behave differently)

    This suggests the timeout probability increases with response size, and certain packages (fAsianOptions) may produce disproportionately large PPM metadata responses.

    The full tcpdump capture is available to share privately — please let me know your preferred method.

  16. kevinushey commented on Jun 21, 2026

    @kevinushey
    Collaborator

    Thank you! I'll see if I can reproduce with fAsianOptions this coming week.

    If you can, please share the tcpdump capture with me -- e-mail is [email protected].

  17. kevinushey commented on Jun 22, 2026

    @kevinushey
    Collaborator

    I'm able to reproduce a hang with a (synthetic) request of vulnerabilities for fAsianOptions==1.0.0, using the API guide at https://packagemanager.posit.co/__api__/swagger/index.html#/default/post_filter_packages, so it's also plausible that there is a PPM issue here. I'll forward this specific reproduction case over to the PPM team -- thanks for reporting!

  18. hunk383 commented on Jun 22, 2026

    @hunk383
    Author

    To investigate how PPM serves vulnerability data, I wrote a custom R helper function, check_ppm(), using httr2. This function hits PPM's internal package filter endpoint (/__api__/filter/packages) via a JSON POST request and parses the resulting NDJSON response into an R list.

    Testing with this helper function reveals a specific connection-handling discrepancy between these packages:

    • check_ppm("fAsianOptions") — Hits the script's !resp_has_body(resp) guard clause because the server returns a completely empty response body. However, the connection is not terminated cleanly; the server holds the socket open until a 30s timeout fires. Progressive testing confirms that fOptions shares this exact behavior.

    • check_ppm("commonmark==1.8.1") — Instantly returns a structured NDJSON payload containing vulnerability records (specifically the RSEC-2023-8 DoS vulnerability details). The data parses cleanly, and the connection closes immediately without a timeout.


    **The PPM bug: fAsianOptions and fOptions **

    Package Vulnerability data PPM behavior
    commonmark==1.8.1 Yes Responds instantly, closes connection ✓
    fAsianOptions None Responds with empty body, holds socket open ✗
    fOptions None Responds with empty body, holds socket open ✗

    The observed timeout behavior is specific to fAsianOptions and fOptions. For these packages, both PPM and OSV return no vulnerability data, yet the request results in a timeout. This does not occur for other packages that also have no vulnerability data, nor for packages such as commonmark==1.8.1, which do return known vulnerability information and complete successfully without timing out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugescapeenewpackage managerpackagesstartupsupport

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions