Struck with Stuck Threads Running Across EBS, SOA and ODI
There was an interesting issue that involved EBS, SOA and ODI with a client that I worked earlier. Customer is using Product Data Hub (PDH) application along with Integrated SOA Gateway (ISG) for publishing product details from master repository (EBS) to downstream systems. Oracle SOA is used as integration layer and ODI is used to extract bulk data from PDH. All applications are deployed in Azure and Azure Application Gateway is used as Loadbalancer (LB). High level flow is as below:
EBS Business Event -> SOA -> ODI PIM Webservice -> ODI Scenario -> EBS DB.
Lately the customer has been observing stuck threads in SOA and ODI and response never comes back to SOA even after waiting for hours. I got interested in this problem, will let you know the reason at the end. We followed below procedure to find the root cause:
The issue was replicated at will in lower envs. We observed stuck threads in both SOA and ODI when issue occurred. We took the thread dumps. We could see that in SOA and ODI, threads were waiting on network connection. These threads were reading from network at two ends of the webservice call i.e., between SOA and ODI. We also observed that ODI scenario got completed successfully but no response was sent back to SOA. We checked SOA and ODI logs but no useful information was found.
We checked network connections opened by SOA and ODI servers using lsof. Both servers have had a network connection in ESTABLISHED state with other server (SOA to ODI and vice versa). This gave us clue that connectivity might be timing out somewhere between SOA and ODI and LB is one of the suspects. My colleague, Siva, also told that this issue was occurring when ODI scenario takes more than 4 mins to complete.
Couple of days passed. I was going through old incidents and CRs to better understand a new client system (I have recently been moved to a different client assignment). Customer is on Oracle Cloud Infrastructure (OCI). It was a CR to increase read timeout value of OCI LB. It was Eureka moment !!!. I immediately opened google and searched for “Azure loadbalancer 4 minutes read timeout. There were lot of search results, which explained about our issue. Here is brief explanation, Azure App Gateway has default read timeout setting of 4 minutes after which it discards connection. Unfortunately, it doesn’t do it gracefully and do not let know both client and backend servers about closing connection. So, in our case, both SOA and ODI always keep the sockets open unaware of this behavior.
We also wanted to double check our understanding with a controlled test. Developed a simple two-way synchronous SOA composite that will take time as parameter and wait for those many minutes and give response. Both SOA and ODI use same LB, so it can validate our understanding. We first ran with 3 minutes and then with 5 minutes in soapui. We got response for 3 mins request but soapui request was hanging when tested with 5 minutes. Later, we replaced LB url with ip in soapui and tested with 5 minutes input. This time we got response. This confirmed that the issue was with LB’s 4 minute read timeout.
Our colleague raised issue with Microsoft. Microsoft told that read timeout cannot be changed for Application Gateway when used with private ip. So, practical solution for now is to tune EBS DB to provide response within 4 mins.
We got this issue almost a year ago, at that time we were not able to diagnose the problem. In fact, we were misguided to apply a patch in EBS. This is the reason for my interest. I reflected on why we are able to solve this problem this time. Here are my thoughts:
First, we are able to replicate the issue at will now in lower env and found a pattern that issue occurs when ODI scenario takes more than 4 mins. Credits to my colleague Siva. Second, purely luck. Came across LB read timeout setting in my current assignment by chance. Third, we were quickly able to develop sample application to demonstrate our understanding. Thanks to my colleague Vijay who helped in learning bit of developing soa composites.
Thanks for reading long post.
Comments
Post a Comment