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

"Data rewind wasn't possible" #794

Closed
erdnaxel opened this issue Oct 16, 2023 · 11 comments
Closed

"Data rewind wasn't possible" #794

erdnaxel opened this issue Oct 16, 2023 · 11 comments

Comments

@erdnaxel
Copy link

I have a script in which I read a pin, make changes to the data and then write the new data to the same pin.

I sometimes get the message:
"Error in curl::curl_fetch_memory(url, handle = handle) : necessary data rewind wasn't possible"

If I run the same pin_write line again, it works.

(I don't know how to make this a reproducible example. I have many scripts that operate on the same idea and that don't get this error. Even in this script, the error sometimes occur and sometimes doesn't.)

@juliasilge
Copy link
Member

I believe this may be related to #762.

Is this on Posit Connect? Or a different backend? If so, is there a chance the server you use in board_connect() now redirects?

@erdnaxel
Copy link
Author

It's Posit Connect, but my organization has its own server -- if that makes sense.

I use board_rsconnect() to connect.

I thought of maybe disconnecting and reconnecting before saving the new data, to reset everything, but I didn't find a function to disconnect.

@juliasilge
Copy link
Member

Definitely makes sense that your org has its own Connect server! Could you ask the folks who maintain your server if:

  • there are redirects for your server?
  • there is a proxy in front of your server?

We have observed both of those things to cause a "data rewind" curl error. If it's intermittent, that makes me think maybe it could be a proxy problem.

@erdnaxel
Copy link
Author

i stumbled on the cause of my problem. i had accidentally included the directory in the name of the pin ("username/table_name" instead of just "table_name"). i'm guessing the special character was causing the issue, even though it would still save (unreliably). once i gave the table a proper name, everything worked well.

it be worth adding adding a warning if the name includes forbidden characters.

@juliasilge
Copy link
Member

juliasilge commented Oct 30, 2023

Hmmmm @erdnaxel are you saying that the problem crops up when you include your username, like "julia.silge" here?

library(pins)

b <- board_connect()
#> Connecting to Posit Connect 2023.07.0 at <https://colorado.posit.co/rsc>
b |> pin_write(
    sample(1:100, 10), 
    "julia.silge/snazzy_numbers", 
    type = "json"
)
#> Writing to pin 'julia.silge/snazzy_numbers'

Created on 2023-10-30 with reprex v2.0.2

We definitely expect that to work and in fact recommend including your username when storing pins to Connect.

Or did you mean something else by "special character"?

@erdnaxel
Copy link
Author

erdnaxel commented Oct 31, 2023

ah, the plot thickens!

so the way that works for me is when i save using just the name of the table.

board_rsc %>% pin_write(table_to_save, "name_of_the_table")

when i save like that, it automatically puts it in my directory (username) and everything works well.

when i read the table, i have to put the directory so it knows where to look:

table <- board_rsc %>% pin_read("username/name_of_the_table")

the issue arose when i included the username while saving (which i did because i'm used to including it when reading).

board_rsc %>% pin_write(table_to_save, "username/name_of_the_table")

when i logged onto the web interface to look at my tables, i noticed that the name on the table on the server was username/name_of_the_table instead of just name_of_the_table.

by special character, i meant the forward slash. i thought that might be causing the issue, but based on what you said, that shouldn't create the issue.

@juliasilge
Copy link
Member

Yeah, the forward slash definitely should be fine and we generally recommend including the username. It is true that right now, when you write, it will write to different pins, which is not great. I'll open another issue on that.

Were you able to look into any of these possibilities?

Definitely makes sense that your org has its own Connect server! Could you ask the folks who maintain your server if:

  • there are redirects for your server?
  • there is a proxy in front of your server?

We have observed both of those things to cause a "data rewind" curl error. If it's intermittent, that makes me think maybe it could be a proxy problem.

Intermittent problems can be super hard to find but we've definitely had reports of other "data rewind" errors.

@juliasilge
Copy link
Member

I had one more thought here. Folks have gotten into trouble with the Connect user and content caches that pins used to use. If you install from GitHub, you'll get a version which (although slightly slower in some circumstances) will have fewer surprising failures. You might try using the development version to see if that avoids your intermittent problem:

pak::pak("rstudio/pins-r")

@juliasilge
Copy link
Member

Let us know if you have further questions! 🙌

@erdnaxel
Copy link
Author

erdnaxel commented Apr 29, 2024

Ah, sorry, I thought I had closed the loop on this, but I realize I hadn't.

I got a new laptop for work, so I had to reinstall packages, including the latest version of pins, and all the problems went away. The updated version of pins recommends using the username in the name of the pin, which I've done, and everything works well now.

Copy link

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators May 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants