stratos-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gayan Gunarathne <gay...@wso2.com>
Subject Re: Python Cartridge Agent Test Failure
Date Mon, 22 Jun 2015 13:23:24 GMT
>
>
> On Mon, Jun 22, 2015 at 6:24 PM, Pubudu Gunatilaka <pubudug@wso2.com>
> wrote:
>
>> Hi Devs,
>>
>> According to the offline chat I had with Imesh, I increased the thread
>> pool size to 15. It would be a more acceptable solution rather than having
>> separate executor services for each test. Executor services has to maintain
>> properly and it won't happen if we use separate executor services in each
>> test.
>>
>> Please review and merge the pull request in [1].
>>
>> [1] - https://github.com/apache/stratos/pull/374
>>
>
Can't we make this as a configurable value?


>
>> Thank you!
>>
>> On Mon, Jun 22, 2015 at 10:31 AM, Pubudu Gunatilaka <pubudug@wso2.com>
>> wrote:
>>
>>> Hi Imesh,
>>>
>>> I found the root cause for this issue.
>>>
>>> ExecutorService executorService = StratosThreadPool.getExecutorService("TEST_THREAD_POOL",
5);
>>>
>>> We are using StratosThreadPool utility class to create or get already
>>> exist executor service. "TEST_THREAD_POOL" is the identifier or the key we
>>> used in the implementation. In StratosThreadPool class, it has a static
>>> concurrent hash map to hold the executor. Although we terminate event
>>> receivers in tear down, it won't stop all the running threads. Due to that,
>>> in the last test run it won't be able to receive the instance activated
>>> event as there aren't any available threads in the thread pool.
>>>
>>> public static ExecutorService getExecutorService(String identifier, int threadPoolSize)
{
>>>     ExecutorService executorService = executorServiceMap.get(identifier);
>>>     if (executorService == null) {
>>>         synchronized (executorServiceMapLock) {
>>>             if (executorService == null) {
>>>                 executorService = Executors.newFixedThreadPool(threadPoolSize);
>>>                 executorServiceMap.put(identifier, executorService);
>>>                 log.info(String.format("Thread pool created: [type] Executor
Service [id] %s [size] %d", identifier, threadPoolSize));
>>>             }
>>>         }
>>>     }
>>>     return executorService;
>>> }
>>>
>>>
>>> For this issue we can create a new thread pool as below. It will not
>>> affect any tests we run.
>>>
>>> ExecutorService executorService = Executors.newFixedThreadPool(5);
>>>
>>> IMO this is okay as we try to run tests. Otherwise we will have to
>>> increase the number of threads we use. But if we add more artifacts,
>>> threads number will have to increase.
>>>
>>> WDYT?
>>>
>>>
>>> On Mon, Jun 22, 2015 at 7:56 AM, Imesh Gunaratne <imesh@apache.org>
>>> wrote:
>>>
>>>> Yes I'm also seeing the same, we need to investigate this.
>>>>
>>>> Thanks
>>>>
>>>>
>>>> On Sunday, June 21, 2015, Pubudu Gunatilaka <pubudug@wso2.com> wrote:
>>>>
>>>>> Hi Devs,
>>>>>
>>>>> I ran the live test in python cartridge agent(PCA) and it was failed.
>>>>> There are 3 tests in the PCA and they run on based on the artifacts which
>>>>> is taken from a public repo and a private repo. Each test uses defined
>>>>> artifacts as parameters. When I ran all the 3 tests, which is the default
>>>>> run it was failed. Then I tried running a single test which uses a public
>>>>> repo and it was successful. Even running 2 tests was successful. But
could
>>>>> not run 3 tests successfully.
>>>>>
>>>>> After looking at logs, what I could understand is that in the last
>>>>> test, it waits for the instance activated event. But cartridge agent
has
>>>>> already sent the instance activated event. So after the timeout, build
get
>>>>> failed.
>>>>>
>>>>> ExecutorService executorService = StratosThreadPool.getExecutorService("TEST_THREAD_POOL",
5);
>>>>>
>>>>>
>>>>> Thread pool size we used in the PCA test is 5. I increased that number
>>>>> more than 5 and ran all 3 tests. It was successful. In each and every
test
>>>>> case, a new Executor Service is getting created and have the same number
of
>>>>> thread pool size. But every time last test fails regardless of the test
>>>>> order. Other thing is that when we are adding more artifact events as
>>>>> parameters which is also increasing the number of tests, we have to
>>>>> increase the thread pool size to run tests successfully.
>>>>>
>>>>> What could be the reason for this behavior?
>>>>>
>>>>> Thank you!
>>>>> --
>>>>>
>>>>> *Pubudu Gunatilaka*
>>>>> Software Engineer
>>>>> WSO2, Inc.: http://wso2.com
>>>>> lean.enterprise.middleware
>>>>> mobile:  +94 77 4078049
>>>>>
>>>>
>>>>
>>>> --
>>>> Imesh Gunaratne
>>>>
>>>> Senior Technical Lead, WSO2
>>>> Committer & PMC Member, Apache Stratos
>>>>
>>>>
>>>
>>>
>>> --
>>>
>>> *Pubudu Gunatilaka*
>>> Software Engineer
>>> WSO2, Inc.: http://wso2.com
>>> lean.enterprise.middleware
>>> mobile:  +94 77 4078049
>>>
>>
>>
>>
>> --
>>
>> *Pubudu Gunatilaka*
>> Software Engineer
>> WSO2, Inc.: http://wso2.com
>> lean.enterprise.middleware
>> mobile:  +94 77 4078049
>>
>
>
>
> --
> --
> Lahiru Sandaruwan
> Committer and PMC member, Apache Stratos,
> Senior Software Engineer,
> WSO2 Inc., http://wso2.com
> lean.enterprise.middleware
>
> phone: +94773325954
> email: lahirus@wso2.com blog: http://lahiruwrites.blogspot.com/
> linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146
>
>


-- 

Gayan Gunarathne
Technical Lead, WSO2 Inc. (http://wso2.com)
Committer & PMC Member, Apache Stratos
email : gayang@wso2.com  | mobile : +94 766819985

Mime
View raw message