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

[virustotal-livehunt-notifications] Connector fails to start with ModuleNotFoundError: import of time halted; None in sys.modules #3334

Closed
gileri opened this issue Jan 24, 2025 · 1 comment · Fixed by #3398
Assignees
Labels
bug use for describing something not working as expected filigran support [optional] use to identify an issue related to feature developed & maintained by Filigran. solved use to identify issue that has been solved (must be linked to the solving PR)
Milestone

Comments

@gileri
Copy link
Member

gileri commented Jan 24, 2025

Description

Environment

  1. OS (where OpenCTI server runs): Linux
  2. OpenCTI version: { e.g. OpenCTI 1.0.2 } 6.4.8
  3. OpenCTI client: { e.g. frontend or python } python
  4. Other environment details: Official docker image

Reproducible Steps

Steps to create the smallest reproducible scenario:

  1. Run connector
  2. Get logs below, crash

Expected Output

Actual Output

Logs
{"timestamp": "2025-01-24T14:46:51.614799Z", "level": "ERROR", "name": "redacted_Intel_VirusTotal-livehunt-notifications", "message": "'Object' object has no attribute 'meaningful_name'", "exc_info": "Traceback (most recent call last):\n  File \"/opt/opencti-connector-virustotal-liv
ehunt-notifications/livehunt/livehunt.py\", line 289, in run\n    self.builder.process(last_run, timestamp)\n  File \"/opt/opencti-connector-virustotal-livehunt-notifications/livehunt/builder.py\", line 152, in process\n    file_id = self.create_file(vtobj, incident_id)\n
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/opt/opencti-connector-virustotal-livehunt-notifications/livehunt/builder.py\", line 289, in create_file\n    if name != vtobj.meaningful_name:\n               ^^^^^^^^^^^^^^^^^^^^^\n  File \"/usr/local/lib/python3.12/site-packages/vt/
object.py\", line 158, in __getattribute__\n    value = super().__getattribute__(attr)\n            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAttributeError: 'Object' object has no attribute 'meaningful_name'", "taskName": null}
--- Logging error ---
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1160, in emit
    msg = self.format(record)
          ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/logging/__init__.py", line 999, in format
    return fmt.format(record)
           ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pythonjsonlogger/jsonlogger.py", line 243, in format
    self.add_fields(log_record, record, message_dict)
  File "/usr/local/lib/python3.12/site-packages/pycti/utils/opencti_logger.py", line 12, in add_fields
    now = datetime.datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S.%fZ")
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: import of time halted; None in sys.modules
Call stack:
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 443, in __del__
    self._loop.call_exception_handler(context)
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1852, in call_exception_handler
    self.default_exception_handler(context)
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1826, in default_exception_handler
    logger.error('\n'.join(log_lines), exc_info=exc_info)
Message: 'Unclosed client session\nclient_session: <aiohttp.client.ClientSession object at 0x7f0daf1bb860>'
Arguments: ()
--- Logging error ---
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/logging/__init__.py", line 1160, in emit
    msg = self.format(record)
          ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/logging/__init__.py", line 999, in format
    return fmt.format(record)
           ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pythonjsonlogger/jsonlogger.py", line 243, in format
    self.add_fields(log_record, record, message_dict)
  File "/usr/local/lib/python3.12/site-packages/pycti/utils/opencti_logger.py", line 12, in add_fields
    now = datetime.datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S.%fZ")
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: import of time halted; None in sys.modules
Call stack:
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 333, in __del__
    self._loop.call_exception_handler(context)
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1852, in call_exception_handler
    self.default_exception_handler(context)
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1826, in default_exception_handler
    logger.error('\n'.join(log_lines), exc_info=exc_info)
Message: "Unclosed connector\nconnections: ['deque([(<aiohttp.client_proto.ResponseHandler object at 0x7f0dad2ffad0>, 2434776.461359972)])']\nconnector: <aiohttp.connector.TCPConnector object at 0x7f0dad2f7e30>"
Arguments: ()
stream closed EOF for customer-redacted-staging/opencti-connector-redacted-intel-virustotal-livehunt-notinxcf5 (virustotal-livehunt-notifications-connector)

Additional information

Screenshots (optional)

@gileri gileri added bug use for describing something not working as expected needs triage use to identify issue needing triage from Filigran Product team labels Jan 24, 2025
@flavienSindou
Copy link
Contributor

flavienSindou commented Jan 27, 2025

This might be due to the deprecation of utcnow in python 3.12 https://docs.python.org/3/whatsnew/3.12.html#deprecated in pycti dependency and not in the connector directly.

@romain-filigran romain-filigran removed the needs triage use to identify issue needing triage from Filigran Product team label Jan 30, 2025
@romain-filigran romain-filigran added this to the Bugs backlog milestone Jan 30, 2025
@Powlinett Powlinett linked a pull request Feb 7, 2025 that will close this issue
4 tasks
@helene-nguyen helene-nguyen added solved use to identify issue that has been solved (must be linked to the solving PR) filigran support [optional] use to identify an issue related to feature developed & maintained by Filigran. labels Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug use for describing something not working as expected filigran support [optional] use to identify an issue related to feature developed & maintained by Filigran. solved use to identify issue that has been solved (must be linked to the solving PR)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants