For large zip uploads XNAT server silently drops connection

DICOM data can be uploaded using the xnatpy connection.services.import_() This internally calls requests.post() and performs a regular http post request.

A typical post request consists of

  • Establishing a connection between client and server
  • Client sending over all data contained in the post request
  • Server sending back a 200 OK response

XNAT performs a full dicom import of the POST data before sending back a 200 OK response. This import phase generally takes several times more time than the upload.

For large (multiple GB) uploads, the XNAT import done by the server takes so long that the server seems to quietly drop the http connection. The server then never sends an 200 OK response or any other response. This leaves the client hanging in infinite wait.