Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hana] exceed maximum number of prepared statements: the number of prepared statements per connection cannot exceed the max statements #1123

Open
geert-janklaps opened this issue Apr 6, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@geert-janklaps
Copy link

Description of erroneous behaviour

We have a long running process for initial synchronization (S/4HANA to HANA DB), this process runs easily one hour due to the amount of data. This process runs perfectly fine in systems with limited data, but in productive systems with 40k+ of data, the process runs into an error: "exceed maximum number of prepared statements: the number of prepared statements per connection cannot exceed the max statements"

I found a similar issue in a non-related project: typeorm/typeorm#7344

Looking at the current database driver code, it looks like the prepared statements are not dropped after execution, causing the same issue as described in the referred issue.

I think the issue can easily be resolved by dropping the prepared statements after execution. (I'm using the default hana configuration, with hdb package)

Detailed steps to reproduce

Create a loop with e.g. 100k+ records
Insert one by one

=> Our case is doing batch updates, but also combining it with a lot of select statements (reading configuration, determining how data should be calculated and stored)

Details about your project

| ---------------------- | ------------------------------------------------------------------------------------------ |
| @cap-js/asyncapi | 1.0.2 |
| @cap-js/cds-typer | 0.29.0 |
| @cap-js/cds-types | 0.6.5 |
| @cap-js/db-service | 1.17.0 |
| @cap-js/hana | 1.6.0 |
| @cap-js/openapi | 1.1.2 |
| @cap-js/sqlite | 1.8.0 |
| @sap/cds | 8.7.0 |
| @sap/cds-common-conten | 2.1.0 |
| @sap/cds-compiler | 5.7.0 |
| @sap/cds-dk | 8.7.0 |
| @sap/cds-dk (global) | 8.8.2 |
| @sap/cds-fiori | 1.3.0 |
| @sap/cds-foss | 5.0.1 |
| @sap/cds-mtxs | 2.5.1 |
| @sap/eslint-plugin-cds | 2.7.0 |
| Node.js | v22.11.0 |

@geert-janklaps geert-janklaps added the bug Something isn't working label Apr 6, 2025
@patricebender
Copy link
Member

@BobdenOs could you have a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants