Thanks Kishanthan If we were to fix this by calling startTenantFlow() the fix would be a lot more complicated and may lead to other issues. So I have tested the original fix done by Jagath in this case and didn't run into any issues functional wise. Though I could not recreate the issue in the first place so we still dont know what causes this exactly.
@ChanakaF, I have sent the PR with the fix that I tested[1], please merge [1] https://github.com/wso2/carbon-mediation/pull/671 On 27 June 2016 at 17:15, Kishanthan Thangarajah <kishant...@wso2.com> wrote: > > > On Mon, Jun 27, 2016 at 12:13 PM, Uvindra Dias Jayasinha <uvin...@wso2.com > > wrote: > >> Before I just apply the stated fix I would like some feedback from the >> Carbon team regarding what maybe causing this issue. >> >> So here is what we are seeing so far, >> >> 1. IllegalStateException is being thrown by >> CarbonContextDataHolder.setTenantDomain() >> >> 2. The logic in setTenantDomain() is as follows, >> a) If the this.tenantDomain of the CarbonContextDataHolder is null >> or is equal to the super tenant domain then its fine >> >> b) But if the this.tenantDomain of the CarbonContextDataHolder is >> Not Equal to the tenant domain value that is being set then there is a >> chance for the IllegalStateException to be thrown. >> >> So what this seems to indicate is that you cannot call setTenantDomain() >> if the current tenantDomain within the carbon context is already set to >> another tenants domain. This could be due to startTenantFlow() not being >> called before setting the tenant domain. Could this be the cause? >> > > If the tenant domain is already set, then it can not be set again within > the same thread flow, unless you start a new tenant flow or setting a > tenant domain other than super tenant. > > Starting a new tenant flow means, the current ContextHolder instance will > be pushed onto the stack and then the thread would see a new ContextHolder > instance until that tenant flow is properly ended (popped from the stack), > which then the thread would see the previous ContextHolder instance which > was there before starting the tenant flow. > > >> On 24 June 2016 at 14:44, Uvindra Dias Jayasinha <uvin...@wso2.com> >> wrote: >> >>> Problem is the issue is intermittent so its difficult to verify but I >>> will test the fix out and send a PR >>> >>> On 24 June 2016 at 13:52, Chanaka Fernando <chana...@wso2.com> wrote: >>> >>>> Hi Uvindra, >>>> >>>> Could you please verify the fix and send us a PR so that we can merge >>>> it? >>>> >>>> On Fri, Jun 24, 2016 at 1:02 PM, Uvindra Dias Jayasinha < >>>> uvin...@wso2.com> wrote: >>>> >>>>> Hi All, >>>>> >>>>> The original issue encountered in [1] was fixed via the resolution of >>>>> [2]. >>>>> >>>>> But now this has been reopened and in this case the same issue has got >>>>> exposed, but on this occasion the call stack is different. This is >>>>> happening when setting the tenant info at [3]. So we need to apply the >>>>> same >>>>> fix that was done in resolving [2] to the WSO2Registry class when setting >>>>> the tenant info. >>>>> >>>>> Can we get this fixed? >>>>> >>>>> >>>>> [1] https://wso2.org/jira/browse/APIMANAGER-4202 >>>>> [2] https://wso2.org/jira/browse/ESBJAVA-4333 >>>>> [3] >>>>> https://github.com/wso2/carbon-mediation/blob/v4.6.1-BETA3/components/mediation-registry/org.wso2.carbon.mediation.registry/src/main/java/org/wso2/carbon/mediation/registry/WSO2Registry.java#L747 >>>>> >>>>> >>>>> -- >>>>> Regards, >>>>> Uvindra >>>>> >>>>> Mobile: 777733962 >>>>> >>>> >>>> >>>> >>>> -- >>>> Thank you and Best Regards, >>>> Chanaka Fernando >>>> Senior Technical Lead >>>> WSO2, Inc.; http://wso2.com >>>> lean.enterprise.middleware >>>> >>>> mobile: +94 773337238 >>>> Blog : http://soatutorials.blogspot.com >>>> LinkedIn:http://www.linkedin.com/pub/chanaka-fernando/19/a20/5b0 >>>> Twitter:https://twitter.com/chanakaudaya >>>> >>>> >>>> >>>> >>>> >>> >>> >>> -- >>> Regards, >>> Uvindra >>> >>> Mobile: 777733962 >>> >> >> >> >> -- >> Regards, >> Uvindra >> >> Mobile: 777733962 >> > > > > -- > *Kishanthan Thangarajah* > Technical Lead, > Platform Technologies Team, > WSO2, Inc. > lean.enterprise.middleware > > Mobile - +94773426635 > Blog - *http://kishanthan.wordpress.com <http://kishanthan.wordpress.com>* > Twitter - *http://twitter.com/kishanthan <http://twitter.com/kishanthan>* > -- Regards, Uvindra Mobile: 777733962
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev