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

Race condition when using the "deploy" action #22

Open
dmoisset opened this issue Jan 25, 2020 · 3 comments
Open

Race condition when using the "deploy" action #22

dmoisset opened this issue Jan 25, 2020 · 3 comments

Comments

@dmoisset
Copy link

Hi, I've been working on an interview assignment and I've found that sometimes the send_command_to_server script fails:

$ PYTHONPATH=lib python lib/send_command_to_server.py
Connecting to run.befaster.io

Your progress (0/3):
 @ SUM (1 round)  -   warmup - Add two numbers
 >    └── SUM_R1  - running for 2 min (+0 min penalty)
 . HLO (2 rounds) -   warmup - Hello World !
      ├── HLO_R1  - not started
      └── HLO_R2  - not started
 . CHK (5 rounds) - official - Supermarket checkout
      ├── CHK_R1  - not started
      ├── CHK_R2  - not started
      ├── CHK_R3  - not started
      ├── CHK_R4  - not started
      └── CHK_R5  - not started
---------------------

Type "deploy" if you have answered all the requests. 
Type "pause" if you need a break. 

> deploy
Selected action is: deploy
Starting client
Waiting for requests

id = SUM_R1_001, req = sum(0, 1), error = "user implementation raised exception", (NOT PUBLISHED)
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/dmoisset/Documents/job/iwoca/accelerate_runner/env/lib/python3.7/site-packages/stomp/transport.py", line 296, in __receiver_loop
    self.process_frame(f, frame)
  File "/home/dmoisset/Documents/job/iwoca/accelerate_runner/env/lib/python3.7/site-packages/stomp/transport.py", line 164, in process_frame
    self.notify(frame_type, f.headers, f.body)
  File "/home/dmoisset/Documents/job/iwoca/accelerate_runner/env/lib/python3.7/site-packages/stomp/transport.py", line 206, in notify
    for listener in self.listeners.values():
RuntimeError: dictionary changed size during iteration

Stopping client
Notify round "SUM_R1", event "deploy"
Exception in thread Thread-3:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 1177, in run
    self.function(*self.args, **self.kwargs)
  File "/home/dmoisset/Documents/job/iwoca/accelerate_runner/env/lib/python3.7/site-packages/tdl/queue/transport/remote_broker.py", line 54, in close
    self.conn.disconnect()
  File "/home/dmoisset/Documents/job/iwoca/accelerate_runner/env/lib/python3.7/site-packages/stomp/connect.py", line 110, in disconnect
    Protocol11.disconnect(self, receipt, headers, **keyword_headers)
  File "/home/dmoisset/Documents/job/iwoca/accelerate_runner/env/lib/python3.7/site-packages/stomp/protocol.py", line 185, in disconnect
    self.send_frame(CMD_DISCONNECT, headers)
  File "/home/dmoisset/Documents/job/iwoca/accelerate_runner/env/lib/python3.7/site-packages/stomp/protocol.py", line 130, in send_frame
    self.transport.transmit(frame)
  File "/home/dmoisset/Documents/job/iwoca/accelerate_runner/env/lib/python3.7/site-packages/stomp/transport.py", line 254, in transmit
    self.send(encode(packed_frame))
  File "/home/dmoisset/Documents/job/iwoca/accelerate_runner/env/lib/python3.7/site-packages/stomp/transport.py", line 594, in send
    raise exception.NotConnectedException()
stomp.exception.NotConnectedException

--------------------------------------------

Result is: INCONCLUSIVE
Not enough responses received. Have you solved the challenge?


Challenge description saved to file: challenges/SUM_R1.txt.

After this failure I tried to run it right away and it worked. I managed to reproduce the problem quite consistently on the second warmup test (the hello world one) by using a raise "Hello, World!" instead of return (I mean, besides the expected challenge failure, I also get this RuntimeError: dictionary changed size during iteration which shouldn't happen.

I think it's quite likely that the problem is related to this bug in stomp.py: jasonrbriggs/stomp.py#174 ; and pip installing stomp.py==4.1.23 seems to fix the problem, but I'm not sure if the new version has any other changes that might be incompatible with your system.

@julianghionoiu
Copy link
Owner

julianghionoiu commented Jan 25, 2020 via email

@dmoisset
Copy link
Author

Hi, this was in the warmup problems while I was intentionally trying to see what happened if my code had exceptions (to be prepared for the real scenario). The long internal traceback (instead of a traceback in my code) is somewhat unexpected, and as I mentioned it gets fixed (so I only get a message about my own exception) by upgrading stomp.py

@julianghionoiu
Copy link
Owner

Thanks for this, Daniel.

I will look at upgrading the Stomp library.

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

2 participants