This shouldn't take that long. Is the number changing? It sounds like it got stuck in some sort of loop which may be indicative of some unexpected data in the DB.
What does this query return?
Code:
SELECT user_id, user_group_list, COUNT(*) AS total,
GROUP_CONCAT(permission_combination_id ORDER BY permission_combination_id) AS ids
FROM xf_permission_combination
GROUP BY user_id, user_group_list
HAVING total > 1
Assuming the step is still running, if you run that query again, are the results any different?
If it's still the same, if you submit a ticket where we can get access to the files and trigger the upgrade script (presumably via the CLI), I can do some analysis. We haven't had any other reports of issues with this code that I'm aware of and I see no reason for this to fail like this.