chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Hind <andy.h...@alfresco.com>
Subject RE: Invalid chunk header when replacing Document contents
Date Tue, 16 Apr 2013 09:17:31 GMT
Hi

Which version of Alfresco are you using?
(OpenCMIS 0.8 is used in Alfresco 4.2)

When you say you cannot reproduce it locally, do you mean the same test
passes and chunking works?
Are you using exactly the same version of Alfresco locally?

It looks like it is not related to Alfresco unless there is some retry
going on that does not work with chunking.

You could try turning on debug for
org.alfresco.repo.transaction.RetryingTransactionHelper
to see if retrying the operation is causing the issue - then it is an
Alfresco issue.

Are you using web services?
I have seen something similar before, related to the WS support in the
container.
Can you use AtomPub instead?

What is different between the container where it is OK and where it
breaks?

Andy



-----Original Message-----
From: jevon [mailto:jevon@jevon.org]
Sent: 16 April 2013 07:08
To: dev@chemistry.apache.org
Subject: Invalid chunk header when replacing Document contents

Hi,

We're having problems with a deployment of OpenCMIS 0.8 interacting with
Alfresco. When using setContentStream() on an existing Document, Alfresco
is reporting an "Invalid chunk header" and the document contents do not
change.

This error doesn't occur when uploading a new document, or on replacing
documents less than 10 KB. Unfortunately I haven't been able to reproduce
it locally but I can reproduce it on a different deployment environment.
Tomcat 7's default Http11 connector does not support disabling chunking.
As far as I can tell, it isn't an issue with permissions, SSL, folder
paths, firewalls, proxies or file content.

As a workaround we're considering having to delete the existing document
before uploading a new one, but this will lose the previous history
associated with the document.

Short of inspecting the data flow with Wireshark/etc, how could we look at
fixing this issue? Could this be an Alfresco, Chemistry, Tomcat or other
issue? Is there any way to convince OpenCMIS to not use a chunked
connection when uploading content?

Thanks for any help.

Jevon

[1] Stacktrace on CMIS client:

org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException:
Internal Server Error
        at
org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubS
ervice.convertStatusCode(AbstractAtomPubService.java:452)
        at
org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubS
ervice.put(AbstractAtomPubService.java:595)
        at
org.apache.chemistry.opencmis.client.bindings.spi.atompub.ObjectServiceImp
l.setContentStream(ObjectServiceImpl.java:624)
        at
org.apache.chemistry.opencmis.client.runtime.DocumentImpl.setContentStream
(DocumentImpl.java:412)
        at
org.apache.chemistry.opencmis.client.runtime.DocumentImpl.setContentStream
(DocumentImpl.java:392)
        at ...


Stacktrace on Alfresco server:

java.lang.RuntimeException: java.io.IOException: Invalid chunk header
        at
org.alfresco.repo.web.scripts.RepositoryContainer$BufferedRequest$1.getInp
utStream(RepositoryContainer.java:1059)
        at
org.alfresco.repo.web.scripts.content.ContentSet.execute(ContentSet.java:1
75)
        at
org.alfresco.repo.web.scripts.RepositoryContainer$2.execute(RepositoryCont
ainer.java:417)
        at
org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(Re
tryingTransactionHelper.java:388)
        at
org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(Rep
ositoryContainer.java:479)
        at
org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(R
epositoryContainer.java:517)
        at
org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(Repository
Container.java:333)
        at
org.springframework.extensions.webscripts.AbstractRuntime.executeScript(Ab
stractRuntime.java:377)
        at
org.springframework.extensions.webscripts.AbstractRuntime.executeScript(Ab
stractRuntime.java:209)
        at
org.springframework.extensions.webscripts.servlet.WebScriptServlet.service
(WebScriptServlet.java:118)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applicati
onFilterChain.java:290)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilter
Chain.java:206)
        at
org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocal
izationFilter.java:61)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applicati
onFilterChain.java:235)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilter
Chain.java:206)
        at
net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:206)
        at
net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:179)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applicati
onFilterChain.java:235)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilter
Chain.java:206)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.
java:233)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.
java:191)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:1
27)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:1
02)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.ja
va:109)
        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298
)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Ht
tp11Protocol.java:588)
        at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:679)
Caused by: java.io.IOException: Invalid chunk header
        at
org.apache.coyote.http11.filters.ChunkedInputFilter.doRead(ChunkedInputFil
ter.java:133)
        at
org.apache.coyote.http11.InternalInputBuffer.doRead(InternalInputBuffer.ja
va:710)
        at org.apache.coyote.Request.doRead(Request.java:427)
        at
org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:3
04)
        at
org.apache.tomcat.util.buf.ByteChunk.substract(ByteChunk.java:421)
        at
org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:327)
        at
org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.jav
a:162)
        at
org.springframework.util.FileCopyUtils.copy(FileCopyUtils.java:112)
        at
org.alfresco.repo.web.scripts.RepositoryContainer$BufferedRequest.getReque
stBodyAsFile(RepositoryContainer.java:938)
        at
org.alfresco.repo.web.scripts.RepositoryContainer$BufferedRequest.access$6
00(RepositoryContainer.java:918)
        at
org.alfresco.repo.web.scripts.RepositoryContainer$BufferedRequest$1.getInp
utStream(RepositoryContainer.java:1055)
        ... 29 more


Code that executes setContentStream():

    public void replaceContents(InputStream stream, long length,
            String contentType) {

        Document doc = (Document) getCmisObject();
        ContentStream contentStream = new ContentStreamImpl(getName(),
BigInteger.valueOf(length), contentType, stream);
        doc.setContentStream(contentStream, true);

    }

Mime
View raw message