We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

micke
Posts: 5
Joined: Tue Jun 20, 2006 12:44 pm

Service stopped on logout by RDP / console

I run my java application installed by advanced installer as a service. If I then use remote destop to connect to the server using /console mode the service terminates when the user loggs out from the remote desktop session. I found this when googling for the problem "If you remote into a console, do not log off if there are programs or services running that need to interact with the desktop. You should disconnect instead."

Is there a workaround for this in advanced installer or is the solution to not use console mode when having services installed by advanced installer?
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Service stopped on logout by RDP / console

Hi,

I'm afraid this behavior is not related to Advanced Installer, most likely it can be reproduced with any installed service. Also, I'm not sure what the solution may be. You could try the "/admin" option instead of "/console".

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
micke
Posts: 5
Joined: Tue Jun 20, 2006 12:44 pm

Re: Service stopped on logout by RDP / console

I have another java application running using Java Service Wrapper http://wrapper.tanukisoftware.org and that service does not have the same problem. Service control events are handled in a callback in the Service Class implementing WrapperListener.
void controlEvent(int event)

Called whenever the native wrapper code traps a system control signal against the Java process. It is up to the callback to take any actions necessary. Possible values are: WrapperManager.WRAPPER_CTRL_C_EVENT, WRAPPER_CTRL_CLOSE_EVENT, WRAPPER_CTRL_LOGOFF_EVENT, WRAPPER_CTRL_SHUTDOWN_EVENT, WRAPPER_CTRL_TERM_EVENT, or WRAPPER_CTRL_HUP_EVENT.

The WRAPPER_CTRL_C_EVENT will be called whether or not the JVM is controlled by the Wrapper. If controlled by the Wrapper, it is undetermined as to whether the Wrapper or the JVM will receive this signal first, but the Wrapper will always initiate a shutdown. In most cases, the implementation of this method should call WrapperManager.stop() to initiate a shutdown from within the JVM. The WrapperManager will always handle the shutdown correctly whether shutdown is initiated from the Wrapper, within the JVM or both. By calling stop here, it will ensure that the application will behave correctly when run standalone, without the Wrapper.

WRAPPER_CTRL_CLOSE_EVENT, WRAPPER_CTRL_LOGOFF_EVENT, and WRAPPER_CTRL_SHUTDOWN_EVENT events will only be encountered on Windows systems. Like the WRAPPER_CTRL_C_EVENT event, it is undetermined as to whether the Wrapper or JVM will receive the signal first. All signals will be triggered by the OS whether the JVM is being run as an NT service or as a console application. If the JVM is running as a console application, the Application must respond to the CLOSE and LOGOFF events by calling WrapperManager.stop() in a timely manner. In these cases, Windows will wait for the JVM process to exit before moving on to signal the next process. If the JVM process does not exit within a reasonable amount of time, Windows will pop up a message box for the user asking if they wish to wait for the process or exit or forcibly close it. The JVM must call stop() in response to the SHUTDOWN method whether running as a console or NT service. Usually, the LOGOFF event should be ignored when the Wrapper is running as an NT service.

WRAPPER_CTRL_TERM_EVENT events will only be encountered on UNIX systems.

If the wrapper.ignore_signals property is set to TRUE then any WRAPPER_CTRL_C_EVENT, WRAPPER_CTRL_CLOSE_EVENT, WRAPPER_CTRL_TERM_EVENT, or WRAPPER_CTRL_HUP_EVENT events will be blocked prior to this method being called.

Unless you know what you are doing, it is suggested that the body of this method contain the following code, or its functional equivalent.

public void controlEvent( int event )
{
if ( ( event == WrapperManager.WRAPPER_CTRL_LOGOFF_EVENT )
&& ( WrapperManager.isLaunchedAsService() || WrapperManager.isIgnoreConsoleLogouts() ) )
{
// Ignore
}
else
{
WrapperManager.stop( 0 );
}
}

Is it not possible do something like that in advanced installer?
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Service stopped on logout by RDP / console

Hi,

Perhaps the problem is caused by the Java Virtual machine. You can try using the "Reduced usage of operating-system signals" option in the Edit JVM Parameters dialog.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
micke
Posts: 5
Joined: Tue Jun 20, 2006 12:44 pm

Re: Service stopped on logout by RDP / console

I tried to use "Reduced usage of operating-system signals" and it solved the problem!

Thank you for the quick response,

Regards
Mikael

Return to “Common Problems”