frappe.exceptions.ValidationError: Too many writes in one request. Please send smaller requests

Bench update give this error:

frappe.exceptions.ValidationError: Too many writes in one request. Please send smaller requests

  1. Any solution around that error?

  2. These tables have grown to big: tabVersion, tabDeleted Document, tabCommunication (2Million records) and tabEmail Queue.
    Can I safely empty those table maybe to reduce the size of the DB if that’s the reason

  3. If all the above fails, is there a way to reverse back to the state before bench update? So far the site is stuck at System Updating

Many Thanks

1 Like

Digging into source code I found this:

And setting this self.auto_commit_on_many_writes = True can potentially solve the problem.

Next tasks is 1) to know how to initialize that variable globally or 2) Do witch patch/file I need to put that line into

Any lead will be appreciated

I added the code into the file itself and then bench update --patch did it

1 Like

There’s actually already a line in the file like this: self.auto_commit_on_many_writes = 0

All you need to do is change the 0 to 1

Cheers

We are expecting to fix this by sets of PR to stock related transcations and optimizing them to reduce the number of pending commits or merging multiple commis into a single commit.

We will sponsor the PR to optimize teh stock transaction that requires 1,000’s to 10,000’s of parts in Delivery Note, Purchase Receipt, Landed Cost Vouchers.

Having more than 1,000 items in stock transactions is pretty common in our part of the world where businesses don’t focus on what they want to sell, but want to sell anything and everything.

Please comment or like this post so that we know who else is interested or affected by this problem.

2 Likes

Why don’t we put it as a global Frappe parameter in the interface for administrators to be set according to the platform size?