In the _commerce_coupon_update_orders_multipass function max orders is set by total count on the field query

  $query = new EntityFieldQuery;
  $query
    ->entityCondition('entity_type', 'commerce_order')
    ->fieldCondition('commerce_coupon_order_reference', 'target_id', 'NULL', '!=');

  if (!isset($sandbox['orders']['progress'])) {
    $sandbox['orders']['progress'] = 0;
    $sandbox['orders']['current_id'] = 0;
    
    // Calculate the number of orders to need to be processed.
    $count_query = clone $query;    
    $sandbox['orders']['max'] = $count_query->count()->execute();
  }

The problem I've ran into is that in the field_data_commerce_coupon_order_reference table we had orders that referenced multiple coupons or references to orders that no longer existed in the commerce_orders table.

When an order has multiple coupons attached only unique orders are included.

    $order_ids = $results['commerce_order'];
    $orders = commerce_order_load_multiple(array_keys($results['commerce_order']));  // could be using $order_ids here

So if our current max is 12 but two of those entries reference the same order then our $orders array will only contain 10 items. Orders no longer existing in the commerce_order table would also be an issue.

The orders are then looped over

    foreach ($orders as $order) {
      ...
      ...
      $sandbox['orders']['progress']++;
      $sandbox['orders']['current_id'] = $order->order_id;
    }

and $sandbox['orders']['progress'] only increments to a value of 10 which makes the following code never validates to true and the update hook to never finish.

  $sandbox['orders']['#finished'] = empty($sandbox['orders']['max']) ? 1 : ($sandbox['orders']['progress'] / $sandbox['orders']['max']);

The script just runs infinitely and continually outputs "Performed update: commerce_coupon_update_7200"