In order to inspect the problem i wrote a simple multi thread java
application for test.

public class StorageSample{
        
        public static void main(String[] args) {
                HashMap<Integer,StorageThread> threads = new HashMap<Integer,
StorageThread>(); 
                for (int i = 0 ; i < 20 ; i++){
                        threads.put(i, new StorageThread(i));
                }
        }


static class StorageThread extends Thread {

        private  WSStorageServiceClient client;
        private  int delay = 20000;

        /**
         * Initializes the client and in case of SSL connection set the system
         * properties
         * 
         * @throws AxisFault
         */
        
        public StorageThread(int key) {
                
                super("Storage Thread-"+String.valueOf(key));
                start();
        }
        private  void init() throws AxisFault {


                System.setProperty("javax.net.ssl.trustStore",
                                WSStorageClientConstants.SERVER_PATH
                                                + 
"/repository/resources/security/wso2carbon.jks");
                System.setProperty("javax.net.ssl.trustStorePassword", 
"wso2carbon");
                System.setProperty("javax.net.ssl.trustStoreType", "JKS");
                try {
                        System.out.println("Setting up client");
                        client = new WSStorageServiceClient(
                                        WSStorageClientConstants.ARCSP_ESB_EPR,
                                        WSStorageClientConstants.USERNAME,
                                        WSStorageClientConstants.PASSWORD);
                } catch (Exception e) {
                        e.printStackTrace();
                }

        }

        /**
         * Sample method using the clients put method
         * 
         * @param parentPath
         *            Directory resource to be inserted
         * @param resourceName
         * @return Id of the resource
         * @throws IOException
         */
        public  String uploadResource(String parentPath, String resourceName)
                        throws IOException {

                // ResourceImpl resource = new ResourceImpl();
                String sourcePath = "/home/guclu.akkaya/tmpfiles";
                String absolutePath = sourcePath + File.separator + 
resourceName;
                String destinationPath = parentPath + File.separator + 
resourceName;
                FileDataSource dataSource = new FileDataSource(new
File(absolutePath));
                String id = null;
                DataHandler dataHandler = new DataHandler(dataSource);
                System.out.println("Upload resource begins");
                id = client.put(destinationPath, dataHandler);
                System.out.println("Upload resource ends successfuly");
                System.out.println("Resource id is:" + id);

                return id;

        }

        public  void downloadResourceContent(String resourceId)
                        throws Exception {

                System.out.println("Beginning download");
                WSResource wsResource = client.getResourceById(resourceId);

                DataHandler dataHandler = wsResource.getContentFile();
                String saveDir = "/home/guclu.akkaya/DEVELOPMENT/TMP";
                String savePath = saveDir + File.separator + this.getName() + 
"-" +
wsResource.getName();
                
                FileOutputStream outputStream = null;

                try {
                        File file = new File(savePath);
                        outputStream = new FileOutputStream(file);
                        dataHandler.writeTo(outputStream);
                        System.out.println("Download ends successfuly");
                } finally {
                        if (outputStream != null) {
                                outputStream.close();
                        }
                }
        }

        @Override
        public void run() {
                try {
                        
                        
                                init();
                                downloadResourceContent("278");// A 110 mb file 
its metadata with id
278
                               sleep(delay);                    
                } catch (AxisFault e) {
                        e.printStackTrace();
                } catch (Exception e) {
                        e.printStackTrace();
                }
        }
        
    
        
        
                
        }

}

If the thread count is under 15 there is no problem. However with
increasing the thread count i see the exceptions mentioned in the
previous mail. I begin to think that i am missing some axis2 client
configuration which can increase the performance. Can you give me hints
about this?

Thank you



On Mon, 2012-01-09 at 09:31 +0200, Güçlü Akkaya wrote:
> 
> 
> Hi again,
> 
> Again for the MTOM web service load test i am facing this exception on
> the client side:
> 
> Failed to perform get operation.
> {com.ardic.arcsp.update.wsclient.WSStorageServiceClient}
> org.apache.axis2.AxisFault:
> org.apache.axiom.ext.io.StreamCopyException: Error reading from source
>         at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
>         at
> com.ardic.arcsp.carbon.registry.ws.stub.WSStorageServiceStub.fromOM(WSStorageServiceStub.java:16706)
>         at
> com.ardic.arcsp.carbon.registry.ws.stub.WSStorageServiceStub.wSgetById(WSStorageServiceStub.java:6659)
>         at
> com.ardic.arcsp.update.wsclient.WSStorageServiceClient.getResourceById(WSStorageServiceClient.java:171)
>         at
> com.ardic.arcsp.update.wsclient.OTAUpdateTestServlet.downloadResource(OTAUpdateTestServlet.java:139)
>         at
> com.ardic.arcsp.update.wsclient.OTAUpdateTestServlet.doGet(OTAUpdateTestServlet.java:91)
>         at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
>         at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>         at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
>         at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
>         at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
>         at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
>         at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
>         at org.wso2.carbon.server.TomcatServer
> $1.invoke(TomcatServer.java:241)
>         at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
>         at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>         at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399)
>         at
> org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:396)
>         at org.apache.coyote.http11.Http11NioProtocol
> $Http11ConnectionHandler.process(Http11NioProtocol.java:356)
>         at org.apache.tomcat.util.net.NioEndpoint
> $SocketProcessor.run(NioEndpoint.java:1534)
>         at java.util.concurrent.ThreadPoolExecutor
> $Worker.runTask(ThreadPoolExecutor.java:886)
>         at java.util.concurrent.ThreadPoolExecutor
> $Worker.run(ThreadPoolExecutor.java:908)
>         at java.lang.Thread.run(Thread.java:662)
> Caused by: org.apache.axiom.om.OMException:
> org.apache.axiom.ext.io.StreamCopyException: Error reading from source
>         at
> org.apache.axiom.attachments.impl.PartFactory.createPart(PartFactory.java:172)
>         at
> org.apache.axiom.attachments.Attachments.getPart(Attachments.java:705)
>         at
> org.apache.axiom.attachments.Attachments.getNextPartDataHandler(Attachments.java:623)
>         at
> org.apache.axiom.attachments.Attachments.getDataHandler(Attachments.java:350)
>         at
> org.apache.axiom.om.impl.builder.OMAttachmentAccessorMimePartProvider.getDataHandler(OMAttachmentAccessorMimePartProvider.java:45)
>         at org.apache.axiom.util.stax.xop.XOPDecodingStreamReader
> $DataHandlerProviderImpl.getDataHandler(XOPDecodingStreamReader.java:81)
>         at
> org.apache.axiom.util.stax.xop.XOPDecodingStreamReader.getDataHandler(XOPDecodingStreamReader.java:472)
>         at
> org.apache.axiom.om.impl.SwitchingWrapper.getDataHandler(SwitchingWrapper.java:1360)
>         at
> org.apache.axiom.util.stax.XMLStreamReaderUtils.getDataHandlerFromElement(XMLStreamReaderUtils.java:230)
>         at com.ardic.arcsp.carbon.registry.ws.stub.xsd.WSResource
> $Factory.parse(WSResource.java:2087)
>         at com.ardic.arcsp.carbon.registry.ws.stub.WSgetByIdResponse
> $Factory.parse(WSgetByIdResponse.java:417)
>         at
> com.ardic.arcsp.carbon.registry.ws.stub.WSStorageServiceStub.fromOM(WSStorageServiceStub.java:16273)
>         ... 23 more
> Caused by: org.apache.axiom.ext.io.StreamCopyException: Error reading
> from source
>         at
> org.apache.axiom.attachments.utils.BAAOutputStream.readFrom(BAAOutputStream.java:114)
>         at
> org.apache.axiom.attachments.impl.BufferUtils.inputStream2OutputStream(BufferUtils.java:76)
>         at
> org.apache.axiom.attachments.impl.PartFactory.createPart(PartFactory.java:136)
>         ... 34 more
> Caused by: java.io.IOException: CRLF expected at end of chunk: 2/63
>         at
> org.apache.commons.httpclient.ChunkedInputStream.readCRLF(ChunkedInputStream.java:207)
>         at
> org.apache.commons.httpclient.ChunkedInputStream.nextChunk(ChunkedInputStream.java:219)
>         at
> org.apache.commons.httpclient.ChunkedInputStream.read(ChunkedInputStream.java:176)
>         at java.io.FilterInputStream.read(FilterInputStream.java:116)
>         at
> org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:108)
>         at java.io.FilterInputStream.read(FilterInputStream.java:116)
>         at
> org.apache.axiom.om.util.DetachableInputStream.read(DetachableInputStream.java:147)
>         at java.io.FilterInputStream.read(FilterInputStream.java:116)
>         at
> java.io.PushbackInputStream.read(PushbackInputStream.java:169)
>         at
> org.apache.axiom.attachments.BoundaryPushbackInputStream.readFromStream(BoundaryPushbackInputStream.java:114)
>         at
> org.apache.axiom.attachments.BoundaryPushbackInputStream.read(BoundaryPushbackInputStream.java:248)
>         at
> org.apache.axiom.attachments.MIMEBodyPartInputStream.read(MIMEBodyPartInputStream.java:87)
>         at
> org.apache.axiom.attachments.utils.BAAOutputStream.readFrom(BAAOutputStream.java:112)
>         ... 36 more
> 
> 
> 
> The client side for the web service WSStorageService consists of a
> servlet which used WSStorageClient referenced from the
> org.wso2.carbon.registry.ws.client.WSRegistryServiceClient. In the get
> request the servlet request the resorce file from the web service and
> the end user can download the file. In the attachment you can find
> both the servlet and web service client code. This exception occurs in
> some cases during my load test on the web service. What is the cause
> of this exception? If this related to my code, what do i have to do
> the avoid this error in my code?
> 
> 
> 
> 
> Fatih Güçlü Akkaya
> 
> Software Development Engineer
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Carbon-dev mailing list
> [email protected]
> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev


_______________________________________________
Carbon-dev mailing list
[email protected]
http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev

Reply via email to