Landed cost voucher "Too many writes in one request"

I am trying to submit Landed cost voucher. At first try it gave me 504 Gateway Timeout error in browser console log. I increased timeout to 6000 sec by:

bench config http_timeout 6000
bench setup supervisor
bench setup nginx
sudo supervisorctl reload
sudo service nginx reload

Now 504 Gateway Timeout error gone, but have another issue. After pressing submit, it loads cpu for about 25 minutes and in the end throws message Too many writes in one request. Please send smaller requests

Here is browser console log log -
Tried on own ubuntu PC and on vm, both same. Landed cost voucher consists of 190 items, and there is about 10 sales invoices after purchase invoice against which I try to make landed cost voucher. Why it takes so long to submit and how to solve the above issue?

Running: ERPNext: v7.0.27, Frappe Framework: v7.0.22 on Ubuntu 16.04 LTS, Core i5 2320, 8Gb RAM.

Thank you.

Maybe these are all back-dated and the forward posting limit has crosses. Maybe you can uncheck the limit by commenting these lines and try again:

@nabinhait can you check?

1 Like

Thank you @rmehta for your reply.
Yes purchase invoice is back dated, and there is only 15 sales invoices after the purchase invoice date, no other docs that affect the stock. Commented out those lines and tried to submit. It was doing something for about 1 hour and 40 minutes (cpu load was nearly 80-90%, 1 python and 2 mysql processes) and catch again 504 Gateway Timeout error(I set timeout 6000 sec as mentioned in first post). I have total of 800 stock ledger entries and 150 GL entries, database near 10Mb. I think that there is some thing wrong, as data amount that I have cannot generate so many update delete insert queries. I enabled mysql log and tried the same landed cost voucher but with only 4 items instead of 190, and submitted successfully. It gave about 20 000 update delete insert queries and about 7 minute submitting.
Thank you team for such wonderful app, it becomes better and better.

@Hadzhi Is it possible to send me the backup of your database via email? That will help me a lot to investigate the issue. Only 4 Items in 1 hrs 40 mins, surely there is a problem with reposting logic.
Please let me know, otherwise I have to replicate the scenario with sufficient dummy data.

1 Like

Thank you for your feedback. Yes sure, I will send you soon. A little remark, 190 items took 1 hour and 40 minutes, but didn’t finish. 4 items took about 7 minutes. But as I said there is no such amount of data to to take it so much.

1 Like

Thank you for sending your database backup. I found a major flaw in the logic, the same transactions were reposting for each items in the Landed Cost Voucher. Fixed the issue via [fix] Repost only distinct purchase receipts and invoices by nabinhait · Pull Request #6125 · frappe/erpnext · GitHub :smile:


WOW :smile:
It is solved now. It took about 5-7 secs to submit. Thank you for so quick and amazing solution :clap: