Hi Risto,

Sec process is seen as:
/usr/bin/perl -w /usr/bin/sec -detach -pid=/run/sec-tomcat.pid -conf=/etc/sec/tomcat.sec --debug=6 --dump=/tmp/sec-tomcat.dump --nochildterm -log=/var/log/sec-tomcat --nointevents -input=/var/log/tomcat/catalina.out

Unfortunately, --nochildterm option does not fix the problem. I cannot find the dump file, I tried to specify it in the start script (--dump=/tmp/sec-tomcat.dump), but without result.

The command "ps wuaxf" does not reveal how the child process:
# ps wuaxf
root     31114  0.1  0.2 150232  9724 ?        S    13:42   0:01 /usr/bin/perl -w /usr/bin/sec -detach -pid=/run/sec-tomcat.pid -conf=/etc/sec/tomcat.sec --debug=6 --dump=/tmp/sec-tomcat.dump --nochildterm -
root     31214  4.8  6.8 3756928 266000 ?      Sl   13:44   0:39 /opt/java-8-sun/jre/bin/java -Djava.util.logging.config.file=/opt/tomcat-7.0.55/conf/logging.properties -Djava.util.logging.manager=org.apache

In my restart-tomcat.sh: 
kill -9 `cat /run/tomcat-7.0.55.pid` ; sleep 5 ; /opt/tomcat-7.0.55/bin/startup.sh

In the attachment native scripts of Apache Tomcat: startup.sh and catalina.sh

Trap will try if nothing else helps.

Can you something else advise?

Attachment: catalina.sh
Description: Binary data

Attachment: startup.sh
Description: Binary data



-- 
WBR
Yuri Kazankin
yuni...@yahoo.com

On 31 июля 2016 г., at 22:23, Risto Vaarandi <risto.vaara...@gmail.com> wrote:

hi Yuri,
my apologies for not answering earlier -- your e-mail landed in my spam folder initially :(

I am suspecting that your application is started in a way which makes it a child process of sec. However, when sec shuts down, it sends the TERM signal to all its child processes by default. If the shell process that is executing the content of /opt/scripts/restart-tomcat.sh is still running, this process will get the TERM signal as well. Therefore, if the application was started with the shell 'exec' directive that replaces the shell process with the application process, it is actually your application which gets the TERM signal.

In order to find out whether your application is running as a child process of sec, send the USR1 signal to the sec process which creates the dump file (by default located at /tmp/sec.dump). This file contains detailed information about internal state of sec, and also provides a list of all child processes.

If your application is indeed stopping because of the TERM signal from sec, there are couple of workarounds:
1) start sec with the --nochildterm command line option which disables sending TERM to child processes,
2) include a 'trap' statement in /opt/scripts/restart-tomcat.sh that would ignore the TERM signal (e.g., trap '' 15)

Also, if your application is terminating for other reasons than TERM signal from sec, can you share the content of /opt/scripts/restart-tomcat.sh?

Hope this helps,
risto



2016-07-29 13:55 GMT+03:00 Yuri Kazankin <yuni...@yahoo.com>:
Hello!

I have a problem with sec 2.7.10

I created the instance:
# cat /etc/sysconfig/sec
OPTIONS_tomcat="-input=/var/log/tomcat/catalina.out”


and configured via systemd
# cat /lib/systemd/system/sec@.service
[Unit]
Description=Simple Event Correlator (instance %I)
After=syslog.target

[Service]
Type=forking
PIDFile=/run/sec-%I.pid
ExecStart=/usr/bin/sec -detach -pid=/run/sec-%I.pid -conf=/etc/sec/%I.sec --debug=6 --nochildterm -log=/var/log/sec-%I --nointevents $OPTIONS_%I
EnvironmentFile=/etc/sysconfig/sec

[Install]
WantedBy=multi-user.target


My rules restart the application after the event in the log:
# cat /etc/sec/tomcat.sec
type=SingleWithSuppress
ptype=RegExp
pattern=(^.+OutOfMemoryError.+$)
desc=Tomcat restarted after OutOfMemoryError Exception
action="" /opt/scripts/restart-tomcat.sh
window=300

And it works great! But after the event, if I try to execute a restart of the instance (systemctl restart sec@tomcat), my application stops(((
I can not understand why this is happening and how to fix it ...


--
WBR
Yuri Kazankin
yuni...@yahoo.com


------------------------------------------------------------------------------
_______________________________________________
Simple-evcorr-users mailing list
Simple-evcorr-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users


------------------------------------------------------------------------------
_______________________________________________
Simple-evcorr-users mailing list
Simple-evcorr-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simple-evcorr-users

Reply via email to