faust-streaming / faust

Python Stream Processing. A Faust fork
https://faust-streaming.github.io/faust/
Other
1.57k stars 177 forks source link

aiokafka create topic error > 0.10.0 #633

Closed MarkCWirt closed 2 weeks ago

MarkCWirt commented 1 month ago

Checklist

(this has been addressed in master, but there may still be an issue)

Steps to reproduce

Tell us what you did to cause something to happen.

When trying to run a Faust application running Faust against aiokafka 0.11.0, a stackstrace is thrown.

Note I don't know if this is relevent, but the issue onlu cropped up when I included a agent with a timer, ie

@timer_app.timer(interval=TIMER_INTERVAL_SECONDS)
async def send_alert_timer():
    """
    Check for the existence of new reminders periodically.
    """

    if RESOLUTION == "hour":
        now = datetime.datetime.utcnow().replace(minute=0, second=0, microsecond=0).isoformat()
    elif RESOLUTION == "day":
        now = datetime.datetime.utcnow().replace(hour=0, minute=0, second=0, microsecond=0).isoformat()

    etc.

Before creating that end-point I did not experience the error.

Expected behavior

Tell us what you expected to happen.

I expected the application to run.

Actual behavior

Tell us what happened instead.

Full traceback

    await self.declare()
  File "/Users/mwirt/.virtualenvs/test/lib/python3.10/site-packages/faust/topics.py", line 498, in declare
    await producer.create_topic(
  File "/Users/mwirt/.virtualenvs/test/lib/python3.10/site-packages/faust/transport/drivers/aiokafka.py", line 1275, in create_topic
    await cast(Transport, self.transport)._create_topic(
  File "/Users/mwirt/.virtualenvs/test/lib/python3.10/site-packages/faust/transport/drivers/aiokafka.py", line 1490, in _create_topic
    await wrap()
  File "/Users/mwirt/.virtualenvs/test/lib/python3.10/site-packages/mode/utils/futures.py", line 58, in __call__
    result = await self.fun(*self.args, **self.kwargs)
  File "/Users/mwirt/.virtualenvs/test/lib/python3.10/site-packages/faust/transport/drivers/aiokafka.py", line 1557, in _really_create_topic
    wait_result = await owner.wait(
  File "/Users/mwirt/.virtualenvs/test/lib/python3.10/site-packages/mode/services.py", line 740, in wait
    return await self._wait_one(coros[0], timeout=timeout)
  File "/Users/mwirt/.virtualenvs/test/lib/python3.10/site-packages/mode/services.py", line 809, in _wait_one
    results = await self.wait_first(coro, timeout=timeout)
  File "/Users/mwirt/.virtualenvs/test/lib/python3.10/site-packages/mode/services.py", line 787, in wait_first
    f.result()  # propagate exceptions
  File "/Users/mwirt/.virtualenvs/test/lib/python3.10/site-packages/aiokafka/client.py", line 516, in send
    future = self._conns[(node_id, group)].send(
  File "/Users/mwirt/.virtualenvs/test/lib/python3.10/site-packages/aiokafka/conn.py", line 461, in send
    header = request.build_request_header(
  AttributeError: 'CreateTopicsRequest_v1' object has no attribute 'build_request_header'

Important note

This was addressed in a recent pull reuqest (merged three days ago). The traceback changed, but it is still throwing an error:


... same until 1490...
...

 File "/Users/mwirt/git/OPC/faust/faust/transport/drivers/aiokafka.py", line 1490, in _create_topic
    await wrap()
  File "/Users/mwirt/.virtualenvs/test/lib/python3.10/site-packages/mode/utils/futures.py", line 58, in __call__
    result = await self.fun(*self.args, **self.kwargs)
  File "/Users/mwirt/git/OPC/faust/faust/transport/drivers/aiokafka.py", line 1566, in _really_create_topic
    assert len(response.topic_error_codes), "single topic"
AttributeError: 'CreateTopicsResponse_v1' object has no attribute 'topic_error_codes'

Versions

By the way, constraining aiokafka makes the issue go away

aiokafka>=0.9.0,<0.11.0
harrystuart commented 1 month ago

Downgrade worked for me also - thanks for saving me potentially a lot of time.

zevisert commented 1 month ago

Appearing on stackoverflow as well: https://stackoverflow.com/questions/78730446/faust-streaming-error-in-hello-world-demo-code-object-has-no-attribute-build-r/78747295#78747295

dada-engineer commented 1 month ago

@wbarnha when is the fix in the merge request released? This is crucial

wbarnha commented 1 month ago

@wbarnha when is the fix in the merge request released? This is crucial

My goal is to get it out ASAP, the problem is that I need to decide what should be done about aredis. I may just allow tests for Python 3.12 to fail in the meantime and publish a release.

Edit: You know what? Let's just do that.

wbarnha commented 1 month ago

Just created a release, should be available to you shortly!

cristianmatache commented 1 month ago

Just a reminder @wbarnha, this issue should be reopened because faust errors further dowm with AttributeError: 'CreateTopicsResponse_v1' object has no attribute 'topic_error_codes' as @MarkCWirt pointed in the update above.

wbarnha commented 1 month ago

Well, that's unfortunate. I'll look further into it.

cristianmatache commented 1 month ago

Renaming to topic_errors will do @wbarnha