Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

self.node has no attribute 'prev_node' #4

Open
chiache opened this issue Jul 19, 2011 · 12 comments
Open

self.node has no attribute 'prev_node' #4

chiache opened this issue Jul 19, 2011 · 12 comments

Comments

@chiache
Copy link

chiache commented Jul 19, 2011

DEBUG:root:Race list <racepro.racecore.RaceList instance at 0x11cee5ec>
Traceback (most recent call last):
File "/usr/local/bin/racetest", line 152, in
racetest.do_all_tests(args, tests)
File "/usr/local/lib/python2.6/dist-packages/racepro/racetest.py", line 272, in do_all_tests
if not do_one_test(args, t_name, t_exec):
File "/usr/local/lib/python2.6/dist-packages/racepro/racetest.py", line 199, in do_one_test
if not _findraces(args, opts):
File "/usr/local/lib/python2.6/dist-packages/racepro/racetest.py", line 114, in _findraces
racecore.find_show_races(graph, args)
File "/usr/local/lib/python2.6/dist-packages/racepro/racecore.py", line 665, in find_show_races
count = output_races(race_list, args.path, 'SIGNAL', count, args.count)
File "/usr/local/lib/python2.6/dist-packages/racepro/racecore.py", line 631, in output_races
if race.prepare(race_list.graph):
File "/usr/local/lib/python2.6/dist-packages/racepro/racecore.py", line 277, in prepare
crosscut = graph.crosscut([node])
File "/usr/local/lib/python2.6/dist-packages/racepro/execgraph.py", line 179, in crosscut
vc = reduce(lambda vc, nl: vc.merge(nl.vclock), cut, VectorClock())
File "/usr/local/lib/python2.6/dist-packages/racepro/execgraph.py", line 179, in
vc = reduce(lambda vc, nl: vc.merge(nl.vclock), cut, VectorClock())
File "/usr/local/lib/python2.6/dist-packages/racepro/execgraph.py", line 53, in vclock
return self.node.prev_node().vclock
AttributeError: 'NoneType' object has no attribute 'prev_node'

@nviennot
Copy link
Member

line 277, you have crosscut = graph.crosscut([node]).
the node is 'None'. Hence the exception.

On Tue, Jul 19, 2011 at 3:31 PM, chiache <
reply@reply.github.com>wrote:

DEBUG:root:Race list <racepro.racecore.RaceList instance at 0x11cee5ec>
Traceback (most recent call last):
File "/usr/local/bin/racetest", line 152, in
racetest.do_all_tests(args, tests)
File "/usr/local/lib/python2.6/dist-packages/racepro/racetest.py", line
272, in do_all_tests
if not do_one_test(args, t_name, t_exec):
File "/usr/local/lib/python2.6/dist-packages/racepro/racetest.py", line
199, in do_one_test
if not _findraces(args, opts):
File "/usr/local/lib/python2.6/dist-packages/racepro/racetest.py", line
114, in _findraces
racecore.find_show_races(graph, args)
File "/usr/local/lib/python2.6/dist-packages/racepro/racecore.py", line
665, in find_show_races
count = output_races(race_list, args.path, 'SIGNAL', count, args.count)
File "/usr/local/lib/python2.6/dist-packages/racepro/racecore.py", line
631, in output_races
if race.prepare(race_list.graph):
File "/usr/local/lib/python2.6/dist-packages/racepro/racecore.py", line
277, in prepare
crosscut = graph.crosscut([node])
File "/usr/local/lib/python2.6/dist-packages/racepro/execgraph.py", line
179, in crosscut
vc = reduce(lambda vc, nl: vc.merge(nl.vclock), cut, VectorClock())
File "/usr/local/lib/python2.6/dist-packages/racepro/execgraph.py", line
179, in
vc = reduce(lambda vc, nl: vc.merge(nl.vclock), cut, VectorClock())
File "/usr/local/lib/python2.6/dist-packages/racepro/execgraph.py", line
53, in vclock
return self.node.prev_node().vclock
AttributeError: 'NoneType' object has no attribute 'prev_node'

Reply to this email directly or view it on GitHub:
#4

@chiache
Copy link
Author

chiache commented Jul 19, 2011

It is buggy.

In session.py:
244 class Signal:
245 @staticmethod
246 def find_signals(events):
247 cookies = dict()
248
249 def got_a_cookie(e, type):
250 cookies.setdefault(e.cookie, dict())[type] = e
251
252 for e in events:
253 if e.is_a(scribe.EventSigSendCookie):
254 got_a_cookie(e, 'send')
255 elif e.is_a(scribe.EventSigRecvCookie):
256 got_a_cookie(e, 'recv')
257 elif e.is_a(scribe.EventSigHandledCookie):
258 got_a_cookie(e, 'handled')
259
260 signals = list()
261 for sig in cookies.itervalues():
262 if not sig.has_key('send'):
263 raise ValueError('Found a signal without a send cookie')
264 if not sig.has_key('recv'):
265 raise ValueError('Found a signal without a recv cookie')
266 sig.setdefault('handled', None)
267 signals.append(Signal(**sig))
268 return signals
269
270 def init(self, send, recv, handled):
271 self.send = send
272 self.recv = recv
273 self.handled = handled

So Signal.handled might have never been initialized. Does it come from scribe?

@nviennot
Copy link
Member

Look at the logfile.
if Signal.handled == None, it means the received signal was never handled
(it was blocked maybe ?)

On Tue, Jul 19, 2011 at 3:41 PM, chiache <
reply@reply.github.com>wrote:

It is buggy.

In session.py:
244 class Signal:
245 @staticmethod
246 def find_signals(events):
247 cookies = dict()
248
249 def got_a_cookie(e, type):
250 cookies.setdefault(e.cookie, dict())[type] = e
251
252 for e in events:
253 if e.is_a(scribe.EventSigSendCookie):
254 got_a_cookie(e, 'send')
255 elif e.is_a(scribe.EventSigRecvCookie):
256 got_a_cookie(e, 'recv')
257 elif e.is_a(scribe.EventSigHandledCookie):
258 got_a_cookie(e, 'handled')
259
260 signals = list()
261 for sig in cookies.itervalues():
262 if not sig.has_key('send'):
263 raise ValueError('Found a signal without a send
cookie')
264 if not sig.has_key('recv'):
265 raise ValueError('Found a signal without a recv
cookie')
266 sig.setdefault('handled', None)
267 signals.append(Signal(**sig))
268 return signals
269
270 def init(self, send, recv, handled):
271 self.send = send
272 self.recv = recv
273 self.handled = handled

So Signal.handled might have never been initialized. Does it come from
scribe?

Reply to this email directly or view it on GitHub:
#4 (comment)

@chiache
Copy link
Author

chiache commented Jul 19, 2011

So how should we fix it? Is it never gonna to be one of the races?

@nviennot
Copy link
Member

Oren would be better answering that question, he wrote that piece of code.

On Tue, Jul 19, 2011 at 4:19 PM, chiache <
reply@reply.github.com>wrote:

So how should we fix it? Is it never gonna to be one of the races?

Reply to this email directly or view it on GitHub:
#4 (comment)

@orenl
Copy link

orenl commented Jul 19, 2011

I think Nico is right: a signal that has not been handled yet will have signal.hanlded == None. This happens only if session.py:Signal:find_signals() didn't find the 'hanlded' cookie for that signal (i.e. the signal was not handled). In that case, there isn't really a race - because an un-handled signal does not affect any system call, so there isn't much to reorder either.

I suggest that we ignore un-handled signals, e.g. replace:

267 signals.append(Signal(**sig))
268 return signals

with:

267 if not signal.handled:
268 signals.append(Signal(**sig))
268 return signals

can you please verify that it works ?

@nviennot
Copy link
Member

In which file ?

On Tue, Jul 19, 2011 at 6:14 PM, orenl <
reply@reply.github.com>wrote:

I think Nico is right: a signal that has not been handled yet will have
signal.hanlded == None. This happens only if
session.py:Signal:find_signals() didn't find the 'hanlded' cookie for that
signal (i.e. the signal was not handled). In that case, there isn't really a
race - because an un-handled signal does not affect any system call, so
there isn't much to reorder either.

I suggest that we ignore un-handled signals, e.g. replace:

267 signals.append(Signal(**sig))
268 return signals

with:

267 if not signal.handled:
268 signals.append(Signal(**sig))
268 return signals

can you please verify that it works ?

Reply to this email directly or view it on GitHub:
#4 (comment)

@chiache
Copy link
Author

chiache commented Jul 19, 2011

Let me try.

Tsai, Chia-che (Jerry) chiache.tsai@gmail.com

On Tue, Jul 19, 2011 at 6:14 PM, orenl <
reply@reply.github.com>wrote:

I think Nico is right: a signal that has not been handled yet will have
signal.hanlded == None. This happens only if
session.py:Signal:find_signals() didn't find the 'hanlded' cookie for that
signal (i.e. the signal was not handled). In that case, there isn't really a
race - because an un-handled signal does not affect any system call, so
there isn't much to reorder either.

I suggest that we ignore un-handled signals, e.g. replace:

267 signals.append(Signal(**sig))
268 return signals

with:

267 if not signal.handled:
268 signals.append(Signal(**sig))
268 return signals

can you please verify that it works ?

Reply to this email directly or view it on GitHub:
#4 (comment)

@orenl
Copy link

orenl commented Jul 19, 2011

session.py:Signal:find_signals()
(same location as the original snippet in the report)

On 07/19/2011 06:15 PM, nviennot wrote:

In which file ?

On Tue, Jul 19, 2011 at 6:14 PM, orenl <
reply@reply.github.com>wrote:

I think Nico is right: a signal that has not been handled yet will have
signal.hanlded == None. This happens only if
session.py:Signal:find_signals() didn't find the 'hanlded' cookie for that
signal (i.e. the signal was not handled). In that case, there isn't really a
race - because an un-handled signal does not affect any system call, so
there isn't much to reorder either.

I suggest that we ignore un-handled signals, e.g. replace:

267 signals.append(Signal(**sig))
268 return signals

with:

267 if not signal.handled:
268 signals.append(Signal(**sig))
268 return signals

can you please verify that it works ?

Reply to this email directly or view it on GitHub:
#4 (comment)

@orenl
Copy link

orenl commented Jul 19, 2011

doh !!!

of course, it should be:

267 if signal.handled:

(remove the "not" !)

On 07/19/2011 06:15 PM, nviennot wrote:

In which file ?

On Tue, Jul 19, 2011 at 6:14 PM, orenl <
reply@reply.github.com>wrote:

I think Nico is right: a signal that has not been handled yet will have
signal.hanlded == None. This happens only if
session.py:Signal:find_signals() didn't find the 'hanlded' cookie for that
signal (i.e. the signal was not handled). In that case, there isn't really a
race - because an un-handled signal does not affect any system call, so
there isn't much to reorder either.

I suggest that we ignore un-handled signals, e.g. replace:

267 signals.append(Signal(**sig))
268 return signals

with:

267 if not signal.handled:
268 signals.append(Signal(**sig))
268 return signals

can you please verify that it works ?

Reply to this email directly or view it on GitHub:
#4 (comment)

@nviennot
Copy link
Member

Do NOT modify session.py, modify your own code to skip unhandled signals.

On Tue, Jul 19, 2011 at 6:17 PM, orenl <
reply@reply.github.com>wrote:

session.py:Signal:find_signals()
(same location as the original snippet in the report)

On 07/19/2011 06:15 PM, nviennot wrote:

In which file ?

On Tue, Jul 19, 2011 at 6:14 PM, orenl <
reply@reply.github.com>wrote:

I think Nico is right: a signal that has not been handled yet will have
signal.hanlded == None. This happens only if
session.py:Signal:find_signals() didn't find the 'hanlded' cookie for
that
signal (i.e. the signal was not handled). In that case, there isn't
really a
race - because an un-handled signal does not affect any system call, so
there isn't much to reorder either.

I suggest that we ignore un-handled signals, e.g. replace:

267 signals.append(Signal(**sig))
268 return signals

with:

267 if not signal.handled:
268 signals.append(Signal(**sig))
268 return signals

can you please verify that it works ?

Reply to this email directly or view it on GitHub:
#4 (comment)

Reply to this email directly or view it on GitHub:
#4 (comment)

@orenl
Copy link

orenl commented Jul 19, 2011

so fierce :(
no need to shout ...

you can instead make racecore.py:RaceSignal:prepare() return False
immediately if the node is None:

257 def prepare(self, graph):
258 node = self.signal.handled
259 if not node: <-- added
260 Return False <-- added
261 crosscut = graph.crosscut([node])

On 07/19/2011 06:18 PM, nviennot wrote:

Do NOT modify session.py, modify your own code to skip unhandled
signals.

On Tue, Jul 19, 2011 at 6:17 PM, orenl <
reply@reply.github.com>wrote:

session.py:Signal:find_signals() (same location as the original
snippet in the report)

On 07/19/2011 06:15 PM, nviennot wrote:

In which file ?

On Tue, Jul 19, 2011 at 6:14 PM, orenl <
reply@reply.github.com>wrote:

I think Nico is right: a signal that has not been handled yet
will have signal.hanlded == None. This happens only if
session.py:Signal:find_signals() didn't find the 'hanlded'
cookie for
that
signal (i.e. the signal was not handled). In that case, there
isn't
really a
race - because an un-handled signal does not affect any system
call, so there isn't much to reorder either.

I suggest that we ignore un-handled signals, e.g. replace:

267 signals.append(Signal(**sig)) 268 return signals

with:

267 if not signal.handled: 268
signals.append(Signal(**sig)) 268 return signals

can you please verify that it works ?

-- Reply to this email directly or view it on GitHub:
#4 (comment)

Reply to this email directly or view it on GitHub:
#4 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants