Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-4353

[Build Failure] mod_wsgi test failing due to missing import

    • Type: Icon: Build Failure Build Failure
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 4.7
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Python Drivers
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Name of Failure:

      ModuleNotFoundError: No module named 'dns'

      Link to task:

      https://spruce.mongodb.com/task/mongo_python_driver_tests_mod_wsgi__platform~ubuntu_22.04_python_version~3.9_mod_wsgi_version~4_mod_wsgi_standalone_48d5a46e46e88e337df8cd8ae0fbb77788746e9d_24_04_08_18_34_51/logs?execution=0&sortBy=STATUS&sortDir=ASC

      Context of when and why the failure occurred:

      We introduced lazy imports in PYTHON-4260, which seems to not work with mod_wsgi, but there could be something different about the way the package is consumed during these tests (missing dependencies).

      Stack trace:

       [2024/04/08 18:12:55.775] [Mon Apr 08 23:12:55.423259 2024] [mpm_prefork:notice] [pid 82885] AH00163: Apache/2.4.52 (Ubuntu) mod_wsgi/4.9.4 Python/3.9 configured -- resuming normal operations
       [2024/04/08 18:12:55.775] [Mon Apr 08 23:12:55.423330 2024] [core:notice] [pid 82885] AH00094: Command line: '/usr/sbin/apache2 -f /data/mci/c3f84ff0882eb692edbfdf2da222769c/src/test/mod_wsgi_test/apache24ubuntu161404.conf'
       [2024/04/08 18:12:55.775] [Mon Apr 08 23:12:55.773679 2024] [wsgi:error] [pid 82887] [remote 127.0.0.1:41112] mod_wsgi (pid=82887): Failed to exec Python script file '/data/mci/c3f84ff0882eb692edbfdf2da222769c/src/test/mod_wsgi_test/mod_wsgi_test.py'.
       [2024/04/08 18:12:55.775] [Mon Apr 08 23:12:55.773712 2024] [wsgi:error] [pid 82887] [remote 127.0.0.1:41112] mod_wsgi (pid=82887): Exception occurred processing WSGI script '/data/mci/c3f84ff0882eb692edbfdf2da222769c/src/test/mod_wsgi_test/mod_wsgi_test.py'.
       [2024/04/08 18:12:55.775] [Mon Apr 08 23:12:55.774151 2024] [wsgi:error] [pid 82887] [remote 127.0.0.1:41112] Traceback (most recent call last):
       [2024/04/08 18:12:55.775] [Mon Apr 08 23:12:55.774168 2024] [wsgi:error] [pid 82887] [remote 127.0.0.1:41112]   File "/data/mci/c3f84ff0882eb692edbfdf2da222769c/src/test/mod_wsgi_test/mod_wsgi_test.py", line 32, in <module>
       [2024/04/08 18:12:55.775] [Mon Apr 08 23:12:55.774170 2024] [wsgi:error] [pid 82887] [remote 127.0.0.1:41112]     import pymongo
       [2024/04/08 18:12:55.775] [Mon Apr 08 23:12:55.774172 2024] [wsgi:error] [pid 82887] [remote 127.0.0.1:41112]   File "/data/mci/c3f84ff0882eb692edbfdf2da222769c/src/pymongo/__init__.py", line 93, in <module>
       [2024/04/08 18:12:55.775] [Mon Apr 08 23:12:55.774173 2024] [wsgi:error] [pid 82887] [remote 127.0.0.1:41112]     from pymongo.mongo_client import MongoClient
       [2024/04/08 18:12:55.775] [Mon Apr 08 23:12:55.774175 2024] [wsgi:error] [pid 82887] [remote 127.0.0.1:41112]   File "/data/mci/c3f84ff0882eb692edbfdf2da222769c/src/pymongo/mongo_client.py", line 61, in <module>
       [2024/04/08 18:12:55.775] [Mon Apr 08 23:12:55.774176 2024] [wsgi:error] [pid 82887] [remote 127.0.0.1:41112]     from pymongo import (
       [2024/04/08 18:12:55.775] [Mon Apr 08 23:12:55.774178 2024] [wsgi:error] [pid 82887] [remote 127.0.0.1:41112]   File "/data/mci/c3f84ff0882eb692edbfdf2da222769c/src/pymongo/uri_parser.py", line 43, in <module>
       [2024/04/08 18:12:55.775] [Mon Apr 08 23:12:55.774179 2024] [wsgi:error] [pid 82887] [remote 127.0.0.1:41112]     from pymongo.srv_resolver import _HAVE_DNSPYTHON, _SrvResolver
       [2024/04/08 18:12:55.775] [Mon Apr 08 23:12:55.774181 2024] [wsgi:error] [pid 82887] [remote 127.0.0.1:41112]   File "/data/mci/c3f84ff0882eb692edbfdf2da222769c/src/pymongo/srv_resolver.py", line 29, in <module>
       [2024/04/08 18:12:55.775] [Mon Apr 08 23:12:55.774182 2024] [wsgi:error] [pid 82887] [remote 127.0.0.1:41112]     resolver = lazy_import("dns.resolver")
       [2024/04/08 18:12:55.775] [Mon Apr 08 23:12:55.774183 2024] [wsgi:error] [pid 82887] [remote 127.0.0.1:41112]   File "/data/mci/c3f84ff0882eb692edbfdf2da222769c/src/pymongo/_lazy_import.py", line 27, in lazy_import
       [2024/04/08 18:12:55.775] [Mon Apr 08 23:12:55.774185 2024] [wsgi:error] [pid 82887] [remote 127.0.0.1:41112]     spec = importlib.util.find_spec(name)
       [2024/04/08 18:12:55.775] [Mon Apr 08 23:12:55.774186 2024] [wsgi:error] [pid 82887] [remote 127.0.0.1:41112]   File "/opt/python/3.9/lib/python3.9/importlib/util.py", line 94, in find_spec
       [2024/04/08 18:12:55.775] [Mon Apr 08 23:12:55.774187 2024] [wsgi:error] [pid 82887] [remote 127.0.0.1:41112]     parent = __import__(parent_name, fromlist=['__path__'])
       [2024/04/08 18:12:55.775] [Mon Apr 08 23:12:55.774194 2024] [wsgi:error] [pid 82887] [remote 127.0.0.1:41112] ModuleNotFoundError: No module named 'dns'
      

            Assignee:
            steve.silvester@mongodb.com Steve Silvester
            Reporter:
            steve.silvester@mongodb.com Steve Silvester
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: