appsignal 2.11.7 → 2.11.8

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: 45f78817cdaaf759d7bb0fd3109cb6a16557956b485f3c245a524651301de9fc
4
- data.tar.gz: ca75043dbd897e34817fd24879be0c95fda398c06d1b8a73863da86847eb1f22
3
+ metadata.gz: 8cb57893fb10d1d54593fcf13b4d2b13ac728e9d0c5c16f046580b1befb6048d
4
+ data.tar.gz: ef465afb88df2f8f53015e84192159d464c4827e66a1ee19bed38b73712e810c
5
5
  SHA512:
6
- metadata.gz: f9cc2e5f99efd70c3e1e53d1a14cccc6c3373a4aded2ef75b1b3112c6def42dfbf3114e05fd06bfadcf558c0bd4b5e1ebf027e5d258565a94d6f7562c1bfe66d
7
- data.tar.gz: 88fb1e14b251c8188b45dd4594f65c849bbaa25333434b55353749c424b9d387dfd83c358947a46cdde1ace806c6da0117e99567a601111c4b8d77468826c4f5
6
+ metadata.gz: 663ba5e66fd1bad997a27c164d7e9845effb7d419b6b23a3b33a1f0f71f50d18071194f75216e347956f11e3ad2730f82e7c24fb4029b2c9daf4bd597c289450
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: ruby
6
6
  authors:
7
7
  - Robert Beekman