roby 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +10 -0
- data/Rakefile +1 -1
- data/lib/roby.rb +1 -0
- data/lib/roby/config.rb +10 -1
- data/lib/roby/control.rb +0 -1
- data/lib/roby/distributed/connection_space.rb +20 -13
- data/lib/roby/event.rb +38 -4
- data/lib/roby/state/state.rb +16 -2
- data/lib/roby/task.rb +7 -8
- data/test/test_event.rb +1 -0
- metadata +4 -4
data/History.txt
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
=== 0.7.2
|
2
|
+
|
3
|
+
* fixed a memory leak regarding the event propagation histories. Until now,
|
4
|
+
all the propagation histories where kept through Event#sources, leading to
|
5
|
+
actually keeping most plan objects since the beginning of execution. This
|
6
|
+
is fixed by internally using weak references. Histories will therefore be
|
7
|
+
truncated as the Ruby GC removes references to the concerned plan objects.
|
8
|
+
* misc small fixes, which mostly remove some false negatives in the test suite
|
9
|
+
* small change to be compatible with 1.8.7
|
10
|
+
|
1
11
|
=== 0.7.1
|
2
12
|
|
3
13
|
* Fixed extension handling in 'rake setup'. It should work again.
|
data/Rakefile
CHANGED
@@ -15,7 +15,7 @@ begin
|
|
15
15
|
p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
|
16
16
|
p.post_install_message = p.paragraphs_of('README.txt', 2).join("\n\n")
|
17
17
|
|
18
|
-
p.extra_deps << ['facets', '>= 2.0'] << 'activesupport' << ['utilrb', '1.
|
18
|
+
p.extra_deps << ['facets', '>= 2.0'] << 'activesupport' << ['utilrb', '>= 1.3.1']
|
19
19
|
if p.respond_to? :need_rdoc=
|
20
20
|
p.need_rdoc = false
|
21
21
|
end
|
data/lib/roby.rb
CHANGED
data/lib/roby/config.rb
CHANGED
@@ -1,5 +1,14 @@
|
|
1
|
+
if RUBY_VERSION >= "1.9"
|
2
|
+
STDERR.puts <<-EOB
|
3
|
+
The stable version of Roby is not compatible with 1.9. If you really want to
|
4
|
+
try it on 1.9, checkout the 1.9 branch of the development repository on github
|
5
|
+
(see README.txt for URLs)
|
6
|
+
EOB
|
7
|
+
exit(1)
|
8
|
+
end
|
9
|
+
|
1
10
|
module Roby
|
2
|
-
VERSION = '0.7.
|
11
|
+
VERSION = '0.7.2'
|
3
12
|
ROBY_LIB_DIR = File.expand_path( File.join(File.dirname(__FILE__), '..') )
|
4
13
|
ROBY_ROOT_DIR = File.expand_path( File.join(ROBY_LIB_DIR, '..') )
|
5
14
|
end
|
data/lib/roby/control.rb
CHANGED
@@ -265,7 +265,10 @@ module Roby
|
|
265
265
|
while !pending_sockets.empty?
|
266
266
|
socket, peer = pending_sockets.shift
|
267
267
|
sockets[socket] = peer
|
268
|
-
|
268
|
+
begin
|
269
|
+
Roby::Distributed.info "listening to #{socket.peer_info} for #{peer}"
|
270
|
+
rescue IOError
|
271
|
+
end
|
269
272
|
end
|
270
273
|
|
271
274
|
begin
|
@@ -282,18 +285,22 @@ module Roby
|
|
282
285
|
next
|
283
286
|
end
|
284
287
|
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
288
|
+
begin
|
289
|
+
header = socket.read(8)
|
290
|
+
unless header && header.size == 8
|
291
|
+
closed_sockets << socket
|
292
|
+
next
|
293
|
+
end
|
294
|
+
|
295
|
+
id, size = header.unpack("NN")
|
296
|
+
data = socket.read(size)
|
297
|
+
|
298
|
+
p = sockets[socket]
|
299
|
+
p.stats.rx += (size + 8)
|
300
|
+
Roby::Distributed.cycles_rx << [p, Marshal.load(data)]
|
301
|
+
rescue Errno::ECONNRESET, IOError
|
302
|
+
closed_sockets << socket
|
303
|
+
end
|
297
304
|
end
|
298
305
|
|
299
306
|
for socket in closed_sockets
|
data/lib/roby/event.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'utilrb/weakref'
|
1
2
|
require 'roby/plan-object'
|
2
3
|
require 'roby/exceptions'
|
3
4
|
require 'set'
|
@@ -11,14 +12,42 @@ module Roby
|
|
11
12
|
# The generator which emitted this event
|
12
13
|
attr_reader :generator
|
13
14
|
|
15
|
+
@@creation_places = Hash.new
|
14
16
|
def initialize(generator, propagation_id, context, time = Time.now)
|
15
17
|
@generator, @propagation_id, @context, @time = generator, propagation_id, context.freeze, time
|
18
|
+
|
19
|
+
@@creation_places[object_id] = "#{generator.class}"
|
16
20
|
end
|
17
21
|
|
18
22
|
attr_accessor :propagation_id, :context, :time
|
19
|
-
attr_accessor :sources
|
20
23
|
protected :propagation_id=, :context=, :time=
|
21
24
|
|
25
|
+
# The events whose emission triggered this event during the
|
26
|
+
# propagation. The events in this set are subject to Ruby's own
|
27
|
+
# garbage collection, which means that if a source event is garbage
|
28
|
+
# collected (i.e. if all references to the associated task/event
|
29
|
+
# generator are removed), it will be removed from this set as well.
|
30
|
+
def sources
|
31
|
+
result = []
|
32
|
+
@sources.delete_if do |ref|
|
33
|
+
begin
|
34
|
+
result << ref.get
|
35
|
+
false
|
36
|
+
rescue Utilrb::WeakRef::RefError
|
37
|
+
true
|
38
|
+
end
|
39
|
+
end
|
40
|
+
result
|
41
|
+
end
|
42
|
+
|
43
|
+
# Sets the sources. See #sources
|
44
|
+
def sources=(sources) # :nodoc:
|
45
|
+
@sources = ValueSet.new
|
46
|
+
for s in sources
|
47
|
+
@sources << Utilrb::WeakRef.new(s)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
22
51
|
# To be used in the event generators ::new methods, when we need to reemit
|
23
52
|
# an event while changing its
|
24
53
|
def reemit(new_id, new_context = nil)
|
@@ -35,7 +64,9 @@ module Roby
|
|
35
64
|
|
36
65
|
def name; model.name end
|
37
66
|
def model; self.class end
|
38
|
-
def inspect
|
67
|
+
def inspect # :nodoc:
|
68
|
+
"#<#{model.to_s}:0x#{address.to_s(16)} generator=#{generator} model=#{model}"
|
69
|
+
end
|
39
70
|
|
40
71
|
# Returns an event generator which will be emitted once +time+ seconds
|
41
72
|
# after this event has been emitted.
|
@@ -43,10 +74,11 @@ module Roby
|
|
43
74
|
State.at :t => (self.time + time)
|
44
75
|
end
|
45
76
|
|
46
|
-
def to_s
|
77
|
+
def to_s # :nodoc:
|
47
78
|
"[#{time.to_hms} @#{propagation_id}] #{self.class.to_s}: #{context}"
|
48
79
|
end
|
49
|
-
|
80
|
+
|
81
|
+
def pretty_print(pp) # :nodoc:
|
50
82
|
pp.text "[#{time.to_hms} @#{propagation_id}] #{self.class}"
|
51
83
|
if context
|
52
84
|
pp.breakable
|
@@ -691,6 +723,8 @@ module Roby
|
|
691
723
|
return if @unreachable
|
692
724
|
@unreachable = true
|
693
725
|
|
726
|
+
EventGenerator.event_gathering.delete(self)
|
727
|
+
|
694
728
|
unreachable_handlers.each do |_, block|
|
695
729
|
begin
|
696
730
|
block.call(reason)
|
data/lib/roby/state/state.rb
CHANGED
@@ -217,9 +217,23 @@ module Roby
|
|
217
217
|
# Returns true if this object has no member
|
218
218
|
def empty?; @members.empty? end
|
219
219
|
|
220
|
-
|
221
|
-
|
220
|
+
if RUBY_VERSION >= "1.8.7"
|
221
|
+
def respond_to?(name, include_private = false) # :nodoc:
|
222
|
+
return true if super
|
223
|
+
return __respond_to__(name)
|
224
|
+
end
|
225
|
+
else
|
226
|
+
def respond_to?(name) # :nodoc:
|
227
|
+
return true if super
|
228
|
+
return __respond_to__(name)
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
222
232
|
|
233
|
+
# 1.8.7's #respond_to? takes two arguments, 1.8.6 only one. This is the
|
234
|
+
# common implementation for both version. #respond_to? is adapted (see
|
235
|
+
# above)
|
236
|
+
def __respond_to__(name) # :nodoc:
|
223
237
|
name = name.to_s
|
224
238
|
return false if name =~ FORBIDDEN_NAMES_RX
|
225
239
|
|
data/lib/roby/task.rb
CHANGED
@@ -56,14 +56,13 @@ module Roby
|
|
56
56
|
# event
|
57
57
|
def task_sources
|
58
58
|
result = ValueSet.new
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
end
|
59
|
+
event_sources = sources
|
60
|
+
for ev in event_sources
|
61
|
+
gen = ev.generator
|
62
|
+
if gen.respond_to?(:task) && gen.task == task
|
63
|
+
result.merge ev.task_sources
|
64
|
+
end
|
65
|
+
end
|
67
66
|
if result.empty?
|
68
67
|
result << self
|
69
68
|
end
|
data/test/test_event.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvain Joyeux
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-06-14 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -35,9 +35,9 @@ dependencies:
|
|
35
35
|
version_requirement:
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 1.3.1
|
41
41
|
version:
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: hoe
|