brata-hsdc / brata

Automatically exported from code.google.com/p/brata
2 stars 0 forks source link

CTS throws StopIteration exception after submitting correct solution #38

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
After the user submits a correct combo and presses Select twice to send, it 
appears that the message is received by the MS, and the response to that 
message causes the CTS to crash.

Here is some log output showing the crash:
TypeError: unsupported operand type(s) for /: 'unicode' and 'int'
ERROR:root:500 POST /rpi/start_challenge (172.27.164.9) 97.09ms
DEBUG:station.connection:Received startChallenge message from MS with json 
{"message_timestamp": "2015-01-24 10:31:35", "message_version": 0, "cts_combo": 
[13, 57, 39], "theatric_delay_ms": "60", "clue": "mGDJ"}
DEBUG:station.connection:Received a start_challenge request for CTS station
DEBUG:station.connection:Master server requesting station start_challenge (ver 
0) at 2015-01-24 10:31:35 with theatric delay of 60 ms, CTS combo [13, 57, 39]
DEBUG:station.main:State transition from 1 to 1 with args [[13, 57, 39]]
INFO:station.types.cts:CTS transitioned to Processing state with args [[13, 57, 
39]].
DEBUG:station.types.cts:Constructing combo
DEBUG:station.hw:Starting listening for push button monitor
INFO:station.types.cts:1st enter key press received. Waiting for 2nd.
DEBUG:station.hw:Stopping listening for push button monitor
INFO:station.types.cts:2nd enter key press received.
INFO:station.types.cts:Submitting combo: [13, 57, 39] , match = True
DEBUG:station.connection:Station submitting answer to master server
DEBUG:station.connection:Calling service with HTTP method 2, endpoint URL 
http://172.27.164.9:80/m/rpi/submit/cts01, and args {'candidate_answer': [13, 
57, 39], 'message_timestamp': '2015-01-23 04:35:34', 'message_version': 0, 
'fail_message': '', 'is_correct': 'True'}
DEBUG:station.connection:Service returned 200 with for HTTP method 2, endpoint 
URL http://172.27.164.9:80/m/rpi/submit/cts01, and args {'candidate_answer': 
[13, 57, 39], 'message_timestamp': '2015-01-23 04:35:34', 'message_version': 0, 
'fail_message': '', 'is_correct': 'True'} with headers {'content-length': 
'114', 'x-powered-by': 'PHP/5.4.4-14+deb7u14', 'set-cookie': 
'PHPSESSID=j4c566jjefekd3fpc64jbp4hv3; path=/', 'expires': 'Sat, 24 Jan 2015 
15:33:24 GMT', 'server': 'Apache/2.2.22 (Debian)', 'pragma': 'no-cache', 
'cache-control': 'no-cache', 'date': 'Sat, 24 Jan 2015 15:33:24 GMT', 
'content-type': 'application/json'}, response <Response [200]>, JSON response 
{u'message_timestamp': u'2015-01-24 10:33:24', u'message_version': 0, 
u'theatric_delay_ms': u'60', u'challenge_complete': True}, and message 
{"message_timestamp": "2015-01-24 10:33:24", "message_version": 0, 
"theatric_delay_ms": "60", "challenge_complete": true}
DEBUG:station.connection:Service http://172.27.164.9:80/m/rpi/submit/cts01 
returned OK
DEBUG:station.connection:Handling submission response: Theatric delay 60 ms is 
correct? True. Challenge complete? True
DEBUG:station.main:State transition from 1 to 3 with args [[u'60']]
INFO:station.types.cts:CTS transitioned to Passed state with args [[u'60']].
DEBUG:station.hw:Stopping listening for push button monitor
DEBUG:station.hw:Stopping listening for push button monitor
DEBUG:station.hw:Starting listening for push button monitor
CRITICAL:station.hw:Exception occurred of type StopIteration in push button 
monitor
CRITICAL:station.hw:
  File "/opt/designchallenge2015/brata.station/bin/../station/hw.py", line 582, in run
    self.onTick()  # event callback for animation
  File "/opt/designchallenge2015/brata.station/bin/../station/hw.py", line 555, in onTick
    self._onTickCallback()
  File "/opt/designchallenge2015/brata.station/bin/../station/types/cts.py", line 527, in onTick
    if not self._timedMsg.next():
CRITICAL:station.hw:Exception occurred of type StopIteration in push button 
monitor
CRITICAL:station.hw:
  File "/opt/designchallenge2015/brata.station/bin/../station/hw.py", line 582, in run
    self.onTick()  # event callback for animation
  File "/opt/designchallenge2015/brata.station/bin/../station/hw.py", line 555, in onTick
    self._onTickCallback()
  File "/opt/designchallenge2015/brata.station/bin/../station/types/cts.py", line 527, in onTick
    if not self._timedMsg.next():
CRITICAL:station.hw:Exception occurred of type StopIteration in push button 
monitor
CRITICAL:station.hw:
  File "/opt/designchallenge2015/brata.station/bin/../station/hw.py", line 582, in run
    self.onTick()  # event callback for animation
  File "/opt/designchallenge2015/brata.station/bin/../station/hw.py", line 555, in onTick
    self._onTickCallback()
... (repeats forever)

Original issue reported on code.google.com by ellery.c...@gmail.com on 27 Jan 2015 at 10:05

GoogleCodeExporter commented 9 years ago

Original comment by ellery.c...@gmail.com on 27 Jan 2015 at 10:06

GoogleCodeExporter commented 9 years ago
Problem was caused by a generator function being used to implement a timer.  It 
would count down until it was done, but was not reset at that point.  The next 
call to the generator function would raise a StopIteration exception, which was 
not being caught.  Changed the code to reset the timer when it reaches 0.

Original comment by ellery.c...@gmail.com on 28 Jan 2015 at 8:15

GoogleCodeExporter commented 9 years ago

Original comment by jawaad.a...@gmail.com on 19 Feb 2015 at 12:38