amazon-dynamodb - Botocore 引发 OSError: [errno 14] 错误地址
问题描述
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
更新:
此特定问题是由于 pod 内存不足。当我将我的服务器与Scout集成时会发生这种情况。除此问题外,该应用程序的其余部分工作正常,并且该错误并未表明内存问题。在我提高吊舱中的内存后,它被修复了。
解决方案
推荐阅读
- javascript - 正则表达式从 css 中删除 @font-face 规则
- javascript - 如何在javascript中获取鼠标位置?
- graphql - 无法将自定义结果从解析器传递到 Graphql
- django - django - 如何获取团队的所有项目?
- javascript - PhaserJS 3.0 如何将图像放置在屏幕右下方?
- reactjs - InvalidValueError:setMap:不是 Map 的实例;而不是 StreetViewPanorama @react-google-maps/api 的实例
- r - 将具有许多块的字符串向量转换为具有标头的数据帧
- swift - 如何使 SKSpritenode 移动到 swift SpriteKit 中的触摸位置
- c++ - 为什么我的代码在执行时的初始嵌套 for 循环中进入无限循环?
- linux - 如何在 vi 编辑器 linux 中删除新行?