0

我使用 Marshmallow 嵌套类型得到以下异常,抛出异常的概率为 50/50%,所以不是每次启动程序时。

Traceback (most recent call last):
  File "/srv/unicontrol/repos/cloud-api2/src/api2/rest/application.py", line 80, in init_app
    api_instance.register_api(api)
  File "/srv/unicontrol/repos/cloud-api2/plugins/global-search/src/UC_Search/api/global_search.py", line 110, in register_api
    api.register_blueprint(self.blp)
  File "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/flask_smorest/__init__.py", line 88, in register_blueprint
    blp.register_views_in_doc(self, self._app, self.spec, name=blp_name)
  File "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/flask_smorest/blueprint.py", line 241, in register_views_in_doc
    spec.path(rule=rule, operations=doc, parameters=parameters)
  File "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/core.py", line 452, in path
    plugin.operation_helper(path=path, operations=operations, **kwargs)
  File "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/ext/marshmallow/__init__.py", line 201, in operation_helper
    self.resolver.resolve_operations(operations)
  File "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/ext/marshmallow/schema_resolver.py", line 34, in resolve_operations
    self.resolve_response(response)
  File "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/ext/marshmallow/schema_resolver.py", line 182, in resolve_response
    self.resolve_schema(response)
  File "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/ext/marshmallow/schema_resolver.py", line 230, in resolve_schema
    content["schema"] = self.resolve_schema_dict(content["schema"])
  File "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/ext/marshmallow/schema_resolver.py", line 294, in resolve_schema_dict
    return self.converter.resolve_nested_schema(schema)
  File "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/ext/marshmallow/openapi.py", line 94, in resolve_nested_schema
    self.spec.components.schema(name, schema=schema)
  File "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/core.py", line 132, in schema
    ret.update(plugin.schema_helper(component_id, ret, **kwargs) or {})
  File "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/ext/marshmallow/__init__.py", line 166, in schema_helper
    json_schema = self.converter.schema2jsonschema(schema_instance)
  File "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/ext/marshmallow/openapi.py", line 182, in schema2jsonschema
    jsonschema = self.fields2jsonschema(fields, partial=partial, ordered=ordered)
  File "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/ext/marshmallow/openapi.py", line 208, in fields2jsonschema
    prop = self.field2property(field_obj)
  File "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/ext/marshmallow/field_converter.py", line 172, in field2property
    ret.update(attr_func(field, ret=ret))
  File "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/ext/marshmallow/field_converter.py", line 451, in list2properties
    ret["items"] = self.field2property(field.inner)
  File "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/ext/marshmallow/field_converter.py", line 172, in field2property
    ret.update(attr_func(field, ret=ret))
  File "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/ext/marshmallow/field_converter.py", line 419, in nested2properties
    schema_dict = self.resolve_nested_schema(field.schema)
  File "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/fields.py", line 591, in schema
    raise ValueError(
ValueError: `Nested` fields must be passed a `Schema`, not <class 'marshmallow.schema.SchemaMeta'>

其中global_search.py定义了以下模式:

class GlobalSearchArgsSchema(ma.Schema):
    """Schema for global search arguments."""

    phrase = ma.fields.String()


class MatchEntrySchema(ma.Schema):
    title = ma.fields.String()
    url = ma.fields.String()


class MachineMatchEntrySchema(MatchEntrySchema):
    title = ma.fields.String()
    url = ma.fields.String()
    serial_number = ma.fields.String()


class GlobalSearchResultSchema(ma.Schema):
    """Schema for global search response."""

    users = ma.fields.List(ma.fields.Nested(MatchEntrySchema))
    machines = ma.fields.List(ma.fields.Nested(MachineMatchEntrySchema))
    projects = ma.fields.List(ma.fields.Nested(MatchEntrySchema))
    customers = ma.fields.List(ma.fields.Nested(MatchEntrySchema))
    distributors = ma.fields.List(ma.fields.Nested(MatchEntrySchema))

GlobalSearchResultSchema嵌套之前定义的类型也是如此。由于我经历了这种不可预测的情况,我在想这是一种竞争条件吗?

有任何想法吗?

编辑(额外信息)

只是为了让一切变得更加诡异,我将以下几行内联调试代码添加到了抛出最终异常的 marshmallow fields.py 模块中 - 在 schema() 属性函数中(大约第 570 行):

    # WTF?
    from inspect import getmro, getfile
    print('Use inspect to probe nested subclasses:', SchemaABC in getmro(nested))
    for i in getmro(nested):
        if i == object:
            continue
        print('\n - Schema subclass is SchemaABC:', i==SchemaABC)
        print(' - Schena subclass name:        ', i)
        print(' - Schema subclass path:        ', getfile(i))
        print(' - Compare to SchemaABC:        ', SchemaABC)
        print(' - Compare to SchemaABC path:   ', getfile(SchemaABC))
    # End WTF?

当执行顺利时,这会产生以下输出:

Use inspect to probe nested subclasses: True

 - Schema subclass is SchemaABC: False
 - Schena subclass name:         <class 'UC_Search.api.global_search.MatchEntrySchema'>
 - Schema subclass path:         /srv/unicontrol/repos/cloud-api2/plugins/global-search/src/UC_Search/api/global_search.py
 - Compare to SchemaABC:         <class 'marshmallow.base.SchemaABC'>
 - Compare to SchemaABC path:    /srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/base.py

 - Schema subclass is SchemaABC: False
 - Schena subclass name:         <class 'marshmallow.schema.Schema'>
 - Schema subclass path:         /srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/schema.py
 - Compare to SchemaABC:         <class 'marshmallow.base.SchemaABC'>
 - Compare to SchemaABC path:    /srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/base.py

 - Schema subclass is SchemaABC: True
 - Schena subclass name:         <class 'marshmallow.base.SchemaABC'>
 - Schema subclass path:         /srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/base.py
 - Compare to SchemaABC:         <class 'marshmallow.base.SchemaABC'>
 - Compare to SchemaABC path:    /srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/base.py

当执行失败时:

Use inspect to probe nested subclasses: False

 - Schema subclass is SchemaABC: False
 - Schena subclass name:         <class 'UC_Search.api.global_search.MachineMatchEntrySchema'>
 - Schema subclass path:         /srv/unicontrol/repos/cloud-api2/plugins/global-search/src/UC_Search/api/global_search.py
 - Compare to SchemaABC:         <class 'marshmallow.base.SchemaABC'>
 - Compare to SchemaABC path:    /srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/base.py

 - Schema subclass is SchemaABC: False
 - Schena subclass name:         <class 'marshmallow.schema.Schema'>
 - Schema subclass path:         /srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/schema.py
 - Compare to SchemaABC:         <class 'marshmallow.base.SchemaABC'>
 - Compare to SchemaABC path:    /srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/base.py

 - Schema subclass is SchemaABC: False
 - Schena subclass name:         <class 'marshmallow.base.SchemaABC'>
 - Schema subclass path:         /srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/base.py
 - Compare to SchemaABC:         <class 'marshmallow.base.SchemaABC'>
 - Compare to SchemaABC path:    /srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/base.py

注意最后一个与 SchemaABC 的比较。Python 似乎看不到这些类是相同的,即使它们来自完全相同的模块文件。

更多线索

如果我运行 gunicorn 时只有一名工作人员探测文件打开,strace我会发现当它失败时有一个有趣的 python 行为。它加载了 field_converter 的字节编译和普通 python 版本:

openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow-3.13.0.dist-info", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow-3.13.0.dist-info", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/__init__.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/schema.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/base.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/fields.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/validate.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/types.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/exceptions.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/utils.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/warnings.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/class_registry.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/error_store.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/orderedset.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/decorators.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/ext/marshmallow/__pycache__/__init__.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/ext/marshmallow", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/ext/marshmallow/__pycache__/common.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/ext/marshmallow/__pycache__/openapi.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/ext/marshmallow/__pycache__/field_converter.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/ext/marshmallow/__pycache__/schema_resolver.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/__init__.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 10
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/base.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 10
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/class_registry.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 10
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/decorators.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 10
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/error_store.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 10
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/exceptions.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 10
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/fields.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 10
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/types.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 10
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/utils.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 10
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/validate.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 10
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/orderedset.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 10
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/schema.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 10
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/warnings.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 10
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/ext/marshmallow/field_converter.py", O_RDONLY|O_CLOEXEC) = 10

当它加载良好时它不会:

openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow-3.13.0.dist-info", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow-3.13.0.dist-info", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/__init__.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/schema.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/base.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/fields.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/validate.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/types.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/exceptions.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/utils.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/warnings.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/class_registry.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/error_store.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/orderedset.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/decorators.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/ext/marshmallow/__pycache__/__init__.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/ext/marshmallow", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/ext/marshmallow/__pycache__/common.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/ext/marshmallow/__pycache__/openapi.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/ext/marshmallow/__pycache__/field_converter.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/apispec/ext/marshmallow/__pycache__/schema_resolver.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 9
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/__init__.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 10
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/base.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 10
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/class_registry.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 10
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/decorators.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 10
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/error_store.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 10
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/exceptions.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 10
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/fields.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 10
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/types.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 10
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/utils.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 10
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/validate.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 10
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/orderedset.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 10
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/schema.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 10
openat(AT_FDCWD, "/srv/unicontrol/repos/cloud-api2/venv/lib/python3.9/site-packages/marshmallow/__pycache__/warnings.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 10
4

1 回答 1

0

事实证明,由于动态递归模块重新加载功能,我自己造成了这个问题。

如果有人处于加载字节编译版本和源版本的模块的相同情况下,那么您可能正在执行类似的智能模块加载(!太聪明了!)

于 2021-09-29T06:43:23.927 回答