Jint.Runtime.StatementsCountOverflowException

249 views
Skip to first unread message

Ivan Montilla

unread,
Mar 5, 2020, 7:16:09 AM3/5/20
to RavenDB - 2nd generation document database
Hello, I'm generating a document, with an array of 1500 elements and each of these elements has another array with 100 elements:

var budget = new Budget
{
AdditionalInformation = "Prueba de proforma super larga",
CanGenerateInvoice = true,
CreationDate = DateTime.Now,
CustomerId = "I-1-A",
Taxaction = new Tax("IVA España", 21),
};

for (int i = 0; i < 1500; i++)
{
var line = new Line
{
Description = $"Línea {i + 1}"
};

for (int j = 0; j < 100; j++)
{
var concept = new Line.Concept($"Concepto {j + 1} en línea {i + 1}", 9.49m);
line.Concepts.Add(concept);
}

budget.Lines.Add(line);
}

await repository.AddAsync(budget, cancellation);
await _transaction.CommitAsync(cancellation);
return Ok($"Created ultra budget, ID: {budget.Id}");

That is only a test, but our application will have documents with similar numbers of subelements.

Now, I need to generate a PDF of one element, so I write a query like this:

return await _session.Query<Budget>()
.Where(budget => budget.Id == id)
.Select(budget => new BudgetOutputModel
{
CanGenerateInvoice = budget.CanGenerateInvoice,
Date = budget.CreationDate.Value,
Taxaction = budget.Taxaction,
AdditionalInformation = budget.AdditionalInformation,
CustomerId = budget.CustomerId,
Id = budget.Id.Substring(_collection.Length + 1),
Lines = budget.Lines.Select(line => new BudgetLineModel
{
Description = line.Description,
Concepts = line.Concepts.Select(concept => new BudgetConceptModel
{
Name = concept.Name,
Amount = concept.Amount.Value
}).ToList()
}).ToList(),
}).FirstOrDefaultAsync(cancellation);

I'm using this query to generate the PDF, but I get `Jint.Runtime.StatementsCountOverflowException: The maximum number of statements executed have been reached` when I try to execute it.

Any idea how I can fix it? Maybe I can set the maximum number of statements or I should query batching lines by 100?

Grisha Kotler

unread,
Mar 5, 2020, 8:36:02 AM3/5/20
to rav...@googlegroups.com
You can set the Indexing.MaxStepsForScript for the specific index (default is 10000).
Please use the latest stable build (4.2.101)

image.png

Grisha Kotler
Team Leader   /   Hibernating Rhinos LTD
Skype:  grisha.kotler
Support:  sup...@ravendb.net
  


--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ravendb/76229952-2e16-4c9a-a209-bd4e2eac1558%40googlegroups.com.

Ivan Montilla

unread,
Mar 5, 2020, 9:48:45 AM3/5/20
to RavenDB - 2nd generation document database
I set this property to 2147483647 (int.MaxValue) in setting.json (I can't find Customized Options in the studio). The exception is thrown.

Are you sure that the problem is the server configuration and not the client? The exception is thrown in the client.
To unsubscribe from this group and stop receiving emails from it, send an email to rav...@googlegroups.com.

Arkadiusz Palinski

unread,
Mar 6, 2020, 3:32:24 AM3/6/20
to RavenDB - 2nd generation document database
1. Can you share the full exception (including stacktrace)? I think you're getting this because of projection you do when querying (not because of indexing)

2. Please try to increase Patching.MaxStepsForScript (default:10000) (instead of Indexing.MaxStepsForScrip) - this is a separate configuration option that is used when querying with the usage of JS projections

To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ravendb/6094dbca-624c-4cbb-aeec-3feedd83c788%40googlegroups.com.


--
Arkadiusz Paliński

Team Leader   /   Hibernating Rhinos LTD

Ivan Montilla

unread,
Mar 6, 2020, 5:08:47 AM3/6/20
to RavenDB - 2nd generation document database
Hi Arkadiusz, I solved increasing Patching.MaxStepsForScript. Thank you!

johan akesson

unread,
Aug 11, 2021, 10:22:50 AM8/11/21
to RavenDB - an awesome database
I am facing a similar issues, but I only get the exception of certain search terms. Which does not really make sense to me, if I am searching for X I get the expected result, but if I search for Y I am getting an error. 

I tried changing the 'Index.ingMaxStepsForScript', but it was not succesful but I cannot figure out where to set the 'Patching.MaxStepsForScript' in the Cloud (4.2) interface. Any idea where I can find this setting?

Egor Shamanaev

unread,
Aug 11, 2021, 10:37:06 AM8/11/21
to rav...@googlegroups.com
Hi 

If you are using our cloud solution (https://cloud.ravendb.net/) please open a ticket using the customer portal and we will set this configuration for you.
You received this message because you are subscribed to the Google Groups "RavenDB - an awesome database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ravendb/5d89a0a6-b3fa-4d15-b85c-f5ed1e2df74bn%40googlegroups.com.


--
Egor
Developer   /   Hibernating Rhinos LTD
Reply all
Reply to author
Forward
0 new messages