_ssl.pyd is buggy?

Larry Bates larry.bates at websafe.com
Tue Feb 13 11:19:52 EST 2007


Laszlo Nagy wrote:
> 
>  Hello,
> 
> I wrote a small program that uses xmlrpc over https. It should work as a
> win32 application and as a win32 service too. There is a file called
> Processor.py that contains the main thread of the program. It is called
> from two files: win32_Application.py  and win32_Service.py. The
> application works perfectly. The service does not. I can start it from
> the services mmc console, but it does not created logfiles, and does
> nothing. It cannot be stopped and I have to kill pythonservice.exe. The
> event log shows this:
> 
> 
> Information: The AmazonOfferDownloaderService service has started.
> Application error: Faulty application: python.exe, version: 0.0.0.0,
> faulty modul: _ssl.pyd, version: 0.0.0.0, memory address: 0x00019b87.
> 
> Is it possible that my _ssl.pyd is faulty? Please help me.
> 
> Python version: 2.4.3 (#69, Mar 29 2006)
> Windows version: Windows XP Professional, service pack 2, Hungarian (I
> translated the above messages from the event log....)
> 
> Thanks,
> 
>   Laszlo
> 
> 
>>>> Here is the code for the application:
> 
> import thread,threading,time
> 
> from Processor import *
> from servicelog import *
> from win32_Config import *
> 
> stopped = threading.Event()
> stopped.clear()
> processor = Processor(stopped)
> thread.start_new_thread(processor.Process,())
> logger = getLogger('win32_Application')
> logger.info("Staring as application. Please press CTRL+C to stop service.")
> while 1:
>    try:
>        time.sleep(1)
>    except:
>        break
> logger.info("Stopping application " + SERVICE_NAME)
> stopped.set()
> while not processor.stopped.isSet():
>    logger.debug("Waiting for the processor to finish...")
>    time.sleep(1)
> 
> logger.info("Application stopped.")
> 
>>>> Here is the code for the service:
> 
> from win32_Config import *
> from Processor import *
> from servicelog import *
> 
> import win32serviceutil, win32service
> import pywintypes, win32con, winerror
> from win32event import *
> from win32file import *
> from win32pipe import *
> from win32api import *
> from ntsecuritycon import *
> 
> import traceback
> import thread,threading
> 
> class Service(win32serviceutil.ServiceFramework):
>    _svc_name_ = SERVICE_NAME
>    _svc_display_name_ = SERVICE_DISPLAY
>    def __init__(self, args):
>        win32serviceutil.ServiceFramework.__init__(self, args)
>        self.stopped = threading.Event()
>        self.stopped.clear()
>        self.logger = getLogger(SERVICE_NAME)
> 
>    def SvcStop(self):
>        self.logger.info("Got SvcStop, trying to stop service...")
>        self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
>        self.stopped.set()
> 
>    def SvcDoRun(self):
>        """Write an event log record - in debug mode we will also see
> this message printed."""
>        try:
>            import servicemanager
>            servicemanager.LogMsg(
>                    servicemanager.EVENTLOG_INFORMATION_TYPE,
>                    servicemanager.PYS_SERVICE_STARTED,
>                    (self._svc_name_, '')
>                    )
>            self.logger.info("Started.")
>            self.logger.debug("Creating processor instance")
>            processor = Processor(self.stopped)
>            self.logger.debug("Starting processor thread")
>            thread.start_new_thread(processor.Process,())
>            self.logger.debug("Waiting for the processor thread to finish")
>            self.stopped.wait()
>            self.logger.debug("Stopping")
>            time.sleep(1)
>            while not processor.stopped.isSet():
>               
> self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING, 5000)
>                time.sleep(5)
>            servicemanager.LogMsg(
>                    servicemanager.EVENTLOG_INFORMATION_TYPE,
>                    servicemanager.PYS_SERVICE_STOPPED,
>                    (self._svc_name_, "")
>                    )
>            self.logger.info("Stopped")
>        except:
>            self.logger.error('',exc_info = sys.exc_info())
> 
> 
> if __name__=='__main__':
>    win32serviceutil.HandleCommandLine(Service)
> 
> 

I was using _ssl.pyd to upload files to DAV server over ssl and
found it to be a problem.  I upgraded to Python 2.5 and the problem
was fixed.  I don't know if it is the same problem that is affecting
you, but I couldn't get it to work on 2.4.

FYI, Larry



More information about the Python-list mailing list