‎2020 Aug 25 11:25 AM
From the debugger

WAIT UNTIL used_slots LT slots_allocated.
" Get number of first free slot
READ TABLE slots WITH KEY used = abap_false REFERENCE INTO DATA(slot).
ADD 1 TO used_slots.
slot->used = abap_true.
ret_result = slot->task_name.
Clearly used_slots is not less than slots_allocated.
Any suggestions? Thanks,
matt
‎2020 Aug 25 11:30 AM
Hello matthew.billingham
Just a guess, but maybe that's the reason: "If the result of log_exp is false and there is no asynchronous function call with a callback routine, the execution of the program is not interrupted (regardless of the result of log_exp) and sy-subrc is set to the value 4.". Although, you probably checked this already.
https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapwait_until.htm
Kind regards,
Mateusz
‎2020 Aug 25 11:30 AM
Hello matthew.billingham
Just a guess, but maybe that's the reason: "If the result of log_exp is false and there is no asynchronous function call with a callback routine, the execution of the program is not interrupted (regardless of the result of log_exp) and sy-subrc is set to the value 4.". Although, you probably checked this already.
https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapwait_until.htm
Kind regards,
Mateusz
‎2020 Aug 25 11:34 AM
Also, from the same SAP Help page: "If the new check on the result of the logical expression is false and the callback routines of the functions previously called asynchronously were all executed, sy-subrc is set to 4 and the execution of the program is resumed with the statement that follows WAIT.". This gives me an idea, that maybe records of the USED_SLOTS internal table are not updated properly. Have you checked that part?
What is the SY-SUBRC value after the WAIT?
Kind regards,
Mateusz‎2020 Aug 25 1:03 PM
You got it first time - although I was thinking it must the second one, initially. I saw asynchronous function calls with callback executing - but then I checked ST22 and found dumps... I'd a typo in the FM name. It didn't exist...
‎2020 Aug 25 1:20 PM
The lack of function name validation during code activation should be added long time ago...
Glad you've found the issue.
‎2020 Aug 25 12:58 PM
matthew.billingham, what is the general logic behind used_slots and slots_allocated and how do both values change over time?
In my scenarios of applying parall processing, I would manage the parallel tasks this way:
In your scenario, I assume you have m parallel tasks, but only n available slots at the same time for processing the tasks (n < m). That way, you can only start n tasks right away, and have to queue the remaining tasks until the first set of tasks are finished. Once a task is finished, you will take the first next task in the queue and start it.
Is this correct so far?
The interesting question would be then, how and when do the counters for used_slots and slots_allocated change over time? Are both 'moving' targets?
I am not sure if my questioning is going to solve your problem, but I am trying to understand the logic first.