Asciinema: Upload fails with "Broken Pipe"

Created on 28 Jan 2019  ·  7Comments  ·  Source: asciinema/asciinema

$ asciinema upload /var/folders/v2/g27ngtds20zg60cy_f2jb_l80000gn/T/tmpub1dsng9-ascii.cast
asciinema: upload failed: <urlopen error [Errno 32] Broken pipe>
asciinema: retry later by running: asciinema upload /var/folders/v2/g27ngtds20zg60cy_f2jb_l80000gn/T/tmpub1dsng9-ascii.cast

Here is the app in tmp-folder

$ exa -l  /var/folders/v2/g27ngtds20zg60cy_f2jb_l80000gn/T/tmpub1dsng9-ascii.cast
.rw------- 5.8M user 28 Jan 16:33 /var/folders/v2/g27ngtds20zg60cy_f2jb_l80000gn/T/tmpub1dsng9-ascii.cast

All 7 comments

Not sure why you aren't getting a proper error message but there is 5M limit on upload files. See #91

Yes, that's size limit issue.

asciinema does have error handler for status 413 (which is returned by web server in this case) but it seems it's never properly handled due to how Python's urllib operates. You can read more about the problem here: https://github.com/kennethreitz/requests/issues/2422#issuecomment-184012765

Ran into the same problem today. What do you think about a stopgap measure of emitting a warning client side if the file to be uploaded is over 5M?

I'm regularly running into it well below the 5M limit.

[schwarzgerat](2) $ ls -l /tmp/user/1000/tmpaxpadd2n-ascii.cast 
-rw------- 1 dank dank 592498 2020-01-05 08:57 /tmp/user/1000/tmpaxpadd2n-ascii.cast
[schwarzgerat](0) $ asciinema upload /tmp/user/1000/tmpaxpadd2n-ascii.cast 
asciinema: upload failed: <urlopen error [Errno 32] Broken pipe>
asciinema: retry later by running: asciinema upload /tmp/user/1000/tmpaxpadd2n-ascii.cast
[schwarzgerat](1) $ 

That one's only 600K. Plays perfectly locally.

Can reproduce here:

$ asciinema upload display_sweep.cast
asciinema: upload failed: <urlopen error [Errno 32] Broken pipe>
asciinema: retry later by running: asciinema upload display_sweep.cast

$ ll -h display_sweep.cast
-rw-r--r-- 1 nicoo nicoo 2.3M Jan 14 21:29 display_sweep.cast

Same thing happens on smaller files too. I tried to reproduce with curl but this worked fine:

$ curl --http1.1 -v -u $USER:$(cat ~/.config/asciinema/install-id) https://asciinema.org/api/asciicasts -F asciicast=@display_sweep.cast
*   Trying 109.107.38.78:443...
* TCP_NODELAY set
* Connected to asciinema.org (109.107.38.78) port 443 (#0)
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: CN=asciinema.org
*  start date: Jan 16 08:09:20 2020 GMT
*  expire date: Apr 15 08:09:20 2020 GMT
*  subjectAltName: host "asciinema.org" matched cert's "asciinema.org"
*  issuer: C=US; O=Let's Encrypt; CN=Let's Encrypt Authority X3
*  SSL certificate verify ok.
* Server auth using Basic with user 'nicoo'
> POST /api/asciicasts HTTP/1.1
> Host: asciinema.org
> Authorization: Basic XXXXSECRETVALUEHERE
> User-Agent: curl/7.67.0
> Accept: */*
> Content-Length: 2332762
> Content-Type: multipart/form-data; boundary=------------------------8506bb168e19a8c6
> Expect: 100-continue
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 100 Continue
* We are completely uploaded and fine
* Mark bundle as not supporting multiuse
< HTTP/1.1 201 Created
< Cache-Control: max-age=0, private, must-revalidate
< Content-Length: 78
< Content-Type: text/plain; charset=utf-8
< Date: Fri, 17 Jan 2020 16:47:43 GMT
< Location: https://asciinema.org/a/ucRJ70xKSlhN1QlmMW0BdSUBf
< Server: Caddy
< Server: nginx
< Strict-Transport-Security: max-age=15768000
< X-Request-Id: 2nlbkv35ad6doecmo07jcdm2
< 
View the recording at:

    https://asciinema.org/a/ucRJ70xKSlhN1QlmMW0BdSUBf
* Connection #0 to host asciinema.org left intact

This seems to be an issue specific to asciinema's HTTP API client; I encountered it even when installing asciinema form pip in a fresh venv; the local python version is 3.7.5 (as packaged in Debian 11/testing)

Not sure why you aren't getting a proper error message but there is 5M limit on upload files. See #91

This should be an FAQ item.

As soon as I saw that "broken pipe" repeated twice, I suspected my 6.3M cast exceeded the upload limit.

But actually finding this thread took... uhhh... 24 minutes. Around 15 of which I was messing with discobot certification, hoping that'd allow me to post the question in the FAQ discourse section (it didn't).

I'm getting this error with a small one:

```sontek@hulk:/mnt/c/Users/sontek/code/snowmachine$ exit
asciinema: recording finished
asciinema: press to upload to asciinema.org, to save locally
asciinema: upload failed:
asciinema: retry later by running: asciinema upload /tmp/tmpe_sntawl-ascii.cast
sontek@hulk:/mnt/c/Users/sontek/code/snowmachine$ du -sh /tmp/tmpe_sntawl-ascii.cast
184K /tmp/tmpe_sntawl-ascii.cast
sontek@hulk:/mnt/c/Users/sontek/code/snowmachine$

Tried uploading it later too:

sontek@hulk:/mnt/c/Users/sontek/code/snowmachine$ asciinema upload /tmp/tmpe_sntawl-ascii.cast
asciinema: upload failed:
asciinema: retry later by running: asciinema upload /tmp/tmpe_sntawl-ascii.cast
```

Was this page helpful?
0 / 5 - 0 ratings

Related issues

omaraboumrad picture omaraboumrad  ·  10Comments

ethanboxx picture ethanboxx  ·  6Comments

bashfulrobot picture bashfulrobot  ·  11Comments

yuvalif picture yuvalif  ·  10Comments

lebinh picture lebinh  ·  3Comments