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

invalid 'n' argument in upload #64

Closed
vanatteveldt opened this issue Oct 28, 2014 · 7 comments
Closed

invalid 'n' argument in upload #64

vanatteveldt opened this issue Oct 28, 2014 · 7 comments

Comments

@vanatteveldt
Copy link

There is an intermittent problem where the server does not return a content-length.

This causes the error reported e.g. at

If I call rpubsupload a number of times with the same file and title, it 'sometimes' gives the error, in my session in at least 50% of cases. I've added a message(resp) to line 176, showing the received header.

This call went fine:

> result = rpubsUpload("Example topic browser xxy", "/tmp/test2.html")
Cache-Control: max-age=0, private, must-revalidate
Content-Type: application/json; charset=utf-8
Date: Tue, 28 Oct 2014 13:30:01 GMT
ETag: "8ade8190f20b4a00967f3f1fb3b8ba8f"
Location: https://api.rpubs.com/api/v1/document/38176/0f883efaaa1c49118b84ece0218447ed
Server: nginx/1.6.2 + Phusion Passenger 4.0.53
Status: 201 Created
X-Powered-By: Phusion Passenger 4.0.53
X-Rack-Cache: invalidate, pass
X-Request-Id: cdf501412d20e81a25967730072eb313
X-Runtime: 0.269665
X-UA-Compatible: IE=Edge,chrome=1
Content-Length: 87
Connection: Close
> result
$id
[1] "https://api.rpubs.com/api/v1/document/38176/0f883efaaa1c49118b84ece0218447ed"

$continueUrl
[1] "http://rpubs.com/publish/claim/38176/bbdc1337768f428193ed9c8c6e1384f7"

But the next one resulted in the error:

> result = rpubsUpload("Example topic browser xxy", "/tmp/test2.html")
Cache-Control: max-age=0, private, must-revalidate
Content-Type: application/json; charset=utf-8
Date: Tue, 28 Oct 2014 13:30:00 GMT
ETag: "3cf05a8930d104122878ce906536a9da"
Location: https://api.rpubs.com/api/v1/document/38175/1cb5825b225740a486757db30f560405
Server: nginx/1.6.2 + Phusion Passenger 4.0.53
Status: 201 Created
X-Powered-By: Phusion Passenger 4.0.53
X-Rack-Cache: invalidate, pass
X-Request-Id: 62966cf8c8a093f46651794a9acebbeb
X-Runtime: 0.281949
X-UA-Compatible: IE=Edge,chrome=1
transfer-encoding: chunked
Connection: Close

 Error in readBin(conn, what = "raw", n = contentLength) : 
  invalid 'n' argument 

I have been testing upload code so it is quite possible that there is something weird in my account (vanatteveldt), e.g. a lot of aborted upload attempts where I never visited the 'continue' page.

Note: the .Rprofile workaround suggested in the first link above did not solve the problem for me

vanatteveldt added a commit to vanatteveldt/markdown that referenced this issue Oct 28, 2014
)

Sometimes, the rpubs server doesn't return a content length. Since the n parameter can be an overestimate, it is safe to pick an arbitrary number here.
@vanatteveldt
Copy link
Author

I can confirm that the error no longer occurs after installing the patch, thanks a lot!

jcheng5 added a commit that referenced this issue Oct 29, 2014
yihui added a commit that referenced this issue Oct 29, 2014
@dnacombo
Copy link

It works for me.

remove.packages("markdown")
library(devtools)
install_github('rstudio/markdown')

rpubsUpload('test','test.html')

But not with the gui (clicking knit HTML, then 'publish' in the results window... I get the same

Error in readBin(conn, what = "raw", n = contentLength) : 
  invalid 'n' argument 

@yihui
Copy link
Member

yihui commented Nov 16, 2014

@dnacombo What is your RStudio version? If it is not the latest, please try to upgrade it: http://www.rstudio.com/products/rstudio/download/

@dnacombo
Copy link

Latest rstudio 0.98.1081
running R 3.1.1
knitr 1.8

2014-11-16 17:42 GMT+01:00 Yihui Xie [email protected]:

@dnacombo https://github.com/dnacombo What is your RStudio version? If
it is not the latest, please try to upgrade it:
http://www.rstudio.com/products/rstudio/download/

Reply to this email directly or view it on GitHub
#64 (comment).

@yihui
Copy link
Member

yihui commented Nov 16, 2014

I'm not sure which version this PR (rstudio/rstudio#186) eventually went to. Cc @jjallaire

@jjallaire
Copy link
Member

That fix is in RStudio 0.98.1087 so if you update to it then everything
should work fine.

J.J.

On Sun, Nov 16, 2014 at 3:37 PM, Yihui Xie [email protected] wrote:

I'm not sure which version this PR (rstudio/rstudio#186
rstudio/rstudio#186) eventually went to. Cc
@jjallaire https://github.com/jjallaire


Reply to this email directly or view it on GitHub
#64 (comment).

@pradym
Copy link

pradym commented Feb 22, 2015

I am using v .1091 still see the same problem.

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

No branches or pull requests

5 participants