WinService & ServiceStartup

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

WinService & ServiceStartup

Steve Whitson
Hi,

Would anybody have any insight as to what WinServiceInterface expects as a shutdown block?  The latest version of ServiceStartup in the public repository is out of sync with the latest WinService.  Specifically

Startup>>startAsService: shutdownBlock:
calls WinServiceInterface>>startDispatcherWithHandler:serviceName:startupBlock:
this changed to WinServiceInterface>>startDispatcherWithEventHandler:serviceName:startupBlock

The first parameter to this call is  the shutdown block retained to use in shutting down the service when requested.

With this change made in the ServiceStartup package I can install the service, start the service and all is well.  But, when I got to stop the service it errors.  I found that the method Startup>>serviceShutdownBlock: also needed a change to this shutdown block it returns to accept 3 parameters.  But, I cannot figure out how to properly exit from this block.

I've tried it as it is in the repository, but with 3 parameters (the 1st parameter is the same in the older WinServiceInterface use of this block as it is in the newer use of it).  The Win7 service console doesn't actually kill the image, but our code does do it's socket free operations and stops all its activity, so things are happening as expected, just no image exit.

I've added in an ObjectMemory quit, and ObjectMemroy quitWithError: 0, but both cause the service console (when stopping the service) to think the process terminated unexpectedly...

Does anyone have an updated copy of ServiceStartup by chance, one that matches the API updates to WinService made last month (Sept 9, 2011)?  I'm doing this in VW 7.7.1.

Any help here would be greatly appreciated!
    -Steve

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: WinService & ServiceStartup

Steven Kelly

Hi Steve,

 

The WinService 1.1.0 version comment says:

 

Important:

The WinServiceInterface API has changed. Contrary to earlier versions (1.0.x) of this package, the handler block must

- quit the image after stop/shutdown events are handled

- return an error code (usually NO_ERROR)

 

The latest ServiceStartup is based on WinService 1.0.10, and has worked well for us. The roots of both packages are in COAST, but IIRC COAST code for this has evolved quite a bit, so I’m not sure whether looking at current code elsewhere in COAST will be useful or just even more confusing.

 

Unfortunately, there have been about 360 changes to WinService from 1.0.10 to 1.3 – quite a lot for a package which had just one class! This makes it rather difficult to see what needs updating in ServiceStartup. However, from the version comments it looks like most of the changes are just refactoring or moving things to different namespaces. Relatively few seem to be actual bug corrections, so if 1.0.10 works for you, sticking with that might be an option. I’m sure Holger’s refactorings and bug corrections are good, I just haven’t had the time or need to keep ServiceStartup up to date with them.

 

Hopefully Holger can answer your question as to the right way to use the shutdown block these days. Feel free to update ServiceStartup if you get something working.

 

All the best,

Steve

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Steve Whitson
Sent: 28. lokakuuta 2011 23:50
To: [hidden email]
Subject: [vwnc] WinService & ServiceStartup

 

Hi,

Would anybody have any insight as to what WinServiceInterface expects as a shutdown block?  The latest version of ServiceStartup in the public repository is out of sync with the latest WinService.  Specifically

Startup>>startAsService: shutdownBlock:
calls WinServiceInterface>>startDispatcherWithHandler:serviceName:startupBlock:
this changed to WinServiceInterface>>startDispatcherWithEventHandler:serviceName:startupBlock

The first parameter to this call is  the shutdown block retained to use in shutting down the service when requested.

With this change made in the ServiceStartup package I can install the service, start the service and all is well.  But, when I got to stop the service it errors.  I found that the method Startup>>serviceShutdownBlock: also needed a change to this shutdown block it returns to accept 3 parameters.  But, I cannot figure out how to properly exit from this block.

I've tried it as it is in the repository, but with 3 parameters (the 1st parameter is the same in the older WinServiceInterface use of this block as it is in the newer use of it).  The Win7 service console doesn't actually kill the image, but our code does do it's socket free operations and stops all its activity, so things are happening as expected, just no image exit.

I've added in an ObjectMemory quit, and ObjectMemroy quitWithError: 0, but both cause the service console (when stopping the service) to think the process terminated unexpectedly...

Does anyone have an updated copy of ServiceStartup by chance, one that matches the API updates to WinService made last month (Sept 9, 2011)?  I'm doing this in VW 7.7.1.

Any help here would be greatly appreciated!
    -Steve


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: WinService & ServiceStartup

Steve Whitson
Thanks Steve for your response.

I did come across the Important comment. 

I tried to add an ObjectMemory quit and also quitWithError: 0 but neither seems to help, the win7 service panel responded that "The process terminated unexpectedly".  Other things I tried with quitting the image was to fork the ObjectMemory quit, and add a delay of 1 to 3 seconds... when 1 second it stated the process terminated unexpectedly, when 3 seconds it didn't think it quit, but the image actually had. 

I also did add in the 'WinServiceInterface current NO_ERROR' return from the block too (NO_ERROR is defined as 0)... but that too didn't work either. Without the ObjectMemory quit the image just kept running (the inner processing our code does did stops the right doRelease method was called, but the image kept going).

I appreciate your help,
    -Steve

On 10/29/2011 11:59 AM, Steven Kelly wrote:

Hi Steve,

 

The WinService 1.1.0 version comment says:

 

Important:

The WinServiceInterface API has changed. Contrary to earlier versions (1.0.x) of this package, the handler block must

- quit the image after stop/shutdown events are handled

- return an error code (usually NO_ERROR)

 

The latest ServiceStartup is based on WinService 1.0.10, and has worked well for us. The roots of both packages are in COAST, but IIRC COAST code for this has evolved quite a bit, so I’m not sure whether looking at current code elsewhere in COAST will be useful or just even more confusing.

 

Unfortunately, there have been about 360 changes to WinService from 1.0.10 to 1.3 – quite a lot for a package which had just one class! This makes it rather difficult to see what needs updating in ServiceStartup. However, from the version comments it looks like most of the changes are just refactoring or moving things to different namespaces. Relatively few seem to be actual bug corrections, so if 1.0.10 works for you, sticking with that might be an option. I’m sure Holger’s refactorings and bug corrections are good, I just haven’t had the time or need to keep ServiceStartup up to date with them.

 

Hopefully Holger can answer your question as to the right way to use the shutdown block these days. Feel free to update ServiceStartup if you get something working.

 

All the best,

Steve

 

 

From: [hidden email] [[hidden email]] On Behalf Of Steve Whitson
Sent: 28. lokakuuta 2011 23:50
To: [hidden email]
Subject: [vwnc] WinService & ServiceStartup

 

Hi,

Would anybody have any insight as to what WinServiceInterface expects as a shutdown block?  The latest version of ServiceStartup in the public repository is out of sync with the latest WinService.  Specifically

Startup>>startAsService: shutdownBlock:
calls WinServiceInterface>>startDispatcherWithHandler:serviceName:startupBlock:
this changed to WinServiceInterface>>startDispatcherWithEventHandler:serviceName:startupBlock

The first parameter to this call is  the shutdown block retained to use in shutting down the service when requested.

With this change made in the ServiceStartup package I can install the service, start the service and all is well.  But, when I got to stop the service it errors.  I found that the method Startup>>serviceShutdownBlock: also needed a change to this shutdown block it returns to accept 3 parameters.  But, I cannot figure out how to properly exit from this block.

I've tried it as it is in the repository, but with 3 parameters (the 1st parameter is the same in the older WinServiceInterface use of this block as it is in the newer use of it).  The Win7 service console doesn't actually kill the image, but our code does do it's socket free operations and stops all its activity, so things are happening as expected, just no image exit.

I've added in an ObjectMemory quit, and ObjectMemroy quitWithError: 0, but both cause the service console (when stopping the service) to think the process terminated unexpectedly...

Does anyone have an updated copy of ServiceStartup by chance, one that matches the API updates to WinService made last month (Sept 9, 2011)?  I'm doing this in VW 7.7.1.

Any help here would be greatly appreciated!
    -Steve



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: WinService & ServiceStartup

Steve Whitson
I was able to get things to work on Xp & Win7 in vw7.7.1 with what I'd say is somewhat of a hack... I changed Startup>>serviceShutdownBlock:.

Here's my ifTrue: block now
| tickerProcess |
self log: 'Received service event: ' , event printString.
tickerProcess := serviceInterface forkShutdownPendingTickerProcess.
[ aBlock value ] ensure: [ tickerProcess terminate ].
serviceInterface setServiceStoppedStatus.
self log: 'Stopped service'.
self quitService


I got this by imitating what the new method 'WinService>>handleEvent:type:' contains (in pkg WinService version 1.3).

If we make things more elegant (more similar to what WinService does) I'll publish back the change and note it on this thread.

The folloing package version combination in vw7.7.1 works fine on Xp but not on Win7:
    ServiceStartup (1.3.3, stevek)
    WinService (1.0.13,klnsrgn)


FWIW,
    -Steve


On 10/29/2011 8:18 PM, Steve Whitson wrote:
Thanks Steve for your response.

I did come across the Important comment. 

I tried to add an ObjectMemory quit and also quitWithError: 0 but neither seems to help, the win7 service panel responded that "The process terminated unexpectedly".  Other things I tried with quitting the image was to fork the ObjectMemory quit, and add a delay of 1 to 3 seconds... when 1 second it stated the process terminated unexpectedly, when 3 seconds it didn't think it quit, but the image actually had. 

I also did add in the 'WinServiceInterface current NO_ERROR' return from the block too (NO_ERROR is defined as 0)... but that too didn't work either. Without the ObjectMemory quit the image just kept running (the inner processing our code does did stops the right doRelease method was called, but the image kept going).

I appreciate your help,
    -Steve

On 10/29/2011 11:59 AM, Steven Kelly wrote:

Hi Steve,

 

The WinService 1.1.0 version comment says:

 

Important:

The WinServiceInterface API has changed. Contrary to earlier versions (1.0.x) of this package, the handler block must

- quit the image after stop/shutdown events are handled

- return an error code (usually NO_ERROR)

 

The latest ServiceStartup is based on WinService 1.0.10, and has worked well for us. The roots of both packages are in COAST, but IIRC COAST code for this has evolved quite a bit, so I’m not sure whether looking at current code elsewhere in COAST will be useful or just even more confusing.

 

Unfortunately, there have been about 360 changes to WinService from 1.0.10 to 1.3 – quite a lot for a package which had just one class! This makes it rather difficult to see what needs updating in ServiceStartup. However, from the version comments it looks like most of the changes are just refactoring or moving things to different namespaces. Relatively few seem to be actual bug corrections, so if 1.0.10 works for you, sticking with that might be an option. I’m sure Holger’s refactorings and bug corrections are good, I just haven’t had the time or need to keep ServiceStartup up to date with them.

 

Hopefully Holger can answer your question as to the right way to use the shutdown block these days. Feel free to update ServiceStartup if you get something working.

 

All the best,

Steve

 

 

From: [hidden email] [[hidden email]] On Behalf Of Steve Whitson
Sent: 28. lokakuuta 2011 23:50
To: [hidden email]
Subject: [vwnc] WinService & ServiceStartup

 

Hi,

Would anybody have any insight as to what WinServiceInterface expects as a shutdown block?  The latest version of ServiceStartup in the public repository is out of sync with the latest WinService.  Specifically

Startup>>startAsService: shutdownBlock:
calls WinServiceInterface>>startDispatcherWithHandler:serviceName:startupBlock:
this changed to WinServiceInterface>>startDispatcherWithEventHandler:serviceName:startupBlock

The first parameter to this call is  the shutdown block retained to use in shutting down the service when requested.

With this change made in the ServiceStartup package I can install the service, start the service and all is well.  But, when I got to stop the service it errors.  I found that the method Startup>>serviceShutdownBlock: also needed a change to this shutdown block it returns to accept 3 parameters.  But, I cannot figure out how to properly exit from this block.

I've tried it as it is in the repository, but with 3 parameters (the 1st parameter is the same in the older WinServiceInterface use of this block as it is in the newer use of it).  The Win7 service console doesn't actually kill the image, but our code does do it's socket free operations and stops all its activity, so things are happening as expected, just no image exit.

I've added in an ObjectMemory quit, and ObjectMemroy quitWithError: 0, but both cause the service console (when stopping the service) to think the process terminated unexpectedly...

Does anyone have an updated copy of ServiceStartup by chance, one that matches the API updates to WinService made last month (Sept 9, 2011)?  I'm doing this in VW 7.7.1.

Any help here would be greatly appreciated!
    -Steve




_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc