QutEcoacoustics / baw-client

The AngularJS client for the bioacoustic workbench
Other
7 stars 1 forks source link

WAV files not dowloading at full length #325

Closed JessieLOliver closed 6 years ago

JessieLOliver commented 6 years ago

Today I wanted to download 30 second wave files from my CWS data for a prototype I am creating. When clicking the link to download a wave file from the desired listen page, a new tab is opened with player and download icons. Which clicking play, only 2 to 6 seconds play for the 2 segments I tried. When downloading them, only this short segment played as well. I then attempted to play and download the MP3 from the download tab and this seemed to work ok.

If at all possible this is an urgent issue for me, as I have a prototype due Monday and need a lot of audio via wav files to import into PPT. Mp3s apparently can't be imported. Please call if you have questions.

On a similar but marginally related note, when I tried to import the WAV files into PowerPoint I just got horrible static that was about 30 seconds long.

Clips I tried were: https://www.ecosounds.org/listen/262857?start=5744 https://www.ecosounds.org/listen/262853?start=2205&end=2235

JessieLOliver commented 6 years ago

OK, so apparently you can import both WAV and mp3 files as inserting audio, but if you are trying to insert an action into a shape only WAV files are accepted. I'm trying to make an interactive prototype, so being able to have action buttons would be great for design exploration.

atruskie commented 6 years ago

There's likely nothing that can be done this weekend. I suggest you find a way to work around the issue. Theres a an odd issue with the database server I may be able to look into but it may be unrelated.

JessieLOliver commented 6 years ago

OK, I will try the first option as I suspect that would be quickest for me at this moment. Thanks for the work around ideas!

atruskie commented 6 years ago

I've done a little triage on this. The issue seems to be related to the byte-range headers. If a file requires more than 512000 bytes (e.g. 1323078 bytes), it is split into two packets. The first request is successful (response code 206 Partial Content). The second request, for range bytes=512000-1323077 fails with a 400 Bad Request. However, there's no indication what the error is - no error emails are sent and Chrome doesn't show any of the body. Replaying the request in curl does replicate the error:

C:\Users\Anthony> curl.exe 'https://www.ecosounds.org/audio_recordings/262853/media.wav?end_offset=2295&start_offset=2265&user_token=[REDACTED]' -H 'Accept-Encoding: identity;q=1, *;q=0' -H 'Accept-Language: en-US,en;q=0.9' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36' -H 'Accept: */*' -H 'Referer: https://www.ecosounds.org/audio_recordings/262853/media.wav?end_offset=2295&start_offset=2265&user_token=[REDACTED]' -H 'Cookie: XSRF-TOKEN=[REDACTED]; _AWB_session=[REDACTED]' -H 'Connection: keep-alive' -H 'If-Range: "9d0dade2ffed76d64f97ae6905c51a3e407b257af6fb2bd97680e6c43ab3aaa6"' -H 'Range: bytes=512000-1323077' --compressed --verbose
*   Trying 203.101.226.156...
* TCP_NODELAY set
* Connected to www.ecosounds.org (203.101.226.156) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
  CApath: none
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* NPN, negotiated HTTP1.1
* 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, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Unknown (67):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: C=AU; ST=QLD; L=Brisbane; O=Queensland University of Technology; OU=SEF; CN=*.ecosounds.org
*  start date: Sep  5 03:07:08 2016 GMT
*  expire date: Sep  5 03:07:03 2018 GMT
*  subjectAltName: host "www.ecosounds.org" matched cert's "*.ecosounds.org"
*  issuer: C=BM; O=QuoVadis Limited; CN=QuoVadis Global SSL ICA G2
*  SSL certificate verify ok.
> GET /audio_recordings/262853/media.wav?end_offset=2295&start_offset=2265&user_token=[REDACTED] HTTP/1.1
> Host: www.ecosounds.org
> Accept-Encoding: identity;q=1, *;q=0
> Accept-Language: en-US,en;q=0.9
> User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36
> Accept: */*
> Referer: https://www.ecosounds.org/audio_recordings/262853/media.wav?end_offset=2295&start_offset=2265&user_token=[REDACTED]
> Cookie: XSRF-TOKEN=[REDACTED]; _AWB_session=[REDACTED]
> Connection: keep-alive
> If-Range: 9d0dade2ffed76d64f97ae6905c51a3e407b257af6fb2bd97680e6c43ab3aaa6
> Range: bytes=512000-1323077
>
< HTTP/1.1 400 Bad Request
< Server: nginx
< Date: Sat, 03 Feb 2018 06:05:15 GMT
< Content-Type: audio/wav
< Transfer-Encoding: chunked
< Connection: keep-alive
< Status: 400 Bad Request
< Vary: Origin
< X-Request-Id: 3c8692e3-3ca6-4a85-82d5-15382083ee9a
< Accept-Ranges: bytes
< X-Frame-Options: SAMEORIGIN
< X-Error-Type: Custom Errors/Bad Request Error
< X-Media-Elapsed-Seconds-Processing: 0
< Cache-Control: no-cache
< X-Media-Response-From: Cache
< X-XSS-Protection: 1; mode=block
< X-Media-Response-Start: Sat, 03 Feb 2018 06:05:14 GMT
< X-Runtime: 0.074769
< X-Content-Type-Options: nosniff
< X-Rack-CORS: preflight-hit; no-origin
< Set-Cookie: _AWB_session=[REDACTED]; path=/; HttpOnly
< X-Powered-By: Phusion Passenger 5.1.8
<
* Connection #0 to host www.ecosounds.org left intact

The X-Error-Type header indicates this request is hitting our code in the rails app.

It should be noted that this issue is not reproduced when the cache is disabled.

atruskie commented 6 years ago

This seems the same issue as https://github.com/QutEcoacoustics/baw-server/issues/332

Closing this one in favour of that