sqreen 1.15.7 → 1.15.8.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sqreen/js/mini_racer_adapter.rb +40 -2
- data/lib/sqreen/log.rb +1 -0
- data/lib/sqreen/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4338bb99bd2f9ed5de996bdb28b9751cdfbbc4385a8caa1f0f7da8ff89a54b01
|
4
|
+
data.tar.gz: 410dc9b5f08e2393f73046c3ff17bcd39a3225eca4e5dc6582e8d15ff7d2d9ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e8f110c02c0cedbe5afc457f8f743c996359096f0e51fd86ede7ed31d57336e44632b9161e97d6ff1c0be5dac438ac24a48d6bf832d6a2e20407709bfc5c162
|
7
|
+
data.tar.gz: 9acf76a1f4c7ac48a4df3955c2ed5d033cb4ce52fa1cd29875007a04e634794d9c7c25c3399be1ed91aec075cf2ee9ac5153b90b2897fba55f67030dba05764b
|
@@ -59,8 +59,25 @@ module Sqreen
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
def give_back_context(
|
63
|
-
|
62
|
+
def give_back_context(context)
|
63
|
+
context.possibly_gc
|
64
|
+
|
65
|
+
if context.gc_load > 30
|
66
|
+
if context.gc_threshold_in_bytes == DEFAULT_GC_THRESHOLD
|
67
|
+
context.gc_threshold_in_bytes *= 2
|
68
|
+
Sqreen.log.warn('Context %s had too many close garbage collections; ' \
|
69
|
+
'doubling the threshold to %d bytes',
|
70
|
+
context, context.gc_threshold_in_bytes)
|
71
|
+
context.gc_load = 0
|
72
|
+
else
|
73
|
+
Sqreen.log.warn('Context %s had too many close garbage ' \
|
74
|
+
'collections; discarding it', context)
|
75
|
+
context.dispose
|
76
|
+
return
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
@mutex.synchronize { @contexts.push(context); }
|
64
81
|
end
|
65
82
|
end
|
66
83
|
|
@@ -194,10 +211,15 @@ module Sqreen
|
|
194
211
|
private
|
195
212
|
|
196
213
|
class << self
|
214
|
+
DEFAULT_GC_THRESHOLD = 15000000 # 15 MB
|
215
|
+
|
197
216
|
def define_sqreen_context(modoole)
|
198
217
|
# Context specialized for Sqreen usage
|
199
218
|
Sqreen::Js.const_set 'SqreenContext', Class.new(modoole.const_get('Context'))
|
200
219
|
SqreenContext.class_eval do
|
220
|
+
attr_accessor :gc_threshold_in_bytes
|
221
|
+
attr_accessor :gc_load
|
222
|
+
|
201
223
|
def has_code?(code_id)
|
202
224
|
return false unless @code_ids
|
203
225
|
@code_ids.include?(code_id)
|
@@ -233,6 +255,22 @@ module Sqreen
|
|
233
255
|
end
|
234
256
|
end
|
235
257
|
|
258
|
+
def possibly_gc
|
259
|
+
Sqreen.log.warn("Heap usage: #{heap_stats[:total_heap_size]} for #{object_id}")
|
260
|
+
|
261
|
+
@gc_threshold_in_bytes = DEFAULT_GC_THRESHOLD
|
262
|
+
@gc_load ||= 0
|
263
|
+
|
264
|
+
# garbage collections max 1 in every 4 calls (avg)
|
265
|
+
if heap_stats[:total_heap_size] > @gc_threshold_in_bytes
|
266
|
+
Sqreen.log.warn("Doing low memory notification for context")
|
267
|
+
low_memory_notification
|
268
|
+
@gc_load += 4
|
269
|
+
else
|
270
|
+
@gc_load = [0, @gc_load - 1].max
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
236
274
|
private
|
237
275
|
|
238
276
|
def transf_global_funcs(code_id)
|
data/lib/sqreen/log.rb
CHANGED
data/lib/sqreen/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sqreen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.15.
|
4
|
+
version: 1.15.8.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sqreen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sq_mini_racer
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.2.
|
19
|
+
version: 0.2.4.sqreen1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.2.
|
26
|
+
version: 0.2.4.sqreen1
|
27
27
|
description: Sqreen is a SaaS based Application protection and monitoring platform
|
28
28
|
that integrates directly into your Ruby applications. Learn more at https://sqreen.io.
|
29
29
|
email: contact@sqreen.io
|
@@ -134,9 +134,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
134
134
|
version: '0'
|
135
135
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
|
-
- - "
|
137
|
+
- - ">"
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version:
|
139
|
+
version: 1.3.1
|
140
140
|
requirements: []
|
141
141
|
rubyforge_project:
|
142
142
|
rubygems_version: 2.7.7
|