dpkp / dpkp/kafka-python

Failures in struct packing should fail and not hang forever

Open
#1,319 2 comments 0 reactions 0 assignees View on GitHub
network protocol
Dominant language
Python
Stars
5.9k
Forks
1.5k
Avg merge
3d 11h
Merged PRs (30d)
3

Description

If we try to build a struct using incorrect types, then `_pack()` is correctly raising an error. However, the foreground thread just hangs when this happens.

This doesn't make sense to me--it's a client side error, so we should be able to fail loudly to the user. The error may be slightly cryptic because all the struct knows is that something is incorrect, it has no idea of the broader context. But at least it'd give the user something to go on...

This behavior may also apply to `_unpack()`.

To reproduce, in `_pack()`, manually insert a conditional that flips a type:

def _pack(f, value):
try:
if isinstance(value, int):
value = str(value)
return pack(f, value)
except error:
raise ValueError(error)

See also #1318

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.