question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

writer is never closed

See original GitHub issue

Hi, https://github.com/lanpa/tensorboard-pytorch/blob/master/tensorboardX/record_writer.py self._writer = open(path, 'wb') is never closed

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

9reactions
NilsRethmeiercommented, May 10, 2018

@lanpa IMHO this should be fixed asap. This is a very serious issue. Opening 10 SummaryWriter creates close to 3k open files. Even after updating to tensorboardX==1.2.

def test_summary_writer_close():
    # Opening and closing SummaryWriter a lot should not run into
    # OSError: [Errno 24] Too many open files
    passed = True
    try:
        for i in range(10):
            writer = SummaryWriter()
            writer.file_writer.flush()
            writer.file_writer.close()
            writer._record_writer
            del writer
            gc.collect()
    except OSError:
        passed = False

    assert passed
test_summary_writer_close()
lsof | grep ' yourusername ' | awk '{print $NF}' | sort | wc -l

the .close() method has no effect.

6reactions
hangg7commented, Aug 10, 2018

Any updates on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resource leak: 'in' is never closed - java - Stack Overflow
@Borat - "resource leak" implies that some system resource (usually memory) is being lost or wasted needlessly. Usually this will impact you ...
Read more >
Help with Warning: Resource leak: 'input' is never closed
I keep getting the warning that : Resource leak: 'input' is never closed I have never got ... Is there a right and...
Read more >
Resource leaks in Java: FileWriter not closing issue
By putting it all in a try-catch block, the catch list (shown below) would cause the warning message “Resource leak: 'FileWriter' is not...
Read more >
What is this error in Java, “resource leak: 'keyboard' is never ...
The IDE is trying to warm you that the the scanner object that was created, if kept without closing, will lead to resource...
Read more >
561589 – Unexpected "Resource leak is never closed" warnings
Bug 561589 - Unexpected "Resource leak is never closed" warnings ... (unrelated to the reader and writer), eg. the last for loop, the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found