Skip to content

fix: Let an interrupt abort an HTTP VFS transfer - #843

Open
krlmlr wants to merge 1 commit into
claude/httpvfs-timeoutsfrom
claude/httpvfs-interrupt
Open

krlmlr wants to merge 1 commit into
claude/httpvfs-timeoutsfrom
claude/httpvfs-interrupt

Conversation

@krlmlr

@krlmlr krlmlr commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

An interrupt could not abort a transfer of the HTTP VFS: Ctrl-C took effect only once the stall timeout of #842 ended the transfer. A progress callback now aborts the transfer when the user interrupts R, through R_ToplevelExec(), so that no longjmp crosses SQLite or libcurl; it uses CURLOPT_XFERINFOFUNCTION, or CURLOPT_PROGRESSFUNCTION with libcurl older than 7.32.0. An interrupted HEAD skips the GET, so one Ctrl-C aborts the open, which then fails with "unable to open database file", a query with "disk I/O error", as ?sqliteHttpConfig now says.

A new test, modeled on the busy-handler test, starts a callr session that loads the package, pins RSQLITE_HTTP_STALL_TIMEOUT to 60 seconds, has the session's sqliteRemote() wait for a server that never answers, interrupts it once the server has logged the HEAD, and expects "unable to open database file" well within the stall timeout; against the layer below, it times out. Both it and the busy-handler test now start their session with local_rsqlite_session(), which skips when the session would load a different copy of the package than the one under test, as under devtools::test(); they run under R CMD check.

The top of this stack has the same tree as fa0b234, the last head of the combined #832, merged with main, apart from the corrected sentence in ?sqliteHttpConfig from #842. At fa0b234, the full check matrix (macOS, Windows, arm64, R 4.2 to devel) was green on all 15 jobs, with the HTTP tests running on each (run).

Part of the stack that splits the earlier combined #832 into scoped pull requests, as the maintainer asked there. This code was reviewed as part of #832, in three clean reviews of the combined version; a clean review of the split found nothing in this layer, and what remains is under Accepted limitations.

https://claude.ai/code/session_01Hr1rd3gjmufoKCWVDBPCgE


Generated by Claude Code

krlmlr commented Nov 11, 2026

Copy link
Copy Markdown
Member Author

Accepted limitations

The clean review of the split found nothing in this pull request; the documentation fix of #842 is merged into it in caf086c. This remains from the reviews of the combined version:

  • src/vendor/extensions/http.c#L122-L126: the CURLOPT_PROGRESSFUNCTION fallback for libcurl before 7.32.0 compiles with the headers of libcurl 7.29.0, but was never linked against or run with such a library. Relevance: low; reviewer's confidence: medium.

Generated by Claude Code

A transfer of the HTTP VFS ended only when it completed, failed or timed out,
so an interrupt while R waited for a slow server took effect only after that.
A progress callback now aborts the transfer when the user interrupts R.
It checks for the interrupt through `R_ToplevelExec()`, so that no longjmp crosses SQLite or libcurl,
and the aborted transfer fails the open with "unable to open database file" and a query with "disk I/O error".
It uses `CURLOPT_XFERINFOFUNCTION`, or `CURLOPT_PROGRESSFUNCTION` with libcurl older than 7.32.0,
and a handle on which it cannot be set is not used.
An interrupted HEAD request skips the GET that would follow it,
so one interrupt aborts the open, as `?sqliteHttpConfig` now says.

A new test, modeled on the busy-handler test, starts a callr session that loads the package,
has its `sqliteRemote()` wait for a server that never answers with a stall timeout of 60 seconds,
interrupts it once the server has logged the HEAD,
and expects "unable to open database file" well within the stall timeout.
Both tests that run the package in a callr session, this one and the busy-handler test in `test-dbConnect.R`,
start it with the new `local_rsqlite_session()`.
It skips when the session would load another copy of the package than the one under test,
as under `devtools::test()`, where the busy-handler test used to fail without an installed copy.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Hr1rd3gjmufoKCWVDBPCgE

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants