Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
9216562e
Unverified
Commit
9216562e
authored
Dec 04, 2023
by
Matthew Slipper
Committed by
GitHub
Dec 04, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8411 from ethereum-optimism/feat/kill-geth
op-e2e: Actually kill geth on shim termination
parents
6d701ce4
d8dc029e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
2 deletions
+33
-2
main.go
op-e2e/external_geth/main.go
+33
-2
No files found.
op-e2e/external_geth/main.go
View file @
9216562e
...
@@ -2,12 +2,15 @@ package main
...
@@ -2,12 +2,15 @@ package main
import
(
import
(
"encoding/json"
"encoding/json"
"errors"
"flag"
"flag"
"fmt"
"fmt"
"os"
"os"
"os/exec"
"os/exec"
"os/signal"
"path/filepath"
"path/filepath"
"strconv"
"strconv"
"syscall"
"time"
"time"
"github.com/ethereum-optimism/optimism/op-e2e/external"
"github.com/ethereum-optimism/optimism/op-e2e/external"
...
@@ -67,11 +70,39 @@ func run(configPath string) error {
...
@@ -67,11 +70,39 @@ func run(configPath string) error {
}
}
fmt
.
Printf
(
"================== op-geth shim awaiting termination ==========================
\n
"
)
fmt
.
Printf
(
"================== op-geth shim awaiting termination ==========================
\n
"
)
sigs
:=
make
(
chan
os
.
Signal
,
1
)
signal
.
Notify
(
sigs
,
syscall
.
SIGINT
,
syscall
.
SIGTERM
)
select
{
select
{
case
<-
sigs
:
fmt
.
Printf
(
"================== op-geth shim caught signal, killing ==========================
\n
"
)
sess
.
session
.
Terminate
()
return
awaitExit
(
sess
.
session
)
case
<-
sess
.
session
.
Exited
:
case
<-
sess
.
session
.
Exited
:
return
fmt
.
Errorf
(
"geth exited
"
)
return
fmt
.
Errorf
(
"geth exited
with code %d"
,
sess
.
session
.
ExitCode
()
)
case
<-
time
.
After
(
30
*
time
.
Minute
)
:
case
<-
time
.
After
(
30
*
time
.
Minute
)
:
return
fmt
.
Errorf
(
"exiting after 30 minute timeout"
)
fmt
.
Printf
(
"================== op-geth shim timed out, killing ==========================
\n
"
)
sess
.
session
.
Terminate
()
if
err
:=
awaitExit
(
sess
.
session
);
err
!=
nil
{
fmt
.
Printf
(
"error killing geth: %v
\n
"
,
err
)
}
return
errors
.
New
(
"geth timed out after 30 minutes"
)
}
}
func
awaitExit
(
sess
*
gexec
.
Session
)
error
{
select
{
case
<-
sess
.
Exited
:
return
nil
case
<-
time
.
After
(
5
*
time
.
Second
)
:
sess
.
Kill
()
select
{
case
<-
sess
.
Exited
:
return
nil
case
<-
time
.
After
(
30
*
time
.
Second
)
:
return
fmt
.
Errorf
(
"exiting after 30 second timeout"
)
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment