cancel
Showing results for 
Search instead for 
Did you mean: 

Connection issue with Cmis Client

rohitbatta
Champ on-the-rise
Champ on-the-rise

Hello,

I am receiving a strange issue related to accessing document versions using OpenCmis client. 

I am using the browser/atom pub BINDING type. Document upload works fine using either binding type.

But, when I am trying to upload new version thread stuck. Same behaviour also persists while reverting a version to the previous version.

Thread t@128
   java.lang.Thread.State: RUNNABLE
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
        at java.net.SocketInputStream.read(SocketInputStream.java:171)
        at java.net.SocketInputStream.read(SocketInputStream.java:141)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
        at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
        - locked <1761a4b0> (a java.io.BufferedInputStream)
        at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:735)
        at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1593)
        - locked <dce3ba1> (a sun.net.www.protocol.http.HttpURLConnection)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
        - locked <dce3ba1> (a sun.net.www.protocol.http.HttpURLConnection)
        at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
        at org.apache.chemistry.opencmis.client.bindings.spi.http.DefaultHttpInvoker.invoke(DefaultHttpInvoker.java:211)
        at org.apache.chemistry.opencmis.client.bindings.spi.http.DefaultHttpInvoker.invokePOST(DefaultHttpInvoker.java:68)
        at org.apache.chemistry.opencmis.client.bindings.spi.browser.AbstractBrowserBindingService.post(AbstractBrowserBindingService.java:422)
        at org.apache.chemistry.opencmis.client.bindings.spi.browser.VersioningServiceImpl.checkIn(VersioningServiceImpl.java:128)
        at org.apache.chemistry.opencmis.client.runtime.DocumentImpl.checkIn(DocumentImpl.java:347)
        at org.apache.chemistry.opencmis.client.runtime.DocumentImpl.checkIn(DocumentImpl.java:650)
5 REPLIES 5

kaynezhang
World-Class Innovator
World-Class Innovator

Without further information II 'm not sure what cause this erro ,about how to work with version using cmis api. You can 

refer to https://chemistry.apache.org/docs/cmis-samples/samples/versions/index.html\

or https://docs.alfresco.com/6.2/concepts/opencmis-ext-intro.html

Following is my test code ,it works fine

		Document document=(Document)session.getObject(objectId);
		
		ObjectId pwcId = document.checkOut();
		Document pwc = (Document)session.getObject(pwcId);
		
		String fileName = "ttt.pdf";
		File file = new File("d:\\" + fileName);
		InputStream fis = new FileInputStream(file);
		DataInputStream dis = new DataInputStream(fis);
		byte[] bytes = new byte[(int) file.length()];
		dis.readFully(bytes);
		String mimetype = detectMimetype(fileName, fis);
		ContentStream contentStream = new ContentStreamImpl(file.getAbsolutePath(),
				BigInteger.valueOf(bytes.length), mimetype, new ByteArrayInputStream(bytes));
		Map<String, Object> properties = new HashMap<String, Object>();
		pwc.checkIn(true, properties, contentStream, "test");

Hello,

Thanks for your reply.

I am also doing same and it was working earlier. 

Changes which I have done are in alfresco-global.properties file for thumbnail generation

system.thumbnail.generate=true

#Thumbnail generation for images
img.root=/usr/lib64/ImageMagick-7.0.7
img.coders=/usr/lib64/ImageMagick-7.0.7/modules-Q16HDRI/coders
img.config=/usr/lib64/ImageMagick-7.0.7/config-Q16HDRI
img.exe=/usr/bin/convert

#Thumbnail generation for pdf documents
alfresco-pdf-renderer.enabled=true
alfresco-pdf-renderer.root=/usr/bin/
alfresco-pdf-renderer.exe=${alfresco-pdf-renderer.root}/alfresco-pdf-renderer

#Thumbnail generation for office documents (word, excel and etc.)
ooo.enabled=true
ooo.root=/opt/libreoffice5.4/program
ooo.exe=${ooo.root}/soffice
ooo.port=8100

 Does adding transform service to create thumbnails could impact response and impact time out. 

I found following two configurations in CMIS session creation. 

org.apache.chemistry.opencmis.binding.connecttimeout	CONNECT_TIMEOUT	HTTP connect timeout	time in milliseconds	no	JVM default
org.apache.chemistry.opencmis.binding.readtimeout	READ_TIMEOUT	HTTP read timeout	time in milliseconds	no	JVM default

Do, I need to set timeout explicitly?

kaynezhang
World-Class Innovator
World-Class Innovator

I don't think it has any thing to do with these properties ,Which alfresco version are you using?

Hello,

I am using this version.

Edition: Community
Version Number: 6.1.1 (r9d03d2fd-b168)

Problem partially disappeared when I have disabled thumbnail and document renderer services mentioned above. 

Following is the threadDump stack. 

#113 daemon prio=5 os_prio=0 tid=0x000000005b208800 nid=0x3ffc runnable [0x0000000102a4b000]
   java.lang.Thread.State: RUNNABLE
	at java.net.SocketInputStream.socketRead0(Native Method)
	at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
	at java.net.SocketInputStream.read(SocketInputStream.java:171)
	at java.net.SocketInputStream.read(SocketInputStream.java:141)
	at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
	at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
	at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
	- locked <0x0000000096bdd940> (a java.io.BufferedInputStream)
	at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:735)
	at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1593)
	- locked <0x0000000096bdd9f0> (a sun.net.www.protocol.http.HttpURLConnection)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
	- locked <0x0000000096bdd9f0> (a sun.net.www.protocol.http.HttpURLConnection)
	at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
	at org.apache.chemistry.opencmis.client.bindings.spi.http.DefaultHttpInvoker.invoke(DefaultHttpInvoker.java:211)
	at org.apache.chemistry.opencmis.client.bindings.spi.http.DefaultHttpInvoker.invokePOST(DefaultHttpInvoker.java:68)
	at org.apache.chemistry.opencmis.client.bindings.spi.browser.AbstractBrowserBindingService.post(AbstractBrowserBindingService.java:422)
	at org.apache.chemistry.opencmis.client.bindings.spi.browser.VersioningServiceImpl.checkIn(VersioningServiceImpl.java:128)
..............
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:479)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:800)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1471)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
- locked <0x00000000969678b0> (a org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)

Locked ownable synchronizers:
- <0x0000000095583f78> (a java.util.concurrent.ThreadPoolExecutor$Worker)

kaynezhang
World-Class Innovator
World-Class Innovator

After uploading a file alfresco will try to create a thumbnail for this document. From the thread dump it seems two threads try to get reentrant locks and gets stuck during creating thumbnail.
We don't have this problem in our version(Community - 6.2.0) ,it seems it is a bug of your version.