Skip to content

Unable to upload large videos #15032

Open

Description

@guarani

Expected behavior

Uploading a very large video (e.g. larger than 500mb) to the Media Library (either from the Media Library itself or via the block editor's Video block) should work without error.

Actual behavior

Sometimes the video fails to upload.

Steps to reproduce the behavior

You'll need a large video for this (over 500mb) for either scenario below.

Scenario 1

  1. Open the WPiOS app and create a new post using the block editor
  2. Add a video block
  3. Choose the large video and wait for it to upload
  4. Observe the image upload fails (it's hard to say if this will happen every time)
  5. Go to the app activity log (Profile icon > Help & Support > Activity Logs > Current) and scroll to the bottom to see the latest logs
  6. Observe an error in the logs similar to:
2020-09-06 20:00:20:394 🔵 Tracked: media_service_upload_failed <error_code: -1001, error_description: Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo=

The request timed out., NSErrorFailingURLStringKey=https://public-api.wordpress.com/rest/v1.1/sites/xxxxxxxxxx/media/new?locale=en, NSErrorFailingURLKey=https://public-api.wordpress.com/rest/v1.1/sites/xxxxxxxxxx/media/new?locale=en, _kCFStreamErrorDomainKey=4}, error_domain: NSURLErrorDomain>

Scenario 2

  1. Open the WPiOS app and navigate to the Media Library
  2. Add the large video and wait for it to upload
  3. Observe the image upload fails
  4. Go to the app activity log (Profile icon > Help & Support > Activity Logs > Current) and scroll to the bottom to see the latest logs
  5. Observe the same error as before
Reported by user on an iPhone 11 Pro Max, iOS 13.6.1, WPiOS 15.5 (15.5.0.3)

Additional info


(internal reference: p4a5px-2D2-p2

Activity

  1. self-assigned this
    on Oct 1, 2020
  2. removed
    GutenbergEditing and display of Gutenberg blocks.
    on Oct 9, 2020
  3. guarani commented on Oct 22, 2020

    @guarani
    ContributorAuthor

    One possible lead here (noting down for future reference) is that when I background the WPiOS app during a video upload, I can pretty consistently reproduce a failed upload (app needs to be backgrounded for ~30 seconds).

    The logs show that the media_service_upload_failed happened as soon as I foregrounded the app (after it was in the background for 30 seconds) and the error is a "The network connection was lost."

    2020-10-02 17:39:15:548 🔵 Tracked: editor_video_added <blog_id: 181405924, bytes: 62974446592, duration_secs: 36, ext: mp4, media_origin: not_identified, mime: video/mp4, via: local_library>
    2020-10-02 17:39:15:566 🔵 Tracked: media_service_upload_started <blog_id: 181405924>
    2020-10-02 17:39:15:600 <WordPress.WordPressAppDelegate: 0x282308990> applicationWillResignActive(_:)
    2020-10-02 17:39:15:613 Stats Period: finished persisting Period Stats to disk.
    2020-10-02 17:39:16:258 <WordPress.WordPressAppDelegate: 0x282308990> applicationDidEnterBackground(_:)
    2020-10-02 17:39:16:268 🔵 Tracked: application_closed <last_visible_screen: Post Editor, time_in_app: 47, time_in_main_reader: 0, time_in_reader_filtered_list: 0, time_in_reader_post: 0>
    2020-10-02 17:39:16:276 PingHub disconnecting
    2020-10-02 17:39:16:460 PingHub disconnected: WSError(type: Starscream.ErrorType.protocolError, message: "", code: 1000)
    2020-10-02 17:39:16:555 TracksService sendQueuedEvents completed. Sent 3 events.
    2020-10-02 17:40:02:172 <WordPress.WordPressAppDelegate: 0x282308990> applicationWillEnterForeground(_:)
    2020-10-02 17:40:02:172 📜 Resumed encrypted log upload queue due to app entering foreground
    2020-10-02 17:40:02:172 PingHub connecting
    2020-10-02 17:40:02:214 Error uploading file: The network connection was lost.
    2020-10-02 17:40:02:215 🔵 Tracked: media_service_upload_failed <error_code: -1005, error_description: Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={_kCFStreamErrorCodeKey=53, NSUnderlyingError=0x281da36c0 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={NSErrorPeerAddressKey=<CFData 0x2832cf2a0 [0x1da4a0660]>{length = 16, capacity = 16, bytes = 0x100201bbc0004e160000000000000000}, _kCFStreamErrorCodeKey=53, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalUploadTask <E93686AA-64D6-478D-986A-4E79F5F6B733>.<198>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
        "LocalUploadTask <E93686AA-64D6-478D-986A-4E79F5F6B733>.<198>"
    ), NSLocalizedDescription=The network connection was lost., NSErrorFailingURLStringKey=https://public-api.wordpress.com/rest/v1.1/sites/181405924/media/new?locale=en, NSErrorFailingURLKey=https://public-api.wordpress.com/rest/v1.1/sites/181405924/media/new?locale=en, _kCFStreamErrorDomainKey=1}, error_domain: NSURLErrorDomain>
    2020-10-02 17:40:02:228 Error uploading media: Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost." UserInfo={_kCFStreamErrorCodeKey=53, NSUnderlyingError=0x281da36c0 {Error Domain=kCFErrorDomainCFNetwork Code=-1005 "(null)" UserInfo={NSErrorPeerAddressKey=<CFData 0x2832cf2a0 [0x1da4a0660]>{length = 16, capacity = 16, bytes = 0x100201bbc0004e160000000000000000}, _kCFStreamErrorCodeKey=53, _kCFStreamErrorDomainKey=1}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalUploadTask <E93686AA-64D6-478D-986A-4E79F5F6B733>.<198>, _NSURLErrorRelatedURLSessionTaskErrorKey=(
        "LocalUploadTask <E93686AA-64D6-478D-986A-4E79F5F6B733>.<198>"
    ), NSLocalizedDescription=The network connection was lost., NSErrorFailingURLStringKey=https://public-api.wordpress.com/rest/v1.1/sites/181405924/media/new?locale=en, NSErrorFailingURLKey=https://public-api.wordpress.com/rest/v1.1/sites/181405924/media/new?locale=en, _kCFStreamErrorDomainKey=1}
    2020-10-02 17:40:02:492 <WordPress.WordPressAppDelegate: 0x282308990> applicationDidBecomeActive(_:)
    2020-10-02 17:40:02:494 checkAppleIDCredentialState: No Apple ID found.
    2020-10-02 17:40:02:512 🔵 Tracked: application_opened <>
    
  4. removed their assignment
    on Feb 26, 2021
  5. guarani commented on Feb 26, 2021

    @guarani
    ContributorAuthor

    Un-assigning myself because I'm not actively working on this.

  6. self-assigned this
    on Feb 14, 2022
  7. guarani commented on Feb 18, 2022

    @guarani
    ContributorAuthor

    I was not able to diagnose this issue after spending a couple of days on it.

    Please note: the sample videos I used were MP4s. I didn't use other formats such as .MOV because I didn't have access to sample in these formats. The videos are:

    Video upload tests

    Tests using the WordPress for iOS app

    Environment

    • WPiOS app logged into a WP.com account with Premium plan (lesser plans restrict uploads)
    • Device connected to WiFi: 10 MB/s upload speed (speed varies)
    • I did all tests from the My Site → Media screen.

    Tests

    Test # Video Result Comment
    1 Small video ✅ Uploaded in 2 minutes.
    2 Medium video ❌ Failed after 18 minutes. Note: device had gone to sleep.
    3 Small video ❌ † Charles shows "Status: Sending request body…", then "IO: Stream cancelled by CLIENT"
    4 Small video ❌ † Charles shows "Status: Failed" and "Failure: EOF"
    5 Small video ❌ † Charles shows "Status: Sending request body...", then after a few minutes "Remote server closed the connection before sending response header"
    6 Small video ⚠️ Media appeared to fail but after returning to the Media screen, media was in library. Note: Charles proxy was not connected in this test.
    7 Small video ✅ Uploaded in 5 minutes.

    † Test performed while monitoring network traffic via Charles proxy.

    Observations

    It seems to me that uploads failed more often when Charles was used. I got this impression from the above tests and other tests I did.

    Another oddity with Charles: even after an upload failed, the request status in Charles was often still be "Sending request body...". This would then change a few minutes after as noted in the above tests.

    Tests using WordPress.com on different web browsers

    Environment

    I also did tests on WordPress.com using different browsers and platforms to see if there were problems there. I didn't use Charles proxy in the below tests.

    Tests

    Test # Video Result Comment
    1 Small video ✅ Uploaded via mobile Safari in 5 minutes.
    2 Small video ✅ Uploaded via mobile Safari in 5 minutes.
    3 Medium video

    Debugging the WordPress for iOS app via Xcode

    Environment

    I ran the latest code from the trunk branch and paid special attention to these methods:

    A timeout error:

    See error 2022-02-15 17:01:44:417 WordPress[1319:255550] 🔵 Tracked: media_service_upload_failed .<68>, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalUploadTask .<68>" ), NSLocalizedDescription=The request timed out., NSErrorFailingURLStringKey=https://public-api.wordpress.com/rest/v1.1/sites/202830077/media/new?locale=en, NSErrorFailingURLKey=https://public-api.wordpress.com/rest/v1.1/sites/202830077/media/new?locale=en, _kCFStreamErrorDomainKey=4}, error_domain: NSURLErrorDomain> 2022-02-15 17:01:44:443 WordPress[1319:255550] Error uploading media: Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={_kCFStreamErrorCodeKey=-2102, NSUnderlyingError=0x11015b420 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "(null)" UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalUploadTask .<68>, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalUploadTask .<68>"

    A "cannot parse response" error:

    See error 2022-02-15 17:31:22:862 WordPress[1397:269654] 🔵 Tracked: media_service_upload_failed .<26>, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalUploadTask <346B91B7-062D-4D4D-BF88-11D3EB54C49B>.<26>" ), NSLocalizedDescription=cannot parse response, NSErrorFailingURLStringKey=https://public-api.wordpress.com/rest/v1.1/sites/202830077/media/new?locale=en, NSErrorFailingURLKey=https://public-api.wordpress.com/rest/v1.1/sites/202830077/media/new?locale=en, _kCFStreamErrorDomainKey=4}, error_domain: NSURLErrorDomain> 2022-02-15 17:31:22:928 WordPress[1397:269654] Error uploading media: Error Domain=NSURLErrorDomain Code=-1017 "cannot parse response" UserInfo={_kCFStreamErrorCodeKey=-1, NSUnderlyingError=0x110255670 {Error Domain=kCFErrorDomainCFNetwork Code=-1017 "(null)" UserInfo={_kCFStreamErrorCodeKey=-1, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalUploadTask <346B91B7-062D-4D4D-BF88-11D3EB54C49B>.<26>, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalUploadTask <346B91B7-062D-4D4D-BF88-11D3EB54C49B>.<26>" ), NSLocalizedDescription=cannot parse response, NSErrorFailingURLStringKey=https://public-api.wordpress.com/rest/v1.1/sites/202830077/media/new?locale=en, NSErrorFailingURLKey=https://public-api.wordpress.com/rest/v1.1/sites/202830077/media/new?locale=en, _kCFStreamErrorDomainKey=4}

    The "cannot parse response" especially deserves more investigation, but I didn't dig into it further.


    Next steps

    I spent a lot of time with Charles proxy but don't feel like that was the right approach since requests seemed to fail more when the proxy was connected. I think digging further into the issue through Xcode's debugger would be the best next step.

    Other options suggested to me are (h/t to @twstokes here):

    • Test using a simulator in the cloud (this helps speed up turnaround time on media upload tests which seem to take up to 40 minutes on an internet connection with 10MB/s upload speed.
    • Upload media with cURL: Note that the cURL request (copied from Charles) includes the binary blob of media, so it's really large and might be difficult to paste to the terminal
    • Play with Network Link Conditioner and use smaller files: Again this might help reduce the turnaround time for media upload tests
  8. guarani commented on Feb 21, 2022

    @guarani
    ContributorAuthor

    Unassigning myself since I wasn't able to find a solution during groundskeeping.

  9. removed their assignment
    on Feb 21, 2022
  10. twstokes commented on Jul 8, 2022

    @twstokes
    Contributor

    Just wanted to note that this issue may be improved by recent .com server side tweaks. ref: pgbkb-8lq-p2

  11. dangermattic commented on Mar 5, 2026

    @dangermattic
    Collaborator

    Thanks for reporting! 👍

  12. added
    [Status] Needs ReproNot reproduced on current trunk yet, or no reliable steps to reproduce it.
    on Oct 31, 2026
  13. jkmassel commented on Oct 31, 2026

    @jkmassel
    Contributor

    Simulator test plan (goal: confirm). Sign in using docs/simulator-sign-in.md. Build from current trunk.

    Setup: WordPress.com site on a plan that allows video uploads (VideoPress). Create a large test video on the host, for example ffmpeg -f lavfi -i testsrc=size=1920x1080:rate=30 -t 900 -b:v 6M big.mp4 (about 650 MB). Add it (and a .mov copy) with xcrun simctl addmedia. Debug builds enable Media Library v2; turn Media Library v2 off in Me › App Settings › Debug › Feature Flags (then relaunch) to test the shipping library. Use the default React Native editor (Experimental Features › Experimental Block Editor off). iPhone simulator.

    1. My Site › Media › + › Choose from Device › pick the 650 MB video. Keep the app in the foreground until the upload finishes or fails.
    2. Repeat, but press Home (xcrun simctl or the UI) about 10 s into the upload, wait 30–40 s, then bring the app back.
    3. Repeat steps 1–2 in a new post using a Video block › Choose from device.
    4. After each run, search the Xcode console (or Me › Help & Support › Logs) for media_service_upload_failed and NSURLError -1001/-1005.

    Pass / report: Reproduced if an upload fails with an NSURLError although the server accepts the file (upload it from the web to check). Attach log excerpts and screenshots. If nothing fails after 3 tries of each, recommend closing; if only the backgrounded case fails, report that as the remaining bug.

    What might stop it from triggering: the original failures were intermittent and may have been network- or server-dependent.

    Unless the plan says otherwise, build the Jetpack scheme and use bundle ID com.automattic.jetpack in the sign-in commands. The WordPress app hides Reader, Notifications, Stats and the dashboard cards for WordPress.com accounts.

    When you're done: post the results here. If you now have reliable steps, remove [Status] Needs Repro. If you found the cause and a fix approach, remove [Status] Needs Plan and add [Status] Ready for Dev. If a "confirm" plan didn't reproduce, say so and recommend closing. Remove Simulator Testable when you're finished.


    Generated by Claude Code

  14. added
    Simulator TestableCheckable on a simulator. Steps are in the issue body or the comment headed 'Simulator test plan'.
    on Oct 31, 2026
  15. jkmassel commented on Oct 31, 2026

    @jkmassel
    Contributor

    Repro run (2026-10-31, trunk e64c851)

    Result: Blocked: needs info ⏸

    Needs: a WordPress.com site on a plan that allows video uploads, plus permission to upload a large test video to it. The upload is a WordPress.com write. A mocked API could cover the app's side of this, but not how the real server behaves. That wasn't tried.


    Generated by Claude Code

  16. added
    [Status] Needs InfoBlocked on information or access that a maintainer needs to supply.
    and removed
    Simulator TestableCheckable on a simulator. Steps are in the issue body or the comment headed 'Simulator test plan'.
    on Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Media[Pri] Medium[Status] Needs InfoBlocked on information or access that a maintainer needs to supply.[Status] Needs ReproNot reproduced on current trunk yet, or no reliable steps to reproduce it.[Type] Bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions