Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Consumer failed after 48 hours #1526

Closed
ajhunyady opened this issue Aug 28, 2021 · 2 comments
Closed

[Bug]: Consumer failed after 48 hours #1526

ajhunyady opened this issue Aug 28, 2021 · 2 comments
Assignees
Labels
bug Something isn't working Client
Milestone

Comments

@ajhunyady
Copy link
Contributor

ajhunyady commented Aug 28, 2021

I received the following connection error:

received: 607
received: 607
Traceback (most recent call last):
  File "slack-message.py", line 35, in <module>
    main()
  File "slack-message.py", line 32, in main
    consume()
  File "slack-message.py", line 20, in consume
    for i in consumer.stream(Offset.from_end(50)):
  File "/home/ubuntu/.local/lib/python3.8/site-packages/fluvio/__init__.py", line 109, in __next__
    return Record(self._inner.next())
_fluvio_python.Error: Fluvio socket error
Caused by:
Socket closed

The script reads from fluvio and sends message to slack:

import requests
from fluvio import (Fluvio, Offset)

def send_slack_message(message):
    payload = '{"text": "%s"}' % message
    response = requests.post("https://hooks.slack.com/services/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",
            data=payload)

    print(response.text)

def consume():
    value = "0"

    fluvio = Fluvio.connect()
    print("connected to fluvio")

    consumer = fluvio.partition_consumer("fluvio-stars", 0)
    print("retrieved consumer")

    for i in consumer.stream(Offset.from_end(1)):
        received = i.value_string()
        print("received: %s" % received)

        if value == "":
            value = received
        elif value != received:
            value = received
            send_slack_message(value)


def main():
    consume()

if __name__ == "__main__":
    main()
@ajhunyady ajhunyady added the bug Something isn't working label Aug 28, 2021
@sehz sehz added this to the 0.9.5 milestone Aug 29, 2021
@sehz sehz self-assigned this Aug 29, 2021
@tjtelan tjtelan assigned tjtelan and unassigned sehz Aug 30, 2021
@tjtelan tjtelan modified the milestones: 0.9.5, 0.9.6 Sep 2, 2021
@tjtelan
Copy link
Contributor

tjtelan commented Sep 7, 2021

The theory is this issue is a side-effect of #1519. The assumption is that both the producer and consumer were running on the same host. And as the producer used up all of the TCP resources, eventually we would see failure in the consumer.

I was able to set up and run some lightly modified example code, which ran concurrently with code from #1519. Both have been running for more than 48 hours

#!/usr/bin/env python3

import requests
import time
from fluvio import (Fluvio, Offset)

def send_slack_message(message):
    payload = '{"text": "%s"}' % message
    #endpoint = "https://hooks.slack.com/services/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"
    endpoint = "https://ptsv2.com/t/op9bn-1630810794/post"
    response = requests.post(endpoint,
            data=payload)

    print(response.text)

def consume():
    value = "0"

    fluvio = Fluvio.connect()
    print("connected to fluvio")

    consumer = fluvio.partition_consumer("fluvio-stars", 0)
    print("retrieved consumer")

    for i in consumer.stream(Offset.from_end(1)):
        received = i.value_string()
        print("received: %s" % received)

        if value == "":
            value = received
        elif value != received:
            value = received
            send_slack_message(value)

        time.sleep(1)


def main():
    consume()

if __name__ == "__main__":
    main()

@tjtelan tjtelan modified the milestones: 0.9.6, 0.9.7 Sep 7, 2021
@sehz sehz modified the milestones: 0.9.6, 0.9.7 Sep 10, 2021
@nacardin nacardin modified the milestones: 0.9.7, 0.9.8 Sep 15, 2021
@tjtelan
Copy link
Contributor

tjtelan commented Sep 23, 2021

Closing this as a duplicate. The root cause of this issue is tracked by #770 and is a high priority. The client should try to re-connect when the socket closes (like for network-stability reasons)

Let's create a new issue if we see this behavior after #770 is fixed.

@tjtelan tjtelan closed this as completed Sep 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Client
Projects
None yet
Development

No branches or pull requests

4 participants