cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 Odata V4 -> Intermittent 500 internal server error when making request to CAP server

WilliamW
Explorer

l am struggling with an intermittent issue where batch request from oData v4 service to CAP server is failing with 500 internal server error.

However is no error in the server logs.

It is happening in all our environments (DEV, TEST, PROD) It just return the error message attached. I also attached the calls which trigger the error. The app is a master detail app displaying customers, these batch calls are made upon opening a customer's profile.

Basically these calls will work perfectly then after opening up a few profiles one will error (its like 1 in 20 times). If it errors for a customer you can just refresh the app and the same profile will load up again. It seems to be completely random in that it doesn't seem to always happen for any particular customer

sachinkalpetta
Explorer
0 Kudos

Hi William,

If it's 500 internal server error then you should have some clues in the server side logs. Are you sure you don't have any additional information there?

Thanks,

Sachin Srambickal

View Entire Topic
TiagoAlmeida
Participant
0 Kudos

Have a look in the server logs in Kibana around the time the error happens. There will be a more detailed error message there.

I've seen issues like this when doing multiple batch calls with multiple writes into a CAP Server, some of the requests would fail randomly/intermittently. We fixed it by changing the DB connection pool settings in the package.json. Essentially having a longer timeouts between cap and the HANA db and a larger connection pool. Your problem may be the same. The error log will give you more details.

WilliamW
Explorer
0 Kudos

Hi Tiago, thank you for your response. I checked Kabana and could not find any error message there. Do you have an example of the error message you would see there?

Our scenario may be different for yours as you mention it is caused by multiple write requests - in our case the errors are being triggered by read requests only

Below is our DB connection pool settings, can you please advise your settings and we can try them and see if it resolves the issue?

TiagoAlmeida
Participant
0 Kudos

The settings are documented here: https://cap.cloud.sap/docs/node.js/databases?q=acquireTimeout#pool

You can play around with increasing the acquireTimeoutMillis and the max setting. Or bringing more obscure settings described above in the docs.

What you have above says up to 200 connections and a max wait time of 30s. If you have lots of connections it may happen that (some) have to wait more than 30s and so from the CAP perspective, the Database operation would fail.

I would try doubling or tripling that acquireTimeoutMillis and seeing if it helps at all.

On kibana if it is inadequate pool settings you see an error like a "connection timeout", I don't know exact wording. You also see the HTTP 500 error that CAP then sends to the requester.

WilliamW
Explorer
0 Kudos

Thanks Tiago, I doubled the Max pool and connection timeout but unfortunately it did not solve the issue

Additionally there is the following error in the browser

TiagoAlmeida
Participant
0 Kudos

Hi,

Have a look on the kibana logs at the same time of that browser request error message. There will be more details in there to help you pin point the cause.