columbia / racepro

Racepro
0 stars 2 forks source link

self.node has no attribute 'prev_node' #4

Open chiache opened 13 years ago

chiache commented 13 years ago

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 commented 13 years ago

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: https://github.com/columbia/racepro/issues/4

chiache commented 13 years ago

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 commented 13 years ago

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: https://github.com/columbia/racepro/issues/4#issuecomment-1609997

chiache commented 13 years ago

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

nviennot commented 13 years ago

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: https://github.com/columbia/racepro/issues/4#issuecomment-1610273

orenl commented 13 years ago

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 commented 13 years ago

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: https://github.com/columbia/racepro/issues/4#issuecomment-1611185

chiache commented 13 years ago

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: https://github.com/columbia/racepro/issues/4#issuecomment-1611185

orenl commented 13 years ago

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: https://github.com/columbia/racepro/issues/4#issuecomment-1611185

orenl commented 13 years ago

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: https://github.com/columbia/racepro/issues/4#issuecomment-1611185

nviennot commented 13 years ago

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: https://github.com/columbia/racepro/issues/4#issuecomment-1611185

Reply to this email directly or view it on GitHub: https://github.com/columbia/racepro/issues/4#issuecomment-1611213

orenl commented 13 years ago

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: https://github.com/columbia/racepro/issues/4#issuecomment-1611185

Reply to this email directly or view it on GitHub: https://github.com/columbia/racepro/issues/4#issuecomment-1611213