sebst / python-progressbar

Automatically exported from code.google.com/p/python-progressbar
Other
0 stars 1 forks source link

Progressbar signal handler for SIGWINCH causes system calls to be interrupted #30

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Install the latest version of euca2ools 3.0.0 available here: 
https://github.com/eucalyptus/euca2ools/tree/requestbuilder
2. Use the euca-bundle-vol tool (which uses progressbar)
3. Attempt to resize the terminal window during tarball bundling

What is the expected output? What do you see instead?

I expect to see the progressbar resized properly, but instead an IOError 
exception is raised with EINTR, since the write system call is being 
interrupted by the signal handler for SIGWINCH.

Here's the exception output below:

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done 

tune2fs 1.42.3 (14-May-2012)
  done
Syncing volume contents...  done
euca-bundle-vol: error: Interrupted system call                                 
Exception in thread Thread-2:                     | 718.55 MB  35.40 MB/s ETA:  
Traceback (most recent call last):
  File "/usr/lib64/python2.7/threading.py", line 551, in __bootstrap_inner
    self.run()
  File "/usr/lib64/python2.7/threading.py", line 504, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib/python2.7/site-packages/euca2ools-3.0.0_alpha6-py2.7.egg/euca2ools/commands/bundle/bundle.py", line 187, in _add_fileobj_to_tarball
    tarball.close()
  File "/usr/lib64/python2.7/tarfile.py", line 1776, in close
    self.fileobj.write(NUL * (BLOCKSIZE * 2))
  File "/usr/lib64/python2.7/tarfile.py", line 471, in write
    self.__write(s)
  File "/usr/lib64/python2.7/tarfile.py", line 479, in __write
    self.fileobj.write(self.buf[:self.bufsize])
IOError: [Errno 32] Broken pipe

Exception IOError: (32, 'Broken pipe') in <bound method _Stream.__del__ of 
<tarfile._Stream instance at 0x29673f8>> ignored
Bundling image 100% |======================|  10.00 GB 503.30 MB/s Time: 0:00:21
euca-bundle-vol: error: 
[root@i euca2ools]# 

What version of the product are you using? On what operating system?

I'm using progressbar 0.9.8 on CentOS 6.4

Please provide any additional information below.

I've attached a patch that fixes the issue. After installing the signal 
handler, progressbar should then set the SA_RESTART flag so that system calls 
are restarted after the signal handler executes.

Original issue reported on code.google.com by mspauldi...@gmail.com on 16 May 2013 at 4:46

Attachments:

GoogleCodeExporter commented 9 years ago
The version I mentioned in the ticket is actually wrong. I'm using progressbar 
2.3.

Original comment by mspauldi...@gmail.com on 16 May 2013 at 5:00

GoogleCodeExporter commented 9 years ago
This affects me as well. Is there a problem with the patch?

Original comment by andrefcruz on 22 Jan 2014 at 10:43