does anyone know how to modify the session timeout and session eviction in Jenkins for Windows? Jenkins starts as a service.
I edited the file jenkinsHome/war/WEB-INF/web.xml adding the tag "session-timeout" as below, but it doesn't seem to work.
<session-config>
<!-- four hours -->
<session-timeout>240</session-timeout>
</session-config>
Thanks.
If you use Jenkins v2.107.1 and later, updating session-timeout is not enough.
You should set the sessionEviction time, which is 30 minutes by default. Try to start your Jenkins with the following JVM OPTS:
JENKINS_OPTS="--sessionTimeout=240 --sessionEviction=240"
Reference: Jenkins Jira
Related
I am using codedeploy to deploy a springboot app to an ec2. But I keep getting a script timeout error. I event set the timeout to 60 seconds event tho the application always starts up within 20 seconds. The application starts up fine. I run top on the linux instance and see the java process started up. I can then use postman to hit the http status check endpoint and confirm that it has started up successfully. But this is what it looks like in the code deploy console:
The appspec.yml file looks like this
The server_start.sh file looks like this.
Why is this happening? Thanks.
I think this has more to do with how Linux process works than with Code Build. I'm far from being a specialist on that, but according to with AWS documentation, there is a certain way you must use to start your long-running processes, as a Java application
The syntax is:
#!/bin/bash
/tmp/sleep.sh > /dev/null 2> /dev/null < /dev/null &
Replace the sleep by your Java command.
More details here
You should put some some codes of your script to the BeforeInstall or AfterInstall.
remove java -jar application.jar
BeforeInstall – You can use this deployment lifecycle event for preinstall tasks, such as decrypting files and creating a backup of the current version.
Install – During this deployment lifecycle event, the CodeDeploy agent copies the revision files from the temporary location to the final destination folder. This event is reserved for the CodeDeploy agent and cannot be used to run scripts.
AfterInstall – You can use this deployment lifecycle event for tasks such as configuring your application or changing file permissions.
ApplicationStart – You typically use this deployment lifecycle event to restart services that were stopped during ApplicationStop.
Then create another bash script for your ApplicationStart. Put the line your removed earlier on this script.
I am in a situation where I have to deploy two war files in my tomcat . Using
tomcat.apache.org/download-70.cgi#7.0.50
I have a windows server 2003 machine with 3GB RAM. setenv.bat configuration is
set JAVA_OPTS=-XX:MaxPermSize=1024m -Xms256M -Xmx2048M %JAVA_OPTS%
Now,
What works:
When running tomcat with startup.bat. Everything runs fine the way I want.
What does not work :
I installed tomcat as a service. Made same configurations in Tomcat7w.exe . But was will not deploy , on deploying second war stage it just stucks. No errors at all.
Also, when I run tomcat as a service without war files, it runs successfully.
Can anyone please help me out.
Thanks
Arvind
I do not post many questions but I get to the answers by myslef. Should have tried more and then post here. Thank you guys if you are looking out for a solution. I fixed it by changing memory setting. I had to do a number of tests on these memory settings and finally one of them worked.
So for this deployment I kept 1024MB for XMx and perm size of 412 MB and it worked.
Cheers!
I'm using the MsOpenTech version of Redis on a Windows 2008 server. I've installed via the RedisWatcher Service as described here, and this is working fine - the server is responding and data going in and out nicely, running multiple instances etc - so great.
I have one problem though - i'm attempting to use a redis.conf file to set some default configuration; the .conf file being stored in the same directory as redis-server.exe, namely c:\redis\bin
The config changes themselves are straighforward, i'm simply setting timeout to 20 seconds, thus:
timeout 20
but when I run the watcher service, connect to the server via the command line and do config get timeout, it returns 0
I've tried to restart the watcher service after making the updates to config. I've tried passing in the timeout value directly in the watcher.conf file for the service, like
cmdparms --timeout 20
and this doesn't work. I've attempted the same on a second instance, same results.
Interestingly, if I start a second instance of the redis server within the watcher, thus:
{
workingdir c:\redis\inst2
runmode hidden
saveout 1
cmdparms --port 6380
}
this works, respecting the --port argument and kicking off a second instance at port 6380. Although as mentioned above, passing a --timeout parameter or a config file parameter to this instance is not working either.
Setting configuration via the command line works fine, ie, when connected to redis:
config set timeout 20
This sets the timeout as expected, but obviously doesn't persist the setting beyond that session. This being version 2.6 of redis, I don't have access to the config rewrite command, so can't get around it that way.
Any ideas welcome.
In the end the answer was simple. Restarting the RedisWatcher service does not restart the redis-server.exe process.
Manually stopping this process and restarting via the watcher made the config changes be picked up.
I've been struggling with an annoying "Jenkins/Tomcat/Windows" problem for a while now without reaching any solution.
I've installed Tomcat version 7.0.25 in a Windows 7 Enterprise machine and Jenkins 1.451 as a webapplication
running under Tomcat. I have just 4 jobs configured right now and all of then are using the "Always chekout a fresh copy" checkout strategy,
so everytime a job runs the content in /jobs//workspace gets deleted. But, there are situations in which the job fails to run because
it is unable to delete the /jobs//workspace/pom.xml file like you can see in this (edited) stacktrace:
Building in workspace C:\.hudson\jobs\<task name>\workspace
Cleaning local Directory .
java.io.IOException: Unable to delete C:\.hudson\jobs\<task name>\workspace\.\pom.xml
at hudson.Util.deleteFile(Util.java:237)
at hudson.Util.deleteRecursive(Util.java:287)
at hudson.Util.deleteContentsRecursive(Util.java:198)
at hudson.scm.subversion.CheckoutUpdater$1.perform(CheckoutUpdater.java:73)
at hudson.scm.subversion.WorkspaceUpdater$UpdateTask.delegateTo(WorkspaceUpdater.java:136)
at hudson.scm.SubversionSCM$CheckOutTask.perform(SubversionSCM.java:780)
at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:761)
at hudson.scm.SubversionSCM$CheckOutTask.invoke(SubversionSCM.java:745)
at hudson.FilePath.act(FilePath.java:788)
at hudson.FilePath.act(FilePath.java:770)
at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:735)
at hudson.scm.SubversionSCM.checkout(SubversionSCM.java:677)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1195)
at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:576)
at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:465)
at hudson.model.Run.run(Run.java:1409)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:481)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:238)
Retrying after 10 seconds
Here you can see Tomcat locking the file as I told:
After some time Jenkins/Tomcat releases the lock on the pom.xml and i can execute the job again without any problem.
Does anyone know how to get around this ? Am i missing something ? Thanks in advance!
I changed to Windows Service installation, and the pom.xml never gets locked anymore.
Seems that this caused by Tomcat that somehow locks the pom.xml, although the build has finished.
at the moment jenkins build my project and at the end the artifact is deployed on a remote tomcat via jenkins deploy plugin.
the problem is that after several redeployments this process fails (sometimes tomcat hangs or (un)deployment fails). in all cases stopping tomcat and manually undeploying helps.
Is there a way to stop tomcat before building/deploying, delete the old war and appfolder, and restart tomcat before deploy plugin wants to deploy the artifact?
thx in advance
You could write a batch file that does all the things mentioned:
stop tomcat
delete war files
start tomcat again
Then you can add a new pre/post build task in job configuration as execute batch and simply point it to run your batch file.
Added:
You can use PsExec - http://technet.microsoft.com/en-us/sysinternals/bb897553 It allows you to run processes remotely. Put batch on remote machine and from local one using Jenkins run sth like this: PsExec.exe \xx.xx.x.x C:\MyScript.bat
one addition to accepted answer:
it is important to reroute the output and error output of PsExec call (took me 2 days of debugging). See http://jenkins.361315.n4.nabble.com/remotely-executing-commands-td3476417.html
it seems that if called from java (like jenkins/tomcat) or .net PsExec hangs or quits with error. so the call should look like:
c:\someBatchWithPsExec.bat >>log.txt>&1
or explicitly on every call:
PsExec.exe -u [domain\remoteuser] -p [password] /accepteula \remoteMachine net [stop|start] Tomcat7 >>log.txt>&1
i guess if jenkins runs with domain\user u don't have to mention it in command?! (just tried it but it didn't work - the net commands fail)