Skip to content

Possible batching bug depending on number of objects batched #1588

Open
@cbaker6

Description

@cbaker6

I suspect there's a bug in arrayBySplittingArray , particularly:

NSArray *subarray = [array subarrayWithRange:NSMakeRange(index, length)];

I think there are two issues, but this is only a suspicion as there are no test cases for arrayBySplittingArray. I don't recall, how range works for objective-c, but if it's similar to swift, I'm sure there's an issue. Basically, batches can be missed when the number of objects go over the default batch limit of 50. I suspect most people are batching with < 50 objects so the issue won't show up there.

  1. The endpoint of the subarray should grow dynamically while iterating through the while loop, it currently isn't doing this properly. Should be index+length.
  2. If range works the same way as Swift, then it should be < the endpoint of the array or else it can jump out-of-bounds.

If someone wants to take this on, replicating the test cases I wrote for ParseSwift should detect the problem .

The ParseSwift equivalent for arrayBySplittingArray is here which can be used to fix the bug: https://github.com/parse-community/Parse-Swift/blob/f1de7e4a95d937bcc008bc5ef040ebba3ced7adb/Sources/ParseSwift/API/BatchUtils.swift#L35-L49

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions