Closed (fixed)
Project:
Search API
Version:
8.x-1.x-dev
Component:
General code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 Jun 2020 at 15:41 UTC
Updated:
8 Apr 2024 at 13:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
drunken monkeyHuh, very strange. Looking at the code, it should be pretty much impossible that this happens.
While we could easily guard against this with some additional checks, I think the better solution would be just to not execute our own batch operations during an update hook. Doesn’t seem like a good idea, generally, I’d say.
Patch attached. Would be great if you could verify that this helps – but probably not really/easily possible.
Comment #3
drunken monkeyAny feedback on this? Either after testing whether it works, or just general opinion on whether this makes sense?
Comment #4
drunken monkeyChanging the title so others may find this.
Comment #5
taran2lSeeing this issue while other module is being enabled, the provided patch does not help. Using Search API 1.23
Comment #6
rajeshreeputrasame issue with 1.27 release while enabling search_api module in batch from UI.
Comment #7
rajeshreeputraComment #8
rajeshreeputraComment #9
drunken monkeyThanks for the feedback, unfortunate that this still didn’t help.
Please see the attached patch for whether this works for you.
@ Rajeshreeputra: Thanks for your patch, also a good attempt! However, under these strange circumstances, I’d rather still execute any tasks we can find/load, and just guard against the division by zero error.
Comment #10
drunken monkeySorry, seems I forgot to actually attach my patch. Please test/review!
Comment #11
drunken monkeyOops, logic in the
elsebranch was the wrong way round. Let’s also ensure that the total number of items cannot be less than$pending.Comment #12
drunken monkeyWould anyone be willing/able to test this, please, to make sure this actually solves the problems?
Comment #13
vaidas_a commentedPatch #11 worked for me.
In my case I was receiving an error when importing configuration:
ResponseText: DivisionByZeroError: Division by zero in Drupal\search_api\Task\TaskManager->processBatch() (line 373 of C:\DEV\Projects\intranet\intranet-sources\modules\contrib\search_api\src\Task\TaskManager.php).
After applying the patch I didn't receive this error anymore.
Thank you
Comment #15
drunken monkeyGood to hear, thanks a lot for reporting back!
Committed. Thanks again, everyone!
Comment #17
rajeshreeputraWhen can we expect this to be released, Thanks!!
Comment #18
joachim commentedI'm not sure this will completely fix the bug.
I got:
> ResponseText: The website encountered an unexpected error. Try again later.DivisionByZeroError: Division by zero in Drupal\search_api\Task\TaskManager->processBatch() (line 370 of modules/contrib/search_api/src/Task/TaskManager.php). _batch_process() (Line: 138)
when installing the https://github.com/localgovdrupal/localgov_directories module.
Comment #19
ericdsd commented@Joachim did you apply the patch as the commit is not in a release yet ?
Comment #20
vipin.mittal18This has been released at search_api version 8.x-1.32