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

Edge case when handling KeyboardInterrupt module shutdown #62

Open
thclark opened this issue Jun 9, 2022 · 0 comments
Open

Edge case when handling KeyboardInterrupt module shutdown #62

thclark opened this issue Jun 9, 2022 · 0 comments
Assignees

Comments

@thclark
Copy link
Contributor

thclark commented Jun 9, 2022

Bug report

What is the current behavior?

Pressing ctrl+c on the raspberry pi during acquisition usually results in a safe shutdown.

However, I noticed that sometimes I have the following traceback in the middle:

 $ gateway start
/home/pi/.cache/pypoetry/virtualenvs/data-gateway-lz7aa1yn-py3.7/lib/python3.7/site-packages/google_crc32c/__init__.py:29: RuntimeWarning: As the c extension couldn't be imported, `google-crc32c` is using a pure python implementation that is significantly slower. If possible, please configure a c build environment and compile the extension
  warnings.warn(_SLOW_CRC32C_WARNING, RuntimeWarning)
[2022-06-09 14:29:20,591 | INFO | multiprocessing | MainProcess] No configuration file provided - using default configuration.
[2022-06-09 14:29:20,693 | WARNING | multiprocessing | MainProcess] No routine was provided and interactive mode is off - no commands will be sent to the sensors in this session.
[2022-06-09 14:29:20,705 | INFO | multiprocessing | MainProcess] allocating a new mmap of length 4096
[2022-06-09 14:29:20,718 | INFO | multiprocessing | Reader] child process calling self.run()
[2022-06-09 14:29:20,719 | INFO | multiprocessing | Reader] Packet reader process started.
[2022-06-09 14:29:20,725 | INFO | multiprocessing | Parser] child process calling self.run()
[2022-06-09 14:29:20,726 | INFO | multiprocessing | Parser] Packet parser process started.
[2022-06-09 14:29:20,751 | INFO | multiprocessing | Parser] Windows will be saved to 'data_gateway/661014/.backup' at intervals of 600.0 seconds.
[2022-06-09 14:29:20,751 | INFO | multiprocessing | Parser] Windows will be uploaded to 'data_gateway/661014' at intervals of 600.0 seconds.
^C[2022-06-09 14:29:53,966 | INFO | multiprocessing | Reader] Stopping gateway.
[2022-06-09 14:29:53,967 | INFO | multiprocessing | Reader] process shutting down
[2022-06-09 14:29:53,968 | INFO | multiprocessing | Reader] process exiting with exitcode 0
[2022-06-09 14:29:53,967 | INFO | multiprocessing | MainProcess] Sent 'stopBaros' command to sensors.
[2022-06-09 14:29:53,967 | ERROR | multiprocessing | Parser] expected str, bytes or os.PathLike object, not NoneType
Traceback (most recent call last):
  File "/home/pi/aerosense/install/data-gateway/data_gateway/packet_reader.py", line 169, in parse_packets
    packet_type, packet = packet_queue.get(timeout=timeout).values()
  File "/usr/lib/python3.7/multiprocessing/queues.py", line 104, in get
    if not self._poll(timeout):
  File "/usr/lib/python3.7/multiprocessing/connection.py", line 257, in poll
    return self._poll(timeout)
  File "/usr/lib/python3.7/multiprocessing/connection.py", line 414, in _poll
    r = wait([self], timeout)
  File "/usr/lib/python3.7/multiprocessing/connection.py", line 920, in wait
    ready = selector.select(timeout)
  File "/usr/lib/python3.7/selectors.py", line 415, in select
    fd_event_list = self._selector.poll(timeout)
KeyboardInterrupt

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/aerosense/install/data-gateway/data_gateway/persistence.py", line 255, in _persist_window
    cloud_path=storage.path.generate_gs_path(self.bucket_name, self._generate_window_path()),
  File "/home/pi/.cache/pypoetry/virtualenvs/data-gateway-lz7aa1yn-py3.7/lib/python3.7/site-packages/octue/cloud/storage/path.py", line 63, in generate_gs_path
    return CLOUD_STORAGE_PROTOCOL + join(bucket_name, paths[0].lstrip("/"), *paths[1:])
  File "/home/pi/.cache/pypoetry/virtualenvs/data-gateway-lz7aa1yn-py3.7/lib/python3.7/site-packages/octue/cloud/storage/path.py", line 45, in join
    path = os.path.normpath(os.path.join(*paths)).replace("\\", "/")
  File "/usr/lib/python3.7/posixpath.py", line 80, in join
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType
[2022-06-09 14:29:54,005 | WARNING | multiprocessing | Parser] Upload of window may have failed - writing to disk at 'data_gateway/661014/.backup/window-0.json'.
[2022-06-09 14:29:54,009 | INFO | multiprocessing | Parser] Window 0 written to disk.
[2022-06-09 14:29:54,011 | INFO | multiprocessing | Parser] Stopping gateway.
[2022-06-09 14:29:54,012 | INFO | multiprocessing | Parser] process shutting down
[2022-06-09 14:29:54,014 | INFO | multiprocessing | Parser] process exiting with exitcode 0
[2022-06-09 14:29:58,977 | INFO | multiprocessing | MainProcess] Sent 'stopDiffBaros' command to sensors.
[2022-06-09 14:30:03,983 | INFO | multiprocessing | MainProcess] Sent 'stopIMU' command to sensors.
[2022-06-09 14:30:08,989 | INFO | multiprocessing | MainProcess] Sent 'stopMics' command to sensors.

What is the expected behavior?

KeyboardInterrupt shuts down with no exception

Your environment

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