XDC: Stream closed status?

146 views
Skip to first unread message

Kate Alpert

unread,
Oct 1, 2015, 10:59:38 AM10/1/15
to Xnat
Dear all,

Suddenly, we have started seeing "Stream closed" errors after large uploads with XnatDataClient. We're on XNAT 1.6.4 and have been for some time. The exit status is 244 and the command and message are below.

[user@machine ~]$ $PIPELINE_HOME/xnat-tools/XnatDataClient -u $aliasname -p $aliaspass -r "http://XNAT/data/archive/experiments/SESSION_ID/reconstructions/RECONSTRUCTION_ID/out/resources/RESOURCE_NAME/files?extract=true&overwrite=true" -l /path/to/files.zip -m PUT



<html>

<head>

   <title>Status page</title>

</head>

<body>

<h3>Stream closed</h3><p>You can get technical details <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">here</a>.<br>

Please continue your visit at our <a href="/">home page</a>.

</p>

</body>

</html>


In the restlet.log, I see the following:

2015-10-01 09:38:08,250 [http-bio-8080-exec-4] ERROR org.nrg.xnat.restlet.resources.files.FileList - Error occurred while trying to POST file

java.io.IOException: Stream closed

    at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:312)

    at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:200)

    at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)

    at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)

    at java.io.BufferedInputStream.read(BufferedInputStream.java:334)

    at java.io.FilterInputStream.read(FilterInputStream.java:133)

    at java.io.PushbackInputStream.read(PushbackInputStream.java:186)

    at java.util.zip.ZipInputStream.readFully(ZipInputStream.java:424)

    at java.util.zip.ZipInputStream.readLOC(ZipInputStream.java:277)

    at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:121)

    at org.nrg.xft.utils.zip.ZipUtils.extract(ZipUtils.java:373)

    at org.nrg.xnat.utils.CatalogUtils.storeCatalogEntry(CatalogUtils.java:563)

...

2015-10-01 09:38:08,251 [http-bio-8080-exec-4] ERROR org.nrg.xnat.restlet.resources.files.FileList -

java.io.IOException: Stream closed

    at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:312)

    at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:200)

    at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)

    at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)

    at java.io.BufferedInputStream.read(BufferedInputStream.java:334)

    at java.io.FilterInputStream.read(FilterInputStream.java:133)

    at java.io.PushbackInputStream.read(PushbackInputStream.java:186)

    at java.util.zip.ZipInputStream.readFully(ZipInputStream.java:424)

    at java.util.zip.ZipInputStream.readLOC(ZipInputStream.java:277)

    at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:121)

    at org.nrg.xft.utils.zip.ZipUtils.extract(ZipUtils.java:373)

    at org.nrg.xnat.utils.CatalogUtils.storeCatalogEntry(CatalogUtils.java:563)

...


The files seem to be appropriately uploaded (they're the correct size, the catalog xml looks correct -- timestamp is Oct  1 09:38 -- same as the errors above).

Other calls to XnatDataClient with the same credentials work as usual.

Please advise!
Thanks,
Kate

Herrick, Rick

unread,
Oct 1, 2015, 11:30:56 AM10/1/15
to xnat_di...@googlegroups.com
This isn’t an XDC issue, this is a problem on the server. You can tell because the error is coming out of the catalina code, meaning that the problem isn’t XDC writing to and reading from Tomcat, but Tomcat reading and writing out to something. Tomcat COULD have an issue writing back out to the XDC (in other words, sending data back to the client because the output stream has closed), but you actually wouldn’t see that on the XDC side since of course Tomcat can’t write to XDC and can’t inform XDC that it can’t write to it. If you see what I mean.

But in this case it looks like XNAT is trying to read the incoming Zip stream and somehow that’s getting closed. The line in ZipUtils where this is failing looks like this:

ZipEntry entry;
while ((entry = zis.getNextEntry()) != null) {

So… I don’t know. Maybe the Zip file is too large or particular entries within the Zip file are too large and the stream is timing out and closing underneath you? You try to increase the <session-timeout> setting in the XNAT web.xml and see if that fixes the issue. Other possible causes could be a change in network settings between the client and XNAT (so that, e.g., a firewall is shutting down the connection if it’s “idle” for too long) or possibly issues with disk space on the server causes the upload thread to abort and closing the session?

Do you see any messages in the XNAT logs that correspond time-wise to what you see on your client side?

-- 

Rick Herrick

Sr. Programmer/Analyst

Neuroinformatics Research Group

Washington University School of Medicine

(314) 740-5961


--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com.
To post to this group, send email to xnat_di...@googlegroups.com.
Visit this group at http://groups.google.com/group/xnat_discussion.
For more options, visit https://groups.google.com/d/optout.



The material in this message is private and may contain Protected Healthcare Information (PHI). If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.

Aniqa Arif

unread,
Oct 9, 2015, 4:36:18 PM10/9/15
to xnat_discussion
I'm having a similar problem. The thing is that it's happening in a pipeline use of the XnatDataClient, and so when the "stream closed" error happens the pipeline fails and does not complete the clean up and notify steps, even though the files have all been uploaded.

The files are only about 250 MB total, and I have tested with the firewall down as well...

The pipeline is executing this when it fails:



My error is the following:

2015-10-09 15:33:09,501 [http-bio-8080-exec-21] ERROR org.nrg.xnat.restlet.resources.SecureResource - Transaction got a status: Internal Server Error (500) - The server encountered an unexpected condition which prevented it from fulfilling the request

org.apache.commons.fileupload.FileUploadException: Stream closed

        at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:381)

        at org.restlet.ext.fileupload.RestletFileUpload.parseRequest(RestletFileUpload.java:104)

        at org.nrg.xnat.restlet.resources.SecureResource.getFileWritersAndLoadParams(SecureResource.java:1062)

        at org.nrg.xnat.restlet.services.mail.MailRestlet.extractParameters(MailRestlet.java:148)

        at org.nrg.xnat.restlet.services.mail.MailRestlet.handlePost(MailRestlet.java:70)

        at org.restlet.Finder.handle(Finder.java:357)

        at org.restlet.Filter.doHandle(Filter.java:150)

        at org.restlet.Filter.handle(Filter.java:195)

        at org.restlet.Router.handle(Router.java:504)

        at org.restlet.Filter.doHandle(Filter.java:150)

        at org.restlet.Filter.handle(Filter.java:195)

        at org.restlet.Filter.doHandle(Filter.java:150)

        at org.restlet.Filter.handle(Filter.java:195)

        at org.restlet.Router.handle(Router.java:504)

        at org.restlet.Filter.doHandle(Filter.java:150)

...

Caused by:

java.io.IOException: Stream closed

        at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:312)

        at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:200)

        at org.apache.commons.fileupload.MultipartStream$ItemInputStream.makeAvailable(MultipartStream.java:977)

        at org.apache.commons.fileupload.MultipartStream$ItemInputStream.read(MultipartStream.java:887)

        at java.io.InputStream.read(InputStream.java:101)

        at org.apache.commons.fileupload.util.Streams.copy(Streams.java:94)

        at org.apache.commons.fileupload.util.Streams.copy(Streams.java:64)

        at org.apache.commons.fileupload.MultipartStream.readBodyData(MultipartStream.java:593)

        at org.apache.commons.fileupload.MultipartStream.discardBodyData(MultipartStream.java:619)

        at org.apache.commons.fileupload.MultipartStream.skipPreamble(MultipartStream.java:638)

        at org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.findNextItem(FileUploadBase.java:961)

        at org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.<init>(FileUploadBase.java:942)

Flavin, John

unread,
Oct 9, 2015, 4:41:42 PM10/9/15
to xnat_discussion
This is hacky and opens a big hole for bugs, but you could always add continueOnFailure="true" to that pipeline step.

Is that my facemasking pipeline? Or did you write your own?

Flavin

Aniqa Arif

unread,
Oct 13, 2015, 11:18:51 AM10/13/15
to xnat_discussion
Yes that is a last resort, but again as you mention, causes other problems... I would still need to solve the Stream Closed error.

Indeed it is your facemasking pipeline! I did have to comment out the "GET_REFSCAN"step in order to get it working because I kept running into errors from the impsc script.

Aniqa
Reply all
Reply to author
Forward
0 new messages