Skip to content

Instantly share code, notes, and snippets.

@mem
Created May 30, 2019 18:06
Show Gist options
  • Save mem/7ecfdf3c9a6f7e77bca03fef9c88cba4 to your computer and use it in GitHub Desktop.
Save mem/7ecfdf3c9a6f7e77bca03fef9c88cba4 to your computer and use it in GitHub Desktop.
@startuml
autonumber
hide footbox
participant "wrapper\n(stage 2)" as wrapper
participant "stage 1" as stage_1
participant master
participant "rpc server" as rpc_server
activate wrapper
wrapper -> stage_1 ** : spawn
activate stage_1
note over stage_1: prepare config
stage_1 -> wrapper: send config
deactivate stage_1
note over wrapper: create socket pair A
note over wrapper: create socket pair B
wrapper -> master ** : spawn
note over wrapper: close A[0]
activate master
note over master: close A[1]
note over master: close B[0]
wrapper -> rpc_server ** : spawn
note over rpc_server: close B[1]
note over wrapper: close B[0]
note over wrapper: close B[1]
activate rpc_server
master -> rpc_server: request open over B[1]
rpc_server -> master: send fd over B[0]
note over master: mount passing\nfd as option
note over wrapper: enter stage 2
note over wrapper: start pre-process\nuse fd
master -> wrapper: send fd over A[0]
note over wrapper: start process
@enduml
Display the source blob
Display the rendered blob
Raw
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="878px" preserveAspectRatio="none" style="width:529px;height:878px;" version="1.1" viewBox="0 0 529 878" width="529px" zoomAndPan="magnify"><defs><filter height="300%" id="f14wpgitltdsjk" width="300%" x="-1" y="-1"><feGaussianBlur result="blurOut" stdDeviation="2.0"/><feColorMatrix in="blurOut" result="blurOut2" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"/><feOffset dx="4.0" dy="4.0" in="blurOut2" result="blurOut3"/><feBlend in="SourceGraphic" in2="blurOut3" mode="normal"/></filter></defs><g><rect fill="#FFFFFF" filter="url(#f14wpgitltdsjk)" height="792.4141" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="79" y="64.5938"/><rect fill="#FFFFFF" filter="url(#f14wpgitltdsjk)" height="74.4297" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="199" y="95.7266"/><rect fill="#FFFFFF" filter="url(#f14wpgitltdsjk)" height="569.4531" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="277" y="287.5547"/><rect fill="#FFFFFF" filter="url(#f14wpgitltdsjk)" height="406.7578" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="472" y="450.25"/><rect fill="#FEFECE" filter="url(#f14wpgitltdsjk)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="66" x="169" y="64.5938"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="52" x="176" y="84.5889">stage 1</text><rect fill="#FEFECE" filter="url(#f14wpgitltdsjk)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="62" x="249" y="256.4219"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="48" x="256" y="276.417">master</text><rect fill="#FEFECE" filter="url(#f14wpgitltdsjk)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="83" x="433.5" y="419.1172"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="69" x="440.5" y="439.1123">rpc server</text><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="84" x2="84" y1="54.5938" y2="866.0078"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="204" x2="204" y1="97.2422" y2="866.0078"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="282" x2="282" y1="289.0703" y2="866.0078"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="476.5" x2="476.5" y1="451.7656" y2="866.0078"/><rect fill="#FEFECE" filter="url(#f14wpgitltdsjk)" height="46.5938" style="stroke: #A80036; stroke-width: 1.5;" width="76" x="44" y="3"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="56" x="54" y="22.9951">wrapper</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="62" x="51" y="39.292">(stage 2)</text><rect fill="#FFFFFF" filter="url(#f14wpgitltdsjk)" height="792.4141" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="79" y="64.5938"/><rect fill="#FFFFFF" filter="url(#f14wpgitltdsjk)" height="74.4297" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="199" y="95.7266"/><rect fill="#FFFFFF" filter="url(#f14wpgitltdsjk)" height="569.4531" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="277" y="287.5547"/><rect fill="#FFFFFF" filter="url(#f14wpgitltdsjk)" height="406.7578" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="472" y="450.25"/><polygon fill="#A80036" points="157,81.7266,167,85.7266,157,89.7266,161,85.7266" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="89" x2="163" y1="85.7266" y2="85.7266"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="9" x="96" y="80.6606">1</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="40" x="109" y="80.6606">spawn</text><rect fill="#FEFECE" filter="url(#f14wpgitltdsjk)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="66" x="169" y="64.5938"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="52" x="176" y="84.5889">stage 1</text><path d="M145,114.8906 L145,139.8906 L258,139.8906 L258,124.8906 L248,114.8906 L145,114.8906 " fill="#FBFB77" filter="url(#f14wpgitltdsjk)" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M248,114.8906 L248,124.8906 L258,124.8906 L248,114.8906 " fill="#FBFB77" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="92" x="151" y="131.9575">prepare config</text><polygon fill="#A80036" points="100,166.1563,90,170.1563,100,174.1563,96,170.1563" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="94" x2="203" y1="170.1563" y2="170.1563"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="9" x="106" y="165.0903">2</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="73" x="119" y="165.0903">send config</text><path d="M8,183.1563 L8,208.1563 L157,208.1563 L157,193.1563 L147,183.1563 L8,183.1563 " fill="#FBFB77" filter="url(#f14wpgitltdsjk)" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M147,183.1563 L147,193.1563 L157,193.1563 L147,183.1563 " fill="#FBFB77" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="128" x="14" y="200.2231">create socket pair A</text><path d="M8,222.2891 L8,247.2891 L157,247.2891 L157,232.2891 L147,222.2891 L8,222.2891 " fill="#FBFB77" filter="url(#f14wpgitltdsjk)" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M147,222.2891 L147,232.2891 L157,232.2891 L147,222.2891 " fill="#FBFB77" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="128" x="14" y="239.356">create socket pair B</text><polygon fill="#A80036" points="237,273.5547,247,277.5547,237,281.5547,241,277.5547" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="89" x2="243" y1="277.5547" y2="277.5547"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="9" x="96" y="272.4888">3</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="40" x="109" y="272.4888">spawn</text><rect fill="#FEFECE" filter="url(#f14wpgitltdsjk)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="62" x="249" y="256.4219"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="48" x="256" y="276.417">master</text><path d="M39,306.7188 L39,331.7188 L124,331.7188 L124,316.7188 L114,306.7188 L39,306.7188 " fill="#FBFB77" filter="url(#f14wpgitltdsjk)" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M114,306.7188 L114,316.7188 L124,316.7188 L114,306.7188 " fill="#FBFB77" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="64" x="45" y="323.7856">close A[0]</text><path d="M237,345.8516 L237,370.8516 L322,370.8516 L322,355.8516 L312,345.8516 L237,345.8516 " fill="#FBFB77" filter="url(#f14wpgitltdsjk)" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M312,345.8516 L312,355.8516 L322,355.8516 L312,345.8516 " fill="#FBFB77" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="64" x="243" y="362.9185">close A[1]</text><path d="M237,384.9844 L237,409.9844 L322,409.9844 L322,394.9844 L312,384.9844 L237,384.9844 " fill="#FBFB77" filter="url(#f14wpgitltdsjk)" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M312,384.9844 L312,394.9844 L322,394.9844 L312,384.9844 " fill="#FBFB77" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="64" x="243" y="402.0513">close B[0]</text><polygon fill="#A80036" points="421.5,436.25,431.5,440.25,421.5,444.25,425.5,440.25" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="89" x2="427.5" y1="440.25" y2="440.25"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="9" x="96" y="435.1841">4</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="40" x="109" y="435.1841">spawn</text><rect fill="#FEFECE" filter="url(#f14wpgitltdsjk)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="83" x="433.5" y="419.1172"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="69" x="440.5" y="439.1123">rpc server</text><path d="M432,469.4141 L432,494.4141 L517,494.4141 L517,479.4141 L507,469.4141 L432,469.4141 " fill="#FBFB77" filter="url(#f14wpgitltdsjk)" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M507,469.4141 L507,479.4141 L517,479.4141 L507,469.4141 " fill="#FBFB77" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="64" x="438" y="486.481">close B[1]</text><path d="M39,508.5469 L39,533.5469 L124,533.5469 L124,518.5469 L114,508.5469 L39,508.5469 " fill="#FBFB77" filter="url(#f14wpgitltdsjk)" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M114,508.5469 L114,518.5469 L124,518.5469 L114,508.5469 " fill="#FBFB77" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="64" x="45" y="525.6138">close B[0]</text><path d="M39,547.6797 L39,572.6797 L124,572.6797 L124,557.6797 L114,547.6797 L39,547.6797 " fill="#FBFB77" filter="url(#f14wpgitltdsjk)" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M114,547.6797 L114,557.6797 L124,557.6797 L114,547.6797 " fill="#FBFB77" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="64" x="45" y="564.7466">close B[1]</text><polygon fill="#A80036" points="460,598.9453,470,602.9453,460,606.9453,464,602.9453" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="287" x2="466" y1="602.9453" y2="602.9453"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="9" x="294" y="597.8794">5</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="148" x="307" y="597.8794">request open over B[1]</text><polygon fill="#A80036" points="298,628.0781,288,632.0781,298,636.0781,294,632.0781" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="292" x2="471" y1="632.0781" y2="632.0781"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="9" x="304" y="627.0122">6</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="110" x="317" y="627.0122">send fd over B[0]</text><path d="M222,645.0781 L222,685.0781 L338,685.0781 L338,655.0781 L328,645.0781 L222,645.0781 " fill="#FBFB77" filter="url(#f14wpgitltdsjk)" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M328,645.0781 L328,655.0781 L338,655.0781 L328,645.0781 " fill="#FBFB77" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="95" x="228" y="662.145">mount passing</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="75" x="228" y="677.2778">fd as option</text><path d="M28,699.3438 L28,724.3438 L135,724.3438 L135,709.3438 L125,699.3438 L28,699.3438 " fill="#FBFB77" filter="url(#f14wpgitltdsjk)" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M125,699.3438 L125,709.3438 L135,709.3438 L125,699.3438 " fill="#FBFB77" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="86" x="34" y="716.4106">enter stage 2</text><path d="M16,738.4766 L16,778.4766 L147,778.4766 L147,748.4766 L137,738.4766 L16,738.4766 " fill="#FBFB77" filter="url(#f14wpgitltdsjk)" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M137,738.4766 L137,748.4766 L147,748.4766 L137,738.4766 " fill="#FBFB77" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="110" x="22" y="755.5435">start pre-process</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="39" x="22" y="770.6763">use fd</text><polygon fill="#A80036" points="100,804.875,90,808.875,100,812.875,96,808.875" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="94" x2="276" y1="808.875" y2="808.875"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="9" x="106" y="803.8091">7</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="110" x="119" y="803.8091">send fd over A[0]</text><path d="M29,821.875 L29,846.875 L134,846.875 L134,831.875 L124,821.875 L29,821.875 " fill="#FBFB77" filter="url(#f14wpgitltdsjk)" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M124,821.875 L124,831.875 L134,831.875 L124,821.875 " fill="#FBFB77" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="84" x="35" y="838.9419">start process</text><!--
@startuml
autonumber
hide footbox
participant "wrapper\n(stage 2)" as wrapper
participant "stage 1" as stage_1
participant master
participant "rpc server" as rpc_server
activate wrapper
wrapper -> stage_1 ** : spawn
activate stage_1
note over stage_1: prepare config
stage_1 -> wrapper: send config
deactivate stage_1
note over wrapper: create socket pair A
note over wrapper: create socket pair B
wrapper -> master ** : spawn
note over wrapper: close A[0]
activate master
note over master: close A[1]
note over master: close B[0]
wrapper -> rpc_server ** : spawn
note over rpc_server: close B[1]
note over wrapper: close B[0]
note over wrapper: close B[1]
activate rpc_server
master -> rpc_server: request open over B[1]
rpc_server -> master: send fd over B[0]
note over master: mount passing\nfd as option
note over wrapper: enter stage 2
note over wrapper: start pre-process\nuse fd
master -> wrapper: send fd over A[0]
note over wrapper: start process
@enduml
PlantUML version 1.2019.04(Fri Mar 29 15:44:36 UTC 2019)
(GPL source distribution)
Java Runtime: OpenJDK Runtime Environment
JVM: OpenJDK 64-Bit Server VM
Java Version: 1.8.0_201-heroku-b09
Operating System: Linux
OS Version: 4.4.0-1042-aws
Default Encoding: UTF-8
Language: en
Country: US
--></g></svg>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment