appsignal 2.11.7-java → 2.11.8-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b97d29242854a8a2f45cc111ce7ca9ebd4367bc966a103a528a0873e3411ddee
4
- data.tar.gz: ca75043dbd897e34817fd24879be0c95fda398c06d1b8a73863da86847eb1f22
3
+ metadata.gz: 1e1ba61246de44136e06c57be6f4a877be8cc714dbcdafd1c7c8eb9bd994cbc4
4
+ data.tar.gz: ef465afb88df2f8f53015e84192159d464c4827e66a1ee19bed38b73712e810c
5
5
  SHA512:
6
- metadata.gz: f2045ed2f107a293039ad933d1e4f584a1063ff3cd763d728aa230ecc182f8f105d71f90faeef034e0aba6b2740d8805600ec8052389c7c6e67b2fb411e8c9b7
7
- data.tar.gz: 88fb1e14b251c8188b45dd4594f65c849bbaa25333434b55353749c424b9d387dfd83c358947a46cdde1ace806c6da0117e99567a601111c4b8d77468826c4f5
6
+ metadata.gz: '060922d22213fb4b53b3656221d5ae1da5624682f0765f6631a2ef6c041ec12239729a38b1db5df383a316952628912d9a63680a8742211d404df9836cf2877f'
7
+ data.tar.gz: e7a8ba54779115a77703090837a9814e017884607d3b059b620a875cba9c52bc449fa56006ad443ecc076d1bf8bfc7b8c109bd7d61c811c8f5748e683b94f3d4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ # 2.11.8
4
+ - Mark minutely probe thread as fork-safe by @pixeltrix. PR #704
5
+
3
6
  # 2.11.7
4
7
  - Fix ActionCable integration in test environment using `stub_connection`.
5
8
  PR #705
@@ -135,6 +135,12 @@ module Appsignal
135
135
  def start
136
136
  stop
137
137
  @thread = Thread.new do
138
+ # Advise multi-threaded app servers to ignore this thread
139
+ # for the purposes of fork safety warnings
140
+ if Thread.current.respond_to?(:thread_variable_set)
141
+ Thread.current.thread_variable_set(:fork_safe, true)
142
+ end
143
+
138
144
  sleep initial_wait_time
139
145
  initialize_probes
140
146
  loop do
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Appsignal
4
- VERSION = "2.11.7".freeze
4
+ VERSION = "2.11.8".freeze
5
5
  end
@@ -23,6 +23,27 @@ RSpec.describe "Puma plugin" do
23
23
  def self.stats
24
24
  end
25
25
 
26
+ def self.run
27
+ # Capture threads running before application is preloaded
28
+ before = Thread.list.reject { |t| t.thread_variable_get(:fork_safe) }
29
+
30
+ # An abbreviated version of what happens in Puma::Cluster#run
31
+ launcher = MockPumaLauncher.new
32
+ plugin = Plugin.plugin.new
33
+ plugin.start(launcher)
34
+ launcher.events.on_booted.call
35
+
36
+ # Wait for minutely probe thread to finish starting
37
+ sleep 0.005
38
+
39
+ # Capture any new threads running after application is preloaded.
40
+ # Any threads created during the preloading phase will not be
41
+ # carried over into the forked workers. Puma warns about these
42
+ # but the minutely probe thread should only exist in the main process.
43
+ after = Thread.list.reject { |t| t.thread_variable_get(:fork_safe) }
44
+ $stdout.puts "! WARNING: Detected #{after.size - before.size} Thread(s) started in app boot" if after.size > before.size
45
+ end
46
+
26
47
  class Plugin
27
48
  class << self
28
49
  attr_reader :plugin
@@ -68,6 +89,13 @@ RSpec.describe "Puma plugin" do
68
89
  wait_for("enough probe calls") { probe.calls >= 2 }
69
90
  end
70
91
 
92
+ it "marks the PumaProbe thread as fork-safe", :not_ruby19 do
93
+ out_stream = std_stream
94
+ capture_stdout(out_stream) { Puma.run }
95
+
96
+ expect(out_stream.read).not_to include("WARNING: Detected 1 Thread")
97
+ end
98
+
71
99
  context "without Puma.stats" do
72
100
  before { Puma.singleton_class.send(:remove_method, :stats) }
73
101
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appsignal
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.11.7
4
+ version: 2.11.8
5
5
  platform: java
6
6
  authors:
7
7
  - Robert Beekman