Page MenuHomePhabricator

Protect Stream Access with a Mutex and Unique ID in Executors
Closed, ResolvedPublic

Description

Description

In order to ensure that reentrant calls can be made asynchronously (crucial for performance, especially if e.g. someone tries to Map() from inside the executor), each reentrant call will need to write all its output to stdout before another reentrant call starts writing its output. The flow will be

procedure reentrantCall:
    acquire mutex
    writeToStdout('start reentrant call')
    writeToStdout({ Z1K1: 'Z7', Z7K1: ...})
    writeToStdout('end reentrant call')
    release mutex
end procedure

As a consequence of this, other writes to stdout must also be protected, since they might be happening concurrently with a reentrant call. For example, writing a debug log will look similar to the above:

procedure debugLog(logString):
    acquire mutex
    writeToStdout('start debug log')
    writeToStdout(logString)
    writeToStdout('end debug log')
    release mutex
end procedure

Similarly, when the executor interface writes to the executor's stdin, the interface's stdin should be similarly mutex-locked.

Also, each reentrant call needs a unique ID to ensure that the results from the orchestrator are routed back to the correct async calls in the executor.

Desired behavior/Acceptance criteria (returned value, expected error, performance expectations, etc.)

  • writes to stdout (in executors) are mutex-protected
  • writes to stdin (in executor interfaces) are mutex-protected
  • reentrant calls are assigned unique IDs that are propagated among the executor, evaluator, and orchestrator

Completion checklist

Event Timeline

Mcastro triaged this task as Medium priority.Apr 4 2024, 4:35 PM
Mcastro moved this task from To Triage to Upcoming Epics on the Abstract Wikipedia team board.
cmassaro renamed this task from Protect Stdout Access with a Mutex in Executors to Protect Stream Access with a Mutex and Unique ID in Executors.Apr 15 2024, 11:39 PM
cmassaro updated the task description. (Show Details)

Change #1064031 had a related patch set uploaded (by Jforrester; author: Jforrester):

[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2024-07-19-164024 to 2024-08-13-135124

https://gerrit.wikimedia.org/r/1064031

Change #1064032 had a related patch set uploaded (by Jforrester; author: Jforrester):

[operations/deployment-charts@master] wikifunctions: Upgrade evaluators from 2024-07-23-225548 to 2024-08-16-153209

https://gerrit.wikimedia.org/r/1064032

Change #1064031 merged by jenkins-bot:

[operations/deployment-charts@master] wikifunctions: Upgrade orchestrator from 2024-07-19-164024 to 2024-08-13-135124

https://gerrit.wikimedia.org/r/1064031

Change #1064032 merged by jenkins-bot:

[operations/deployment-charts@master] wikifunctions: Upgrade evaluators from 2024-07-23-225548 to 2024-08-16-153209

https://gerrit.wikimedia.org/r/1064032

Change #1070964 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/extensions/WikiLambda@master] Update function-schemata sub-module to HEAD (5b29ba9)

https://gerrit.wikimedia.org/r/1070964

Change #1070964 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Update function-schemata sub-module to HEAD (5b29ba9)

https://gerrit.wikimedia.org/r/1070964