You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by "Andrew Gaul (JIRA)" <ji...@apache.org> on 2014/12/31 09:03:13 UTC

[jira] [Commented] (JCLOUDS-798) getting OutOfMemory while fetching images from aws

    [ https://issues.apache.org/jira/browse/JCLOUDS-798?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14262018#comment-14262018 ] 

Andrew Gaul commented on JCLOUDS-798:
-------------------------------------

{{computeServiceContext}} has state like threads and caches; do you reuse or explicitly close this between listing images?

> getting OutOfMemory while fetching images from aws
> --------------------------------------------------
>
>                 Key: JCLOUDS-798
>                 URL: https://issues.apache.org/jira/browse/JCLOUDS-798
>             Project: jclouds
>          Issue Type: Bug
>          Components: jclouds-compute, jclouds-core
>    Affects Versions: 1.7.3
>         Environment: jdk 1.7, windows 7
>            Reporter: Subhadip
>             Fix For: 1.7.3
>
>
> Hi,
> While fetching the selfImages from aws suddenly I'm started getting OOM error. below is my code to fetch images. Please help to resolve the issue.
> {code:language=java}
> 		try {
> 			ComputeServiceContext computeServiceContext = getComputeContext(cloudType);
> 			ComputeService computeService = computeServiceContext
> 					.getComputeService();
> 			if (null != computeService && null != computeService.listImages()) {
> 				for (Image image : computeService.listImages()) {
> 					templateBean = new TemplateBean();
> 					templateBean.setImageId(image.getId());
> 					templateBean.setTemplateName(image.getName());
> 					templateBean.setCloudType(cloudType);
> 					if (Constants.AWS_EC2.equalsIgnoreCase(cloudType)) {
> 						templateBean.setZoneId(AP_SOUTHEAST_1);
> 					}
> 					list.add(templateBean);
> 				}
> 				imageList = new TemplatesBean();
> 				imageList.setName(cloudType);
> 				imageList.setImages(list);
> 				templateStatusBean.setTemplatesBean(imageList);
> 			} else {
> 				errorBean
> 						.setErrorCode(ErrorCode.COMPUTE_SERVICE.getErrorCode());
> 				errorBean.setErrorMessage(ErrorCode.COMPUTE_SERVICE
> 						.getMessage());
> 				templateStatusBean.setErrorBean(errorBean);
> 			}
> 		} catch (Exception exception) {
> 			LOG.warn(exception, exception);
> 			errorBean.setErrorCode(ErrorCode.SELF_IMAGE_ISSUE.getErrorCode());
> 			errorBean.setErrorMessage(ErrorCode.SELF_IMAGE_ISSUE.getMessage()
> 					+ " : " + exception.getMessage());
> 			templateStatusBean.setErrorBean(errorBean);
> 		}
> 		return templateStatusBean;
> }
> {code}
> I'm getting the below exceptions in apache tomcat... saying the rest call for http connection of jclouds is failing. 
> {noformat}
> SEVERE: Servlet.service() for servlet [spring] in context with path [/aricloud] threw exception [Handler processing failed; nested exception is com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: java.lang.OutOfMemoryError: unable to create new native thread] with root cause
> java.lang.OutOfMemoryError: unable to create new native thread
> 	at java.lang.Thread.start0(Native Method)
> 	at java.lang.Thread.start(Thread.java:640)
> 	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
> 	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1188)
> 	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1215)
> 	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1199)
> 	at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:434)
> 	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:166)
> 	at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1031)
> 	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:230)
> 	at org.jclouds.http.internal.JavaUrlHttpCommandExecutorService.writePayloadToConnection(JavaUrlHttpCommandExecutorService.java:305)
> 	at org.jclouds.http.internal.JavaUrlHttpCommandExecutorService.convert(JavaUrlHttpCommandExecutorService.java:192)
> 	at org.jclouds.http.internal.JavaUrlHttpCommandExecutorService.convert(JavaUrlHttpCommandExecutorService.java:72)
> 	at org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:140)
> 	at org.jclouds.rest.internal.InvokeHttpMethod.invoke(InvokeHttpMethod.java:93)
> 	at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:76)
> 	at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:47)
> 	at org.jclouds.reflect.FunctionalReflection$FunctionalInvocationHandler.handleInvocation(FunctionalReflection.java:117)
> 	at com.google.common.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:79)
> 	at com.sun.proxy.$Proxy144.describeRegions(Unknown Source)
> 	at org.jclouds.ec2.suppliers.DescribeRegionsForRegionURIs.get(DescribeRegionsForRegionURIs.java:47)
> 	at org.jclouds.ec2.suppliers.DescribeRegionsForRegionURIs.get(DescribeRegionsForRegionURIs.java:34)
> 	at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:75)
> 	at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:59)
> 	at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3522)
> 	at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2315)
> 	at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2278)
> 	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2193)
> 	at com.google.common.cache.LocalCache.get(LocalCache.java:3932)
> 	at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3936)
> 	at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4806)
> 	at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.get(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:121)
> 	at org.jclouds.location.suppliers.derived.RegionIdsFromRegionIdToURIKeySet.get(RegionIdsFromRegionIdToURIKeySet.java:49)
> 	at org.jclouds.location.suppliers.derived.RegionIdsFromRegionIdToURIKeySet.get(RegionIdsFromRegionIdToURIKeySet.java:36)
> 	at com.google.common.base.Suppliers$SupplierComposition.get(Suppliers.java:67)
> 	at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:75)
> 	at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier$SetAndThrowAuthorizationExceptionSupplierBackedLoader.load(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:59)
> 	at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3522)
> 	at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2315)
> 	at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2278)
> 	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2193)
> 	at com.google.common.cache.LocalCache.get(LocalCache.java:3932)
> 	at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3936)
> 	at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4806)
> 	at org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.get(MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java:121)
> 	at org.jclouds.aws.ec2.compute.suppliers.AWSEC2ImageSupplier.get(AWSEC2ImageSupplier.java:100)
> 	at org.jclouds.aws.ec2.compute.suppliers.AWSEC2ImageSupplier.get(AWSEC2ImageSupplier.java:61)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)