A user reported arc patch failing with a 504 on a reasonably large diff. I can reproduce this consistently and it seems that the differential.querydiffs call is timing out:
arc patch --nobranch --skip-dependencies --trace D56417 ARGV '/usr/local/src/arcanist/bin/../scripts/arcanist.php' 'patch' '--nobranch' '--skip-dependencies' '--trace' 'D56417' LOAD Loaded "phutil" from "/usr/local/src/libphutil/src". LOAD Loaded "arcanist" from "/usr/local/src/arcanist/src". Config: Reading user configuration file "/home/josh/.arcrc"... Config: Did not find system configuration at "/etc/arcconfig". Working Copy: Reading .arcconfig from "/home/josh/workspace/REDACTED/.arcconfig". Working Copy: Path "/home/josh/workspace/REDACTED" is part of `git` working copy "/home/josh/workspace/REDACTED". Working Copy: Project root is at "/home/josh/workspace/REDACTED". Config: Did not find local configuration at "/home/josh/workspace/REDACTED/.git/arc/config". Loading phutil library from '/home/josh/workspace/REDACTED/support/flarc/src'... >>> [0] <conduit> differential.querydiffs() <bytes = 76> >>> [1] <http> https://phabricator.REDACTED/api/differential.querydiffs <<< [1] <http> 989,813 us <<< [0] <conduit> 990,437 us >>> [2] <conduit> user.whoami() <bytes = 117> >>> [3] <http> https://phabricator.REDACTED/api/user.whoami <<< [3] <http> 324,048 us <<< [2] <conduit> 324,612 us >>> [4] <conduit> differential.querydiffs() <bytes = 157> >>> [5] <http> https://phabricator.REDACTED/api/differential.querydiffs <<< [5] <http> 60,211,047 us <<< [4] <conduit> 60,211,574 us [2017-03-13 03:00:25] EXCEPTION: (HTTPFutureHTTPResponseStatus) [HTTP/504] <html> <head><title>504 Gateway Time-out</title></head> <body bgcolor="white"> <center><h1>504 Gateway Time-out</h1></center> <hr><center>nginx</center> </body> </html> at [<phutil>/src/future/http/BaseHTTPFuture.php:339] arcanist(head=master, ref.master=ade25facfdf2), flarc(), phutil(head=master, ref.master=9d85dfab0f53) #0 BaseHTTPFuture::parseRawHTTPResponse(string) called at [<phutil>/src/future/http/HTTPSFuture.php:418] #1 HTTPSFuture::isReady() called at [<phutil>/src/future/Future.php:37] #2 Future::resolve(NULL) called at [<phutil>/src/future/FutureProxy.php:34] #3 FutureProxy::resolve() called at [<arcanist>/src/workflow/ArcanistWorkflow.php:1197] #4 ArcanistWorkflow::loadBundleFromConduit(ConduitClient, array) called at [<arcanist>/src/workflow/ArcanistWorkflow.php:1189] #5 ArcanistWorkflow::loadRevisionBundleFromConduit(ConduitClient, string) called at [<arcanist>/src/workflow/ArcanistPatchWorkflow.php:384] #6 ArcanistPatchWorkflow::run() called at [<arcanist>/src/workflow/ArcanistPatchWorkflow.php:397] #7 ArcanistPatchWorkflow::run() called at [<arcanist>/scripts/arcanist.php:394]