tengine_core 0.5.37 → 0.5.38

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.37
1
+ 0.5.38
@@ -25,7 +25,7 @@ if Mongoid::VERSION < "3.0.0"
25
25
  begin
26
26
  yield
27
27
  rescue Mongo::ConnectionFailure, Mongo::OperationTimeout, Mongo::OperationFailure => ex
28
- raise unless ex.class == Mongo::OperationFailure and ex.message !~ /not master/
28
+ raise if ex.class == Mongo::OperationFailure and ex.message !~ /not master/
29
29
 
30
30
  retries += 1
31
31
  raise if retries > Mongoid.max_retries_on_connection_failure
@@ -143,10 +143,23 @@ class Tengine::Core::Mutex
143
143
  end
144
144
  end
145
145
 
146
+ def synchronize_internal ttl, blk
147
+ # stop stack consumption
148
+ EM.add_timer ttl do
149
+ begin
150
+ synchronize(&blk)
151
+ rescue Exception => e
152
+ msg = sprintf "%p\n%s", e, e.backtrace.join("\n")
153
+ Tengine.logger.error msg
154
+ # no raise
155
+ end
156
+ end
157
+ end
158
+
146
159
  public
147
160
 
148
161
  # delays until you get a lock.
149
- def synchronize
162
+ def synchronize(&block)
150
163
  raise ArgumentError, "no block given" unless block_given?
151
164
 
152
165
  if lock
@@ -161,11 +174,7 @@ class Tengine::Core::Mutex
161
174
  end
162
175
  else
163
176
  # NG, try again later
164
- EM.add_timer mutex.ttl do
165
- synchronize do
166
- yield
167
- end
168
- end
177
+ synchronize_internal mutex.ttl, block
169
178
  end
170
179
  end
171
180
 
@@ -140,6 +140,23 @@ describe Tengine::Core::Mutex do
140
140
  x.should < z
141
141
  y.should <= z
142
142
  end
143
+
144
+ it "synchronizes #5: no stack overflow" do
145
+ STDERR.puts "This test takes two minutes to run. Relax and take a cup of coffee."
146
+ m = Tengine::Core::Mutex.new "test mutex 03", 0.00000000001
147
+ n = m.mutex
148
+ n.waiters ||= []
149
+ n.waiters << { :_id => 1, :timeout => Time.now + 120 }
150
+ n.save
151
+
152
+ expect do
153
+ EM.run do
154
+ m.synchronize do
155
+ EM.stop
156
+ end
157
+ end
158
+ end.to_not raise_error(SystemStackError)
159
+ end
143
160
  end
144
161
 
145
162
  context "#heartbeat" do
data/tengine_core.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "tengine_core"
8
- s.version = "0.5.37"
8
+ s.version = "0.5.38"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["taigou", "totty", "g-morita", "shyouhei", "akm", "hiroshinakao"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tengine_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.37
4
+ version: 0.5.38
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -18,7 +18,7 @@ date: 2012-02-22 00:00:00.000000000Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: activesupport
21
- requirement: &70303062943180 !ruby/object:Gem::Requirement
21
+ requirement: &70159437844500 !ruby/object:Gem::Requirement
22
22
  none: false
23
23
  requirements:
24
24
  - - ~>
@@ -26,10 +26,10 @@ dependencies:
26
26
  version: 3.1.0
27
27
  type: :runtime
28
28
  prerelease: false
29
- version_requirements: *70303062943180
29
+ version_requirements: *70159437844500
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: activemodel
32
- requirement: &70303062942700 !ruby/object:Gem::Requirement
32
+ requirement: &70159437844020 !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
35
  - - ~>
@@ -37,10 +37,10 @@ dependencies:
37
37
  version: 3.1.0
38
38
  type: :runtime
39
39
  prerelease: false
40
- version_requirements: *70303062942700
40
+ version_requirements: *70159437844020
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: selectable_attr
43
- requirement: &70303062942220 !ruby/object:Gem::Requirement
43
+ requirement: &70159437843540 !ruby/object:Gem::Requirement
44
44
  none: false
45
45
  requirements:
46
46
  - - ~>
@@ -48,10 +48,10 @@ dependencies:
48
48
  version: 0.3.15
49
49
  type: :runtime
50
50
  prerelease: false
51
- version_requirements: *70303062942220
51
+ version_requirements: *70159437843540
52
52
  - !ruby/object:Gem::Dependency
53
53
  name: bson
54
- requirement: &70303062941740 !ruby/object:Gem::Requirement
54
+ requirement: &70159437843060 !ruby/object:Gem::Requirement
55
55
  none: false
56
56
  requirements:
57
57
  - - ~>
@@ -59,10 +59,10 @@ dependencies:
59
59
  version: 1.5.2
60
60
  type: :runtime
61
61
  prerelease: false
62
- version_requirements: *70303062941740
62
+ version_requirements: *70159437843060
63
63
  - !ruby/object:Gem::Dependency
64
64
  name: bson_ext
65
- requirement: &70303062941260 !ruby/object:Gem::Requirement
65
+ requirement: &70159437842580 !ruby/object:Gem::Requirement
66
66
  none: false
67
67
  requirements:
68
68
  - - ~>
@@ -70,10 +70,10 @@ dependencies:
70
70
  version: 1.5.2
71
71
  type: :runtime
72
72
  prerelease: false
73
- version_requirements: *70303062941260
73
+ version_requirements: *70159437842580
74
74
  - !ruby/object:Gem::Dependency
75
75
  name: mongo
76
- requirement: &70303062940780 !ruby/object:Gem::Requirement
76
+ requirement: &70159437842100 !ruby/object:Gem::Requirement
77
77
  none: false
78
78
  requirements:
79
79
  - - ~>
@@ -81,10 +81,10 @@ dependencies:
81
81
  version: 1.5.2
82
82
  type: :runtime
83
83
  prerelease: false
84
- version_requirements: *70303062940780
84
+ version_requirements: *70159437842100
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: mongoid
87
- requirement: &70303062940300 !ruby/object:Gem::Requirement
87
+ requirement: &70159437841620 !ruby/object:Gem::Requirement
88
88
  none: false
89
89
  requirements:
90
90
  - - ~>
@@ -92,10 +92,10 @@ dependencies:
92
92
  version: 2.3.3
93
93
  type: :runtime
94
94
  prerelease: false
95
- version_requirements: *70303062940300
95
+ version_requirements: *70159437841620
96
96
  - !ruby/object:Gem::Dependency
97
97
  name: tengine_support
98
- requirement: &70303062939820 !ruby/object:Gem::Requirement
98
+ requirement: &70159437841140 !ruby/object:Gem::Requirement
99
99
  none: false
100
100
  requirements:
101
101
  - - ~>
@@ -103,10 +103,10 @@ dependencies:
103
103
  version: 0.3.12
104
104
  type: :runtime
105
105
  prerelease: false
106
- version_requirements: *70303062939820
106
+ version_requirements: *70159437841140
107
107
  - !ruby/object:Gem::Dependency
108
108
  name: tengine_event
109
- requirement: &70303062939340 !ruby/object:Gem::Requirement
109
+ requirement: &70159437840660 !ruby/object:Gem::Requirement
110
110
  none: false
111
111
  requirements:
112
112
  - - ~>
@@ -114,10 +114,10 @@ dependencies:
114
114
  version: 0.4.0
115
115
  type: :runtime
116
116
  prerelease: false
117
- version_requirements: *70303062939340
117
+ version_requirements: *70159437840660
118
118
  - !ruby/object:Gem::Dependency
119
119
  name: daemons
120
- requirement: &70303062955240 !ruby/object:Gem::Requirement
120
+ requirement: &70159437856540 !ruby/object:Gem::Requirement
121
121
  none: false
122
122
  requirements:
123
123
  - - ~>
@@ -125,10 +125,10 @@ dependencies:
125
125
  version: 1.1.4
126
126
  type: :runtime
127
127
  prerelease: false
128
- version_requirements: *70303062955240
128
+ version_requirements: *70159437856540
129
129
  - !ruby/object:Gem::Dependency
130
130
  name: rspec
131
- requirement: &70303062954760 !ruby/object:Gem::Requirement
131
+ requirement: &70159437856060 !ruby/object:Gem::Requirement
132
132
  none: false
133
133
  requirements:
134
134
  - - ~>
@@ -136,10 +136,10 @@ dependencies:
136
136
  version: 2.6.0
137
137
  type: :development
138
138
  prerelease: false
139
- version_requirements: *70303062954760
139
+ version_requirements: *70159437856060
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: factory_girl
142
- requirement: &70303062954280 !ruby/object:Gem::Requirement
142
+ requirement: &70159437855580 !ruby/object:Gem::Requirement
143
143
  none: false
144
144
  requirements:
145
145
  - - ~>
@@ -147,10 +147,10 @@ dependencies:
147
147
  version: 2.1.2
148
148
  type: :development
149
149
  prerelease: false
150
- version_requirements: *70303062954280
150
+ version_requirements: *70159437855580
151
151
  - !ruby/object:Gem::Dependency
152
152
  name: yard
153
- requirement: &70303062953800 !ruby/object:Gem::Requirement
153
+ requirement: &70159437855100 !ruby/object:Gem::Requirement
154
154
  none: false
155
155
  requirements:
156
156
  - - ~>
@@ -158,10 +158,10 @@ dependencies:
158
158
  version: 0.7.2
159
159
  type: :development
160
160
  prerelease: false
161
- version_requirements: *70303062953800
161
+ version_requirements: *70159437855100
162
162
  - !ruby/object:Gem::Dependency
163
163
  name: bundler
164
- requirement: &70303062953320 !ruby/object:Gem::Requirement
164
+ requirement: &70159437854620 !ruby/object:Gem::Requirement
165
165
  none: false
166
166
  requirements:
167
167
  - - ~>
@@ -169,10 +169,10 @@ dependencies:
169
169
  version: 1.0.18
170
170
  type: :development
171
171
  prerelease: false
172
- version_requirements: *70303062953320
172
+ version_requirements: *70159437854620
173
173
  - !ruby/object:Gem::Dependency
174
174
  name: jeweler
175
- requirement: &70303062952840 !ruby/object:Gem::Requirement
175
+ requirement: &70159437854140 !ruby/object:Gem::Requirement
176
176
  none: false
177
177
  requirements:
178
178
  - - ~>
@@ -180,10 +180,10 @@ dependencies:
180
180
  version: 1.6.4
181
181
  type: :development
182
182
  prerelease: false
183
- version_requirements: *70303062952840
183
+ version_requirements: *70159437854140
184
184
  - !ruby/object:Gem::Dependency
185
185
  name: simplecov
186
- requirement: &70303062952360 !ruby/object:Gem::Requirement
186
+ requirement: &70159437853660 !ruby/object:Gem::Requirement
187
187
  none: false
188
188
  requirements:
189
189
  - - ~>
@@ -191,10 +191,10 @@ dependencies:
191
191
  version: 0.5.3
192
192
  type: :development
193
193
  prerelease: false
194
- version_requirements: *70303062952360
194
+ version_requirements: *70159437853660
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: ZenTest
197
- requirement: &70303062951880 !ruby/object:Gem::Requirement
197
+ requirement: &70159437853180 !ruby/object:Gem::Requirement
198
198
  none: false
199
199
  requirements:
200
200
  - - ~>
@@ -202,10 +202,10 @@ dependencies:
202
202
  version: 4.6.2
203
203
  type: :development
204
204
  prerelease: false
205
- version_requirements: *70303062951880
205
+ version_requirements: *70159437853180
206
206
  - !ruby/object:Gem::Dependency
207
207
  name: rdiscount
208
- requirement: &70303062951400 !ruby/object:Gem::Requirement
208
+ requirement: &70159437852700 !ruby/object:Gem::Requirement
209
209
  none: false
210
210
  requirements:
211
211
  - - ! '>='
@@ -213,10 +213,10 @@ dependencies:
213
213
  version: '0'
214
214
  type: :development
215
215
  prerelease: false
216
- version_requirements: *70303062951400
216
+ version_requirements: *70159437852700
217
217
  - !ruby/object:Gem::Dependency
218
218
  name: kramdown
219
- requirement: &70303062950920 !ruby/object:Gem::Requirement
219
+ requirement: &70159437852220 !ruby/object:Gem::Requirement
220
220
  none: false
221
221
  requirements:
222
222
  - - ! '>='
@@ -224,7 +224,7 @@ dependencies:
224
224
  version: '0'
225
225
  type: :development
226
226
  prerelease: false
227
- version_requirements: *70303062950920
227
+ version_requirements: *70159437852220
228
228
  description: tengine_core is a framework/engine to support distributed processing
229
229
  email: tengine@nautilus-technologies.com
230
230
  executables: