Skip to content

Getting random file already closed error #738

Closed

Description

@v-pratap

Describe the bug
We have deployed the continuous streaming of stdout and stderr in external once probe mode. In few deployments we are getting a lot of errors :

Error reading from stderr: read |0: file already closed
Error reading from stdout: read |0: file already closed

The error doesn't follow any time pattern.
Screenshot 2024-05-03 at 4 21 53 PM

The cloudprober configuration is :

  {{ $workload_name := "TEST-00"}}
  probe {
    name: "{{$workload_name}}"
    type: EXTERNAL
    targets { dummy_targets {} }
    external_probe {
      mode: ONCE
      command: "......."
    interval_msec: 60000
    timeout_msec:  60000
  }

The average time to complete the command execution is around 1000 msec.

Cloudprober Version
Latest version.

To Reproduce
We are getting this error very frequently with above cloudprober configuration.

Additional Context
Also I want to understand when will this error logged, once the command execution completes and it closes its stdout and stderr?

Activity

  1. added
    bug
    on May 3, 2024
  2. manugarg commented on May 3, 2024

    @manugarg
    Contributor

    @v-pratap Are you running the latest code? This error was fixed in:
    2b2695e

  3. v-pratap commented on May 3, 2024

    @v-pratap
    ContributorAuthor

    Hi @manugarg,
    Yes I am using the latest code :
    Screenshot 2024-05-03 at 11 00 30 PM

  4. manugarg commented on May 3, 2024

    @manugarg
    Contributor

    Can you post the full error message. It will have the code line logging this.

  5. v-pratap commented on May 3, 2024

    @v-pratap
    ContributorAuthor

    There is nothing else than that :
    Screenshot 2024-05-03 at 11 17 52 PM

  6. manugarg commented on May 3, 2024

    @manugarg
    Contributor

    That's weird. GCP log entry should be complete. We even have a test for it:

    Payload: "level=INFO source=logger/logger_test.go:432 msg=\"test message\" system=cloudprober dst=gcp\n",

    I don't have access to any GCP account right now, but can you please use some other interface (kubectl logs, docker logs) to access stderr logs. You can try running it locally also if you've access.

  7. manugarg commented on May 3, 2024

    @manugarg
    Contributor

    Oh if you're using BBMC setup, logs can be either in /tmp/cloudprober.* files or journalctl.

    Also, in your first screenshot, I see errors coming from different locations. If you limit to one location, you'll see a more useful pattern.

  8. changed the title [-]Getting lots of file already closed error[/-] [+]Getting random file already closed error[/+] on May 4, 2024
  9. manugarg commented on May 4, 2024

    @manugarg
    Contributor

    I could reproduce it after running the probe for a while. I got it approximately once in 7-10 attempts. This is more of a random log line, caused by pipe reading failing in different places when external process exits.

    #739 should fix it.

  10. added this to the v0.13.5 milestone on May 4, 2024
  11. v-pratap commented on May 4, 2024

    @v-pratap
    ContributorAuthor

    Thanks @manugarg for the quick response and resolving this issue.
    Yes, we are using bbmc configurations. I think the problem is resolved now but if you need any further details or logs then please let me know. I will be happy to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions