wotwot / parallel-ssh

Automatically exported from code.google.com/p/parallel-ssh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ValueError: I/O operation on closed file

GoogleCodeExporter opened this issue · comments

What steps will reproduce the problem?
1.Create a pssh command from bash and trigger from a bash.
ex: 
 sudo /usr/bin/pssh -h logs/apprunner_status/XX_pssh.txt -OStrictHostKeyChecking=no -OIdentityFile=/home/XX/.ssh/id_rsa.open -l XX -o /tmp/pssh -e /tmp/pssh -p 128 -t 10 "uptime" **********************

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/usr/local/lib/python2.7/site-packages/psshlib/manager.py", line 310, in run
    dest.write(data)
ValueError: I/O operation on closed file


What is the expected output? What do you see instead?
It should not throw ValueError exception.

What version of the product are you using? On what operating system?
pssh 2.3.1 compiled from source.
$ pssh --version
2.3.1


Please provide any additional information below.
Noticed in /usr/local/lib/python2.7/site-packages/psshlib/manager.py +305 there 
a file is required to open, but it is done on if condition forgot on else. 
However, I have fixed manually.
Thanks for your support.

Original issue reported on code.google.com by rajesh.j...@gmail.com on 27 Sep 2012 at 1:57

It looks like this bug may be a bit hard to reproduce. Can you think of 
anything else that's unique about your setup that might help me reproduce this? 
 Also, does this exception happen every time for you, or does it only happen 
occasionally? Finally, what version of Python are you running? Thanks for your 
help in tracking this down.

Original comment by amcna...@gmail.com on 27 Sep 2012 at 3:15

  • Changed title: ValueError: I/O operation on closed file
  • Added labels: ****
  • Removed labels: ****
I am also receiving this error on both pssh and prsync - both version 2.3.1.  
It only happens occasionally - the same command will sometimes generate the 
error and other times run with no error.  I am running Python 2.6.6 on CentOS 
6.4.  The exact error I'm receiving is below.  Please let me know if there is 
any more information that I can provide to help narrow it down.  Thanks.

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib64/python2.6/threading.py", line 532, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.6/site-packages/psshlib/manager.py", line 309, in run
    dest.write(data)
ValueError: I/O operation on closed file

Original comment by ryan.bro...@gmail.com on 26 Jun 2013 at 1:40

  • Added labels: ****
  • Removed labels: ****
I just wanted to check if there was any update on this issue.  I'm still 
receiving the error "I/O operation on closed file" occasionally when running 
prsync.  Please let me know what information I can provide to help resolve it.  
Thanks.

Original comment by ryan.bro...@gmail.com on 2 Apr 2014 at 9:28

  • Added labels: ****
  • Removed labels: ****
Hi

I made a hand fix to overcome this issue and created separate RPM for my
company

/usr/lib/python2.7/site-packages/psshlib/manager.py at 300 around like below

            self.files[filename] = open(filename, 'wb', buffering=1)
            if data == self.OPEN:
                psshutil.set_cloexec(self.files[filename])
            else:
                dest = self.files[filename]
                if data == self.EOF:
                    dest.close()
                else:


                    dest.write(data)

Original comment by rajesh.j...@gmail.com on 3 Apr 2014 at 5:30

  • Added labels: ****
  • Removed labels: ****