You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Some queries failing with code 500: all shards failed | Failed to compile inline script #273
Run tests: python -m tdvt.tdvt run OpenSearch few times
Expected result
Tests would produce the same result all times
Actual result
214 tests failed at the 5th run with the following error:
Shard[0]: GeneralScriptException[Failed to compile inline script [rO0ABXNyADRvcmcub3B ... <omitted>] using lang [opensearch_query_expression]]; nested: CircuitBreakingException[[script] Too many dynamic script compilations within, max: [75/5m]; please use indexed, or scripts with parameters instead; this limit can be changed by the [script.context.aggs.max_compilations_rate] setting];\n\nFor more details, please send request for Json format to see the raw response from OpenSearch engine.
Additional context
The connector forces driver to produce log at %temp%\TableauTemp\jdbc-driver-log.txt
Many of the expressions are translated to DSL before executing, this results in a lot of compiling work, so when many requests hit the engine in parallel, the engine might run out of the resources and give out compiling error. We should optimize the expression calculation to fix this issue, but short termly it is recommended to scale your instance up or out. Optionally, we also recommend you change the queries to our preferred semantic, for example, use implicit/explicit cast from string literal to timestamp (e.g. cast('2021-11-09 00:00:00' as timestamp) or directly '2021-11-09 00:00:00') instead of using functions like timestamp('2021-11-09 00:00:00') to do the data converting.
I have conducted some research into the performance of the functions you mentioned and data type inputs for those functions to see how quickly they run to see if that is an issue that could cause the test failures. The results are in operations per second meaning that the higher the number is the faster it runs, below I have laid out my findings:
Operation
Data Type
2.4
upstream/main
CAST AS TIMESTAMP
STRING
834.418
382.739
CAST AS TIMESTAMP
TIMESTAMP
3538.903
2129.168
CAST AS TIMESTAMP
DATE
N/A
1165.644
CAST AS TIMESTAMP
TIME
N/A
1117.844
TIMESTAMP()
STRING
648.069
282.688
TIMESTAMP()
TIMESTAMP
2872.664
5274.195
TIMESTAMP()
DATE
2531.714
719.601
TIMESTAMP()
TIME
N/A
693.222
The overall efficiency of almost all functions have gone down in the newer version with the exception of giving TIMESTAMP() a TIMESTAMP but that doesn't matter as much compared to the difference in performance from TIMESTAMP() to CAST AS TIMESTAMP. Overall it appears that the average TIMESTAMP() function is roughly 60-70% of the speed of casting it to timestamp with the outlier of casting a timestamp to a timestamp being exceptionally quick.
So although it is faster most of the time to case as timestamp it doesn't appear to be a big enough of a performance hit to be causing test to fail
Here is the graph for memory usage on the current opensearchsql version:
Each function is ran 1000 times to get consistent results and the result is in Bytes per operation, because of this you can divide the result by 1000 to get the amount of data per single operation.
Here is the results of the same function compared to the 2.4 engine:
From a precursory glance at both graphs we can see that almost every operation has just about doubled in memory allocation except for inputting a timestamp datatype in the timestamp() function. Looking at the difference in memory usage from using timestamp() compared to casting we can see the casting uses ~30% less memory on average, which I don't believe would be enough to cause tests to fail.
I'm seeing this happening with PPL queries with Grafana dashboards. (Should I make a new issue in a different repo?)
Running even just a couple queries in parallel over modest time ranges (ie. 1 hour) seems to cause this failure periodically. Queries such as:
search source=my-index-*
| where Parameters.Key = 'client' OR Parameters.Key = 'CLIENT'
| stats dc(ContactId) as Calls by span(@timestamp, 10m)
| sort - @timestamp
What can we do to further diagnose, and correct?
I am not sure the issue you met is the same one with original one. I am going to close this since the original issue throws an OpenSearch Core exception CircuitBreakingException[[script] Too many dynamic script compilations within, max: [75/5m] which means the script compilations rate limitation was triggered. It can be resolved by increasing configuration script.max_compilations_rate. Feel free to reopen or create a new ticket if above configuration won't help.
Activity
chloe-zh commentedon Nov 13, 2021
Many of the expressions are translated to DSL before executing, this results in a lot of compiling work, so when many requests hit the engine in parallel, the engine might run out of the resources and give out compiling error. We should optimize the expression calculation to fix this issue, but short termly it is recommended to scale your instance up or out. Optionally, we also recommend you change the queries to our preferred semantic, for example, use implicit/explicit cast from string literal to timestamp (e.g. cast('2021-11-09 00:00:00' as timestamp) or directly '2021-11-09 00:00:00') instead of using functions like timestamp('2021-11-09 00:00:00') to do the data converting.
matthewryanwells commentedon Mar 27, 2023
I have conducted some research into the performance of the functions you mentioned and data type inputs for those functions to see how quickly they run to see if that is an issue that could cause the test failures. The results are in operations per second meaning that the higher the number is the faster it runs, below I have laid out my findings:
The overall efficiency of almost all functions have gone down in the newer version with the exception of giving
TIMESTAMP()aTIMESTAMPbut that doesn't matter as much compared to the difference in performance fromTIMESTAMP()toCAST AS TIMESTAMP. Overall it appears that the averageTIMESTAMP()function is roughly 60-70% of the speed of casting it to timestamp with the outlier of casting a timestamp to a timestamp being exceptionally quick.So although it is faster most of the time to case as timestamp it doesn't appear to be a big enough of a performance hit to be causing test to fail
matthewryanwells commentedon Mar 30, 2023
Here is the graph for memory usage on the current opensearchsql version:

Each function is ran 1000 times to get consistent results and the result is in Bytes per operation, because of this you can divide the result by 1000 to get the amount of data per single operation.
Here is the results of the same function compared to the 2.4 engine:

From a precursory glance at both graphs we can see that almost every operation has just about doubled in memory allocation except for inputting a
timestampdatatype in thetimestamp()function. Looking at the difference in memory usage from usingtimestamp()compared to casting we can see the casting uses ~30% less memory on average, which I don't believe would be enough to cause tests to fail.Support user-defined and incomplete date formats (#273) (#1821)
Support user-defined and incomplete date formats (#273) (#1821)
Support user-defined and incomplete date formats (#273) (#1821) (#1830)
Support user-defined and incomplete date formats (#273) (#1821)
Support user-defined and incomplete date formats (#273) (#1821) (#1840)
douglasg14b commentedon May 1, 2025
I'm seeing this happening with
PPLqueries with Grafana dashboards. (Should I make a new issue in a different repo?)Running even just a couple queries in parallel over modest time ranges (ie. 1 hour) seems to cause this failure periodically. Queries such as:
What can we do to further diagnose, and correct?
LantaoJin commentedon Jun 5, 2025
I am not sure the issue you met is the same one with original one. I am going to close this since the original issue throws an OpenSearch Core exception
CircuitBreakingException[[script] Too many dynamic script compilations within, max: [75/5m]which means the script compilations rate limitation was triggered. It can be resolved by increasing configurationscript.max_compilations_rate. Feel free to reopen or create a new ticket if above configuration won't help.