System exit:withObject:

VA Smalltalk is a "100% VisualAge compatible" IDE that includes the original VisualAge technology and the popular VA Assist and WidgetKit add-ons.

Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig

System exit:withObject:

Postby PhotonDemon » Mon May 10, 2010 1:36 pm

Hi All,

I have a bunch of NT services written with VAST 5.5.2. Some of them can detect an error with MS/SQL. At that point I want to exit with an error code so Windows will treat the exit as a failure and restart the service. The hope is that the error will go away. The following code is called to exit:

Code: Select all
System exit: -99 withObject: nil

It seems to work fine but the text log contains a stack trace of a few lines, basically complaining about the error exit. This isn't a big deal but it would be nice not to have these extra lines in the log. The code ends up calling the following:

Code: Select all
primitiveExit: errorCode withObject: anObject

   "Exit the image without shutting it down."

   <primitive: VMprSystemConfigurationPrimitiveExitWithObject>
   ^self primitiveFailed

As you can see it calls a primitive, so I can't tell if there are any circumstances that would exit without the stack trace. I have looked through SystemPrimitiveErrors and found PrimErrInternalError, that I could use instead of -99 if it would exit without the stack trace. When I execute:
Code: Select all
System exit: -99 withObject: nil
or
Code: Select all
System exit: SystemPrimitiveErrors::PrimErrInternalError withObject: nil
in the development environment, a window pops up to notify me of the error exit. Given both seem to exit the same way, I fear they would both result in a stack trace in the log, thus getting me no-where. If anyone has any knowledge of this area, I would like to hear about it.

Thanks, Lou
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:Lou@Keystone-Software.com http://www.Keystone-Software.com
PhotonDemon
[|]
 
Posts: 176
Joined: Thu Dec 20, 2007 1:45 pm

Re: System exit:withObject:

Postby wembley » Tue May 18, 2010 10:12 am

Lou -

Try:
Code: Select all
System exit: 9001 withObject: nil
John O'Keefe [|], Principal Smalltalk Architect, Instantiations Inc.
wembley
Moderator
 
Posts: 405
Joined: Mon Oct 16, 2006 3:01 am
Location: Durham, NC

Re: System exit:withObject:

Postby PhotonDemon » Tue May 18, 2010 1:54 pm

Thanks John, that looks good :D
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:Lou@Keystone-Software.com http://www.Keystone-Software.com
PhotonDemon
[|]
 
Posts: 176
Joined: Thu Dec 20, 2007 1:45 pm

Re: System exit:withObject:

Postby wembley » Tue May 18, 2010 2:50 pm

OK, any value between 9001 and 9099 will work. I guess I should add this to the Programmer's Refernce. Case 46405 opened.
John O'Keefe [|], Principal Smalltalk Architect, Instantiations Inc.
wembley
Moderator
 
Posts: 405
Joined: Mon Oct 16, 2006 3:01 am
Location: Durham, NC

Re: System exit:withObject:

Postby marten » Wed May 19, 2010 1:17 am

wembley wrote:Lou -

Try:
Code: Select all
System exit: 9001 withObject: nil


I would like to know, what does the parameter withObject: actually do ?
Marten Feldtmann, Principal Smalltalk User, Private
SkypeMe callto://marten.feldtmann
marten
[|]
 
Posts: 641
Joined: Sat Oct 14, 2006 7:10 am
Location: Hamburg - Germany

Re: System exit:withObject:

Postby PhotonDemon » Wed May 19, 2010 6:12 am

Good question Marten, I've been meaning to ask the same thing.
Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:Lou@Keystone-Software.com http://www.Keystone-Software.com
PhotonDemon
[|]
 
Posts: 176
Joined: Thu Dec 20, 2007 1:45 pm

Re: System exit:withObject:

Postby wembley » Wed May 19, 2010 6:45 am

marten wrote:I would like to know, what does the parameter withObject: actually do ?


The short answer is "nothing".

The long answer (for those who don't like short answers) is "it is passed back through the VM's call stack until it gets to a routine which uses it if the VM is tracing the operation of the bytecode interpreter (which it never is, at least not in any VM we ship)".
John O'Keefe [|], Principal Smalltalk Architect, Instantiations Inc.
wembley
Moderator
 
Posts: 405
Joined: Mon Oct 16, 2006 3:01 am
Location: Durham, NC

Re: System exit:withObject:

Postby jvdsandt » Fri May 28, 2010 4:36 am

Hello,

We also have some NT services implemented in VA Smalltalk (version 8.0). They work fine only we cannot get the auto-restart to work. When some problem in the application occurs like a lost database connection we do a "System exit: 9001 withObject: nil". We have set the recovery options to "Restart the Service" but Windows refuses to restart our service.

The restart does work when we kill the process using the "End process" option of the Windows task manager. But nothing happens after a System exit.

Is this normal behavior or are we missing something?

Regards,
Jan.
jvdsandt
 
Posts: 15
Joined: Sun Nov 23, 2008 8:46 am


Return to VA Smalltalk 7.0, 7.5 & 8.0

Who is online

Users browsing this forum: No registered users and 1 guest