-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUG] Add cmdargs parameter to work around issue with CEF under MacOS
A new cmdargs configuration setting allows the addition of any command line arguments to the launched processes. It defaults to ENABLE_CEF=0 because 1) it makes the isolate processes a bit more lightweight and 2) it works around an issue where runtime interpreters fail to start if CEF is enabled. Closes issue #21
- Loading branch information
Showing
2 changed files
with
73 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,39 @@ | ||
r←ss InitProcesses op;z;count;limit;ok;maxws;ws;rt;iso;ports;pids;pclts;procs;m;wd;of;ri | ||
(count limit)←0 3 | ||
maxws←' MAXWS=',⍕op.maxws | ||
ws←op.workspace | ||
(ri of wd)←op.(rideinit outfile workdir) | ||
:If (⊂rt←op.runtime)∊0 1 ⍝ if rt is boolean | ||
rt←rt∧op.onerror≢'debug' ⍝ force runtime←0 if onerror≡'debug' | ||
:EndIf | ||
iso←('isolate=isolate onerror=',(⍕op.onerror),' isoid=',(⍕ss.callback),maxws) | ||
iso,←' protocol=',op.protocol,' quiet=1' | ||
:If ws∨.≠' ' ⋄ ws←1⌽'""',checkWs addWSpath ws ⋄ :EndIf ⍝ if no path ('\/') | ||
ports←ss.homeport+1+⍳op.(processors×processes) | ||
|
||
:Repeat | ||
:If 0∊m←checkPortIsFree¨ports | ||
⎕←'*** Warning - isolate port(s) in use: ',(~m)/ports | ||
ports←ports+1+⍴ports | ||
:EndIf | ||
:Until (∧/m)∨(⊃ports)>1+op.homeportmax | ||
'ISOLATE: Unable to find free ports'⎕SIGNAL(∧/m)↓11 | ||
|
||
pids←(1⊃⎕AI)+⍳⍴ports | ||
|
||
:Repeat | ||
count+←1 | ||
procs←{⎕NEW ##.APLProcess(ws ⍵ rt ri of wd)}∘{'AutoShut=1 Port=',(⍕⍵),' APLCORENAME=',(⍕⍵),' ',iso}¨ports | ||
procs.onExit←{'{}#.DRC.Close ''PROC',⍵,''''}¨⍕¨pids ⍝ signal soft shutdown to process | ||
|
||
pclts←pids InitConnections ss.orig ports ss.callback ss.remoteclients | ||
|
||
:If ~ok←~∨/0∊≢¨pclts ⍝ at least one failed | ||
⎕←'ISOLATE: Unable to connect to started processes (attempt ',(⍕count),' of ',(⍕limit),')' | ||
⎕DL 5 ⋄ {}procs.Kill ⋄ ⎕DL 5 | ||
ports+←1+op.(processors×processes) | ||
:EndIf | ||
:Until ok∨count≥limit | ||
'ISOLATE: Unable to initialise isolate processes'⎕SIGNAL ok↓11 | ||
r←pids,procs,(⊂ss.orig),ports,⍪pclts | ||
r←ss InitProcesses op;z;count;limit;ok;maxws;ws;rt;iso;ports;pids;pclts;procs;m;wd;of;ri | ||
(count limit)←0 3 | ||
maxws←' MAXWS=',⍕op.maxws | ||
ws←op.workspace | ||
(ri of wd)←op.(rideinit outfile workdir) | ||
:If (⊂rt←op.runtime)∊0 1 ⍝ if rt is boolean | ||
rt←rt∧op.onerror≢'debug' ⍝ force runtime←0 if onerror≡'debug' | ||
:EndIf | ||
iso←('isolate=isolate onerror=',(⍕op.onerror),' isoid=',(⍕ss.callback),maxws) | ||
iso,←' protocol=',op.protocol,' quiet=1' | ||
iso,←' ',op.cmdargs | ||
:If ws∨.≠' ' ⋄ ws←1⌽'""',checkWs addWSpath ws ⋄ :EndIf ⍝ if no path ('\/') | ||
ports←ss.homeport+1+⍳op.(processors×processes) | ||
|
||
:Repeat | ||
:If 0∊m←checkPortIsFree¨ports | ||
⎕←'*** Warning - isolate port(s) in use: ',(~m)/ports | ||
ports←ports+1+⍴ports | ||
:EndIf | ||
:Until (∧/m)∨(⊃ports)>1+op.homeportmax | ||
'ISOLATE: Unable to find free ports'⎕SIGNAL(∧/m)↓11 | ||
|
||
pids←(1⊃⎕AI)+⍳⍴ports | ||
|
||
:Repeat | ||
count+←1 | ||
procs←{⎕NEW ##.APLProcess(ws ⍵ rt ri of wd)}∘{'AutoShut=1 Port=',(⍕⍵),' APLCORENAME=',(⍕⍵),' ',iso}¨ports | ||
procs.onExit←{'{}#.DRC.Close ''PROC',⍵,''''}¨⍕¨pids ⍝ signal soft shutdown to process | ||
|
||
pclts←pids InitConnections ss.orig ports ss.callback ss.remoteclients | ||
|
||
:If ~ok←~∨/0∊≢¨pclts ⍝ at least one failed | ||
⎕←'ISOLATE: Unable to connect to started processes (attempt ',(⍕count),' of ',(⍕limit),')' | ||
⎕DL 5 ⋄ {}procs.Kill ⋄ ⎕DL 5 | ||
ports+←1+op.(processors×processes) | ||
:EndIf | ||
:Until ok∨count≥limit | ||
'ISOLATE: Unable to initialise isolate processes'⎕SIGNAL ok↓11 | ||
r←pids,procs,(⊂ss.orig),ports,⍪pclts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,34 @@ | ||
setDefaults←{⍺←⊢ | ||
here←⎕THIS | ||
new←0=here.⎕NC⊂'options' ⍝ set defaults only once | ||
z←{ | ||
spaces←here.(types options domains)←here.⎕NS¨⍬ ⍬ ⍬ | ||
tod←{(2⍴⍵),⊂1↓⍵} ⍝ type: Str Bool Int Ref | ||
⍝ ensure all param names are minuscule as arg to Config is converted thus. | ||
⍝ spaces.param← tod 'S' 'Default' 'and' 'the' 'Rest' | ||
spaces.debug←tod'B' 0 ⍝ cut back on error | ||
spaces.drc←tod'R'# ⍝ copy into # if # and missing | ||
spaces.listen←tod'B' 0 ⍝ can isolate call back to ws | ||
spaces.onerror←tod'S' 'signal' 'debug' 'return' | ||
spaces.processors←tod'I'(processors ⍬) ⍝ no. processors (fn ignores ⍵) | ||
spaces.processes←tod'I' 1 ⍝ per processor | ||
spaces.isolates←tod'I' 99 ⍝ per process | ||
spaces.homeport←tod'I' 7051 ⍝ first port to attempt to use | ||
spaces.homeportmax←tod'I' 7151 ⍝ highest port allowed | ||
spaces.runtime←tod'A' 1 ⍝ use runtime version | ||
spaces.protocol←tod'S' 'IPv4' 'IPv6' 'IP' ⍝ default to IPv4 | ||
spaces.maxws←tod'S'(##.RPCServer.GetEnv'MAXWS') | ||
spaces.status←tod'S' 'client' 'server' ⍝ set as 'server' by StartServer | ||
spaces.workspace←tod'S'(getDefaultWS'isolate.dws') ⍝ load current ws for remotes? | ||
spaces.rideinit←tod'S' '' ⍝ RIDE_INIT for APLProcess | ||
spaces.outfile←tod'S' '' ⍝ log file prefix for APLProcess | ||
spaces.workdir←tod'S' '' ⍝ working directory for APLProcess | ||
1:1 | ||
}⍣new⊢0 | ||
0::(⊃⍬⍴⎕DMX.DM)⎕SIGNAL ⎕DMX.EN | ||
⊢getSet ⍵ ⍝ this where Config called prior Init | ||
⍝ called by Config before Init runs and by Init when it does. | ||
⍝ set default options and permit user changes | ||
⍝ but leave Init to apply them. | ||
} | ||
setDefaults←{⍺←⊢ | ||
here←⎕THIS | ||
new←0=here.⎕NC⊂'options' ⍝ set defaults only once | ||
z←{ | ||
spaces←here.(types options domains)←here.⎕NS¨⍬ ⍬ ⍬ | ||
tod←{(2⍴⍵),⊂1↓⍵} ⍝ type: Str Bool Int Ref | ||
⍝ ensure all param names are minuscule as arg to Config is converted thus. | ||
⍝ spaces.param← tod 'S' 'Default' 'and' 'the' 'Rest' | ||
spaces.debug←tod'B' 0 ⍝ cut back on error | ||
spaces.drc←tod'R'# ⍝ copy into # if # and missing | ||
spaces.listen←tod'B' 0 ⍝ can isolate call back to ws | ||
spaces.onerror←tod'S' 'signal' 'debug' 'return' | ||
spaces.processors←tod'I'(processors ⍬) ⍝ no. processors (fn ignores ⍵) | ||
spaces.processes←tod'I' 1 ⍝ per processor | ||
spaces.isolates←tod'I' 99 ⍝ per process | ||
spaces.homeport←tod'I' 7051 ⍝ first port to attempt to use | ||
spaces.homeportmax←tod'I' 7151 ⍝ highest port allowed | ||
spaces.runtime←tod'A' 1 ⍝ use runtime version | ||
spaces.protocol←tod'S' 'IPv4' 'IPv6' 'IP' ⍝ default to IPv4 | ||
spaces.maxws←tod'S'(##.RPCServer.GetEnv'MAXWS') | ||
spaces.status←tod'S' 'client' 'server' ⍝ set as 'server' by StartServer | ||
spaces.workspace←tod'S'(getDefaultWS'isolate.dws') ⍝ load current ws for remotes? | ||
spaces.rideinit←tod'S' '' ⍝ RIDE_INIT for APLProcess | ||
spaces.outfile←tod'S' '' ⍝ log file prefix for APLProcess | ||
spaces.workdir←tod'S' '' ⍝ working directory for APLProcess | ||
spaces.cmdargs←tod'S' 'ENABLE_CEF=0' ⍝ add to command line | ||
1:1 | ||
}⍣new⊢0 | ||
0::(⊃⍬⍴⎕DMX.DM)⎕SIGNAL ⎕DMX.EN | ||
⊢getSet ⍵ ⍝ this where Config called prior Init | ||
⍝ called by Config before Init runs and by Init when it does. | ||
⍝ set default options and permit user changes | ||
⍝ but leave Init to apply them. | ||
} |