This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author yateenjoshi
Recipients yateenjoshi
Date 2010-01-10.10:58:25
SpamBayes Score 1.6537616e-10
Marked as misclassified No
Message-id <1263121111.41.0.440295567357.issue7664@psf.upfronthosting.co.za>
In-reply-to
Content
I am running an in house application that uses multiprocessing logger. 
This application ftp's files from a remote host and keep them on a local
disk. Here is the scenario - 
While pulling the files, I make the local disk full (100%). The application hangs, it can not log further. Apart from other exceptions, following are prominent ones. If I further create cleanup the disk, the application does not proceed. It 
remains hung. I have to restart the application. 

  File "/export/home/yateen/ess/3rdparty/python/solaris/lib/python2.6/logging/__init__.py", line 1059, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/export/home/yateen/ess/3rdparty/python/solaris/lib/python2.6/logging/__init__.py", line 1141, in _log
    self.handle(record)
  File "/export/home/yateen/ess/3rdparty/python/solaris/lib/python2.6/logging/__init__.py", line 1151, in handle
    self.callHandlers(record)
  File "/export/home/yateen/ess/3rdparty/python/solaris/lib/python2.6/logging/__init__.py", line 1188, in callHandlers
    hdlr.handle(record)
  File "/export/home/yateen/ess/3rdparty/python/solaris/lib/python2.6/logging/__init__.py", line 671, in handle
    self.release()
  File "build/bdist.solaris-2.10-sun4u/egg/cloghandler.py", line 189, in release
    self.stream.flush()


I tried looking into the logging module's code and could not find IOError exception handling there. After going through
various situations, and trial-errors (I am not a python Guru), I found following fix working - 
method handle(record), file logging/__init__.py, line#670
original code - 
        rv = self.filter(record)
        if rv:
            self.acquire()
            try:
                self.emit(record)
            finally:
                self.release()
                             
        return rv

Modified code - 
        rv = self.filter(record)
        if rv:
            self.acquire()
            try:
                self.emit(record)
            finally:
                try:
                  self.release()
                except (IOError, OSError):
                  pass
        return rv

What this tells is if there is an error in locks handling, simply leave it and proceed. With this fix, when the disk is 
cleaned up, application proceeds properly. 

What I want to know if this is an appropriate fix? Can I go ahead with it?

Thanks,
Yateen..
History
Date User Action Args
2010-01-10 10:58:32yateenjoshisetrecipients: + yateenjoshi
2010-01-10 10:58:31yateenjoshisetmessageid: <1263121111.41.0.440295567357.issue7664@psf.upfronthosting.co.za>
2010-01-10 10:58:29yateenjoshilinkissue7664 messages
2010-01-10 10:58:26yateenjoshicreate