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

it seems that the stdin of stream_cmd has no EOF #278

Open
pfctgeorge opened this issue Apr 13, 2018 · 1 comment
Open

it seems that the stdin of stream_cmd has no EOF #278

pfctgeorge opened this issue Apr 13, 2018 · 1 comment

Comments

@pfctgeorge
Copy link

pfctgeorge commented Apr 13, 2018

We have deployed a statsite and it has about 2000+ metrics per flush.
Today we found the executions of sinks/graphite.py never stopped and Graphite can't received any data.
So I added logs in script, and it shows that the for-loop which iterates sys.stdin never stops.

The following code seems like a fix:

while True:
        line = sys.stdin.readline()
        if line.strip() == "":
            break
        if len(graphite.metrics) >= METRICS_PER_FLUSH:
            graphite.send_metrics()
        graphite.append(line.strip())

    graphite.send_metrics()

Is there any situation that stdin for stream_cmd contains no EOF?

@pfctgeorge pfctgeorge changed the title it seems that stdin of stream_cmd has not EOF it seems that the stdin of stream_cmd has no EOF Apr 13, 2018
@johnkeates
Copy link
Contributor

I suppose the design was intended to keep streaming all the time and only stop if statsite itself was completely shut down. We should probably add this behind a configuration or flag so that people can select what they want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants