Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
er
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
Administrator
er
Commits
120bf6a4
Unverified
Commit
120bf6a4
authored
Oct 27, 2018
by
Сергей Прохоров
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Garbage-collect self before making final decision about termination
parent
835f82aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
mtp_handler.erl
src/mtp_handler.erl
+5
-2
No files found.
src/mtp_handler.erl
View file @
120bf6a4
...
...
@@ -320,7 +320,7 @@ check_queue_overflow(#state{last_queue_check = LastCheck} = S) ->
true
->
{
noreply
,
S
};
false
->
case
do_check_queue_overflow
()
of
case
do_check_queue_overflow
(
true
)
of
ok
->
{
noreply
,
S
#state
{
last_queue_check
=
NowMs
}};
overflow
->
...
...
@@ -328,7 +328,7 @@ check_queue_overflow(#state{last_queue_check = LastCheck} = S) ->
end
end
.
do_check_queue_overflow
()
->
do_check_queue_overflow
(
Gc
)
->
[{_,
QLen
},
{_,
Mem
},
{_,
Bin
}]
=
erlang
:
process_info
(
self
(),
[
message_queue_len
,
memory
,
binary
]),
%% BinSum = sum_binary(Bin),
...
...
@@ -339,6 +339,9 @@ do_check_queue_overflow() ->
RefcBinSize
=
sum_binary
(
Bin
),
TotalMem
=
Mem
+
RefcBinSize
,
case
TotalMem
>
?
QUEUE_CHECK_MAX_MEM
of
true
when
Gc
->
erlang
:
garbage_collect
(
self
()),
do_check_queue_overflow
(
false
);
true
->
lager
:
warning
(
"Process too large queue_len=
~w
, memory=
~w
, binary_sum=
~w
, binary=
~p
"
,
...
...
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