Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
df064fa2
Commit
df064fa2
authored
3 years ago
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Unload BPF objects on reload to avoid running out of memlock
parent
318e0c84
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
0 deletions
+32
-0
src/shrpx.cc
src/shrpx.cc
+4
-0
src/shrpx_connection_handler.cc
src/shrpx_connection_handler.cc
+20
-0
src/shrpx_connection_handler.h
src/shrpx_connection_handler.h
+2
-0
src/shrpx_process.h
src/shrpx_process.h
+1
-0
src/shrpx_worker.cc
src/shrpx_worker.cc
+2
-0
src/shrpx_worker_process.cc
src/shrpx_worker_process.cc
+3
-0
No files found.
src/shrpx.cc
View file @
df064fa2
...
...
@@ -3769,6 +3769,10 @@ void reload_config(WorkerProcess *wp) {
#endif // ENABLE_HTTP3
));
#ifdef ENABLE_HTTP3
ipc_send
(
last_wp
.
get
(),
SHRPX_IPC_UNLOAD_BPF_OBJECT
);
#endif // ENABLE_HTTP3
if
(
!
get_config
()
->
pid_file
.
empty
())
{
save_pid
();
}
...
...
This diff is collapsed.
Click to expand it.
src/shrpx_connection_handler.cc
View file @
df064fa2
...
...
@@ -1079,6 +1079,26 @@ ConnectionHandler::match_quic_lingering_worker_process_cid_prefix(
std
::
vector
<
BPFRef
>
&
ConnectionHandler
::
get_quic_bpf_refs
()
{
return
quic_bpf_refs_
;
}
void
ConnectionHandler
::
unload_bpf_objects
()
{
std
::
array
<
char
,
STRERROR_BUFSIZE
>
errbuf
;
LOG
(
NOTICE
)
<<
"Unloading BPF objects"
;
for
(
auto
&
ref
:
quic_bpf_refs_
)
{
if
(
ref
.
obj
==
nullptr
)
{
continue
;
}
if
(
bpf_object__unload
(
ref
.
obj
)
!=
0
)
{
LOG
(
WARN
)
<<
"Failed to unload bpf object: "
<<
xsi_strerror
(
errno
,
errbuf
.
data
(),
errbuf
.
size
());
continue
;
}
ref
.
obj
=
nullptr
;
}
}
# endif // HAVE_LIBBPF
void
ConnectionHandler
::
set_quic_ipc_fd
(
int
fd
)
{
quic_ipc_fd_
=
fd
;
}
...
...
This diff is collapsed.
Click to expand it.
src/shrpx_connection_handler.h
View file @
df064fa2
...
...
@@ -106,6 +106,7 @@ struct SerialEvent {
#ifdef ENABLE_HTTP3
# ifdef HAVE_LIBBPF
struct
BPFRef
{
bpf_object
*
obj
;
int
reuseport_array
;
int
cid_prefix_map
;
};
...
...
@@ -225,6 +226,7 @@ public:
# ifdef HAVE_LIBBPF
std
::
vector
<
BPFRef
>
&
get_quic_bpf_refs
();
void
unload_bpf_objects
();
# endif // HAVE_LIBBPF
#endif // ENABLE_HTTP3
...
...
This diff is collapsed.
Click to expand it.
src/shrpx_process.h
View file @
df064fa2
...
...
@@ -31,6 +31,7 @@ namespace shrpx {
constexpr
uint8_t
SHRPX_IPC_REOPEN_LOG
=
1
;
constexpr
uint8_t
SHRPX_IPC_GRACEFUL_SHUTDOWN
=
2
;
constexpr
uint8_t
SHRPX_IPC_UNLOAD_BPF_OBJECT
=
3
;
}
// namespace shrpx
...
...
This diff is collapsed.
Click to expand it.
src/shrpx_worker.cc
View file @
df064fa2
...
...
@@ -890,6 +890,8 @@ int Worker::create_quic_server_socket(UpstreamAddr &faddr) {
auto
&
ref
=
quic_bpf_refs
[
faddr
.
index
];
ref
.
obj
=
obj
;
auto
reuseport_array
=
bpf_object__find_map_by_name
(
obj
,
"reuseport_array"
);
err
=
libbpf_get_error
(
reuseport_array
);
...
...
This diff is collapsed.
Click to expand it.
src/shrpx_worker_process.cc
View file @
df064fa2
...
...
@@ -175,6 +175,9 @@ void ipc_readcb(struct ev_loop *loop, ev_io *w, int revents) {
case
SHRPX_IPC_REOPEN_LOG
:
reopen_log
(
conn_handler
);
break
;
case
SHRPX_IPC_UNLOAD_BPF_OBJECT
:
conn_handler
->
unload_bpf_objects
();
break
;
}
}
}
...
...
This diff is collapsed.
Click to expand it.
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