joa*_*nrb 5 amazon-dynamodb botocore python-3.7
OSError: [errno 14] Bad Address当我使用 pynamodb 模型时,我的 Python 服务器会产生随机数。这个问题发生在我的任何 pynamodb 模型中,并且很少发生。大多数呼叫都会成功。
当 botocore 从 file 读取时,会引发该错误/usr/local/lib/python3.7/site-packages/botocore/data/dynamodb/2012-08-10/service-2.json。我不知道为什么会发生这种情况以及为什么它是随机的。
我正在使用Python 3.7.3、Django 2.2.2、Pynamodb 3.3.3和Gunicorn 19.9.0。python:3.7-slim我正在由 Kubernetes 管理的Docker 基础上运行服务器。
例子:
>>> from pynamodb.models import Model
>>> class User(Model):
... hash = UnicodeAttribute(hash_key=True)
... username = UnicodeAttribute(null=True)
... class Meta:
... table_name = "user"
... read_capacity_units = 10
... write_capacity_units = 10
... region = "us-west-2"
...
>>> user = User.get("valid-user-id")
Traceback (most recent call last):
File "<input>", line 11, in <module>
user = User.get("valid-user-id")
File "pynamodb/models.py", line 485, in get
hash_key, range_key = cls._serialize_keys(hash_key, range_key)
File "pynamodb/models.py", line 1372, in _serialize_keys
hash_key = cls._hash_key_attribute().serialize(hash_key)
File "pynamodb/models.py", line 1219, in _hash_key_attribute
hash_keyname = cls._get_meta_data().hash_keyname
File "pynamodb/models.py", line 1262, in _get_meta_data
cls._meta_table = MetaTable(cls._get_connection().describe_table())
File "pynamodb/connection/table.py", line 263, in describe_table
return self.connection.describe_table(self.table_name)
File "pynamodb/connection/base.py", line 659, in describe_table
tbl = self.get_meta_table(table_name, refresh=True)
File "pynamodb/connection/base.py", line 504, in get_meta_table
data = self.dispatch(DESCRIBE_TABLE, operation_kwargs)
File "pynamodb/connection/base.py", line 313, in dispatch
data = self._make_api_call(operation_name, operation_kwargs)
File "pynamodb/connection/base.py", line 341, in _make_api_call
operation_model = self.client._service_model.operation_model(operation_name)
File "pynamodb/connection/base.py", line 492, in client
self._client = self.session.create_client(SERVICE_NAME, self.region, endpoint_url=self.host)
File "botocore/session.py", line 838, in create_client
client_config=config, api_version=api_version)
File "botocore/client.py", line 79, in create_client
service_model = self._load_service_model(service_name, api_version)
File "botocore/client.py", line 117, in _load_service_model
api_version=api_version)
File "botocore/loaders.py", line 132, in _wrapper
data = func(self, *args, **kwargs)
File "botocore/loaders.py", line 383, in load_service_model
model = self.load_data(full_path)
File "botocore/loaders.py", line 132, in _wrapper
data = func(self, *args, **kwargs)
File "botocore/loaders.py", line 420, in load_data
found = self.file_loader.load_file(possible_path)
File "botocore/loaders.py", line 173, in load_file
payload = fp.read().decode('utf-8')
OSError: [Errno 14] Bad address
Run Code Online (Sandbox Code Playgroud)
更新:
此特定问题是由于 Pod 中内存不足造成的。当我将我的服务器与Scout集成时,就会发生这种情况。除了这个问题之外,应用程序的其余部分工作正常,并且该错误并不表明存在内存问题。我提高了 Pod 中的内存后就修复了。
| 归档时间: |
|
| 查看次数: |
7535 次 |
| 最近记录: |