Bamboo Deployment Wait Until No Quartz Jobs With Grails - memory-leaks

I'm using Bamboo to build, test, and deploy commits to a server. However, every once in a while I get a failed deployment on the Tomcat end. Bamboo doesn't know this happened, so I have to run a manual build when the application doesn't start properly.
As far as I can tell, it's due to running Quartz tasks. Is there a way to safely deploy the WAR but wait until all jobs are done? Is better to build the plan to first undeploy before deploying?
I've pulled my Catalina logs to highlight the issue:
Sep 12, 2012 12:01:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/emdb] appears to have started a thread named [quartzScheduler_Worker-3] but has failed to stop it. This is very likely to create a memory leak.
Sep 12, 2012 12:01:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/emdb] appears to have started a thread named [quartzScheduler_Worker-4] but has failed to stop it. This is very likely to create a memory leak.
Sep 12, 2012 12:01:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/emdb] appears to have started a thread named [quartzScheduler_Worker-5] but has failed to stop it. This is very likely to create a memory leak.
Sep 12, 2012 12:01:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/emdb] appears to have started a thread named [quartzScheduler_Worker-6] but has failed to stop it. This is very likely to create a memory leak.
Sep 12, 2012 12:01:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/emdb] appears to have started a thread named [quartzScheduler_Worker-8] but has failed to stop it. This is very likely to create a memory leak.
Sep 12, 2012 12:01:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/emdb] appears to have started a thread named [quartzScheduler_Worker-10] but has failed to stop it. This is very likely to create a memory leak.
Sep 12, 2012 12:01:14 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/emdb] appears to have started a thread named [Thread-212] but has failed to stop it. This is very likely to create a memory leak.
Sep 12, 2012 12:01:15 PM org.apache.catalina.startup.HostConfig checkResources
INFO: Undeploying context [/emdb]
Sep 12, 2012 12:01:16 PM org.apache.catalina.startup.ExpandWar deleteDir
SEVERE: [....webapps\emdb\WEB-INF\lib] could not be completely deleted. The presence of the remaining files may cause problems
Sep 12, 2012 12:01:16 PM org.apache.catalina.startup.ExpandWar deleteDir
SEVERE: [....webapps\emdb\WEB-INF] could not be completely deleted. The presence of the remaining files may cause problems
Sep 12, 2012 12:01:16 PM org.apache.catalina.startup.ExpandWar deleteDir
SEVERE: [....webapps\emdb] could not be completely deleted. The presence of the remaining files may cause problems
Sep 12, 2012 12:01:16 PM org.apache.catalina.startup.ExpandWar delete
SEVERE: [....webapps\emdb] could not be completely deleted. The presence of the remaining files may cause problems
Sep 12, 2012 12:01:17 PM org.apache.catalina.startup.HostConfig deployWAR

You are right, Quartz scheduler is not stopping threads created to run jobs (worker thread pool). You need to call QuartzScheduler.shutdown(boolean) method when application shuts down. I'm surprised that Grails Quartz plugin is not doing it for you.
There are other reasons for this to happen. You might have some running jobs and Quartz hangs waiting for them to finish (even when proper shutdown was called). Tomcat is impatient and kills the whole thing in the middle. Check out (uncodumented?) org.quartz.scheduler.interruptJobsOnShutdown and org.quartz.scheduler.interruptJobsOnShutdownWithWait options.
Note that ShutdownHookPlugin won't help you since you are not shutting down the whole JVM, only undeploying one application.
Also the error message lists Thread-212 as one of the causes. This is most likely your custom thread (always name threads!) which also has to be interrupted.
See also
Quartz Scheduler not stopping after shutdown

Related

Warning appearing in my various Vaadin 14 apps: Invalid security key received from 0:0:0:0:0:0:0:1

When running my various Vaadin 14.0.x and 14.1.x apps locally on my macOS Mojave machine from IntelliJ 2019 Ultimate edition via Tomcat 9.0.27 with Java 13.0.1 with Chrome browser 78, I see this message appear on the console one or more times about Invalid security key received from 0:0:0:0:0:0:0:1:
[webpack] INFO dev-webpack - Watchdog connection closed. Trying to re-run watchdog.
[webpack] INFO dev-webpack - Watchdog connected.
[http-nio-8080-exec-8] WARN com.vaadin.flow.server.communication.UidlRequestHandler - Invalid security key received from 0:0:0:0:0:0:0:1
➥ What does the message mean?
➥ How do I resolve the problem?
I am using a Vaadin 14 project created by the Get started with Vaadin page. The messages shown above appear the first time I click the Click me button created by default with that starter app.

Why does Asp.net 5 (DNX) w3wp.exe crash on IIS 7.5

My team's Asp.net 5 web app (1.0.0-rc1-update1) is getting w3wp.exe crashes on IIS 7.5 (Windows Server 2008 R2) both when restarting IIS and intermittently during normal operation of two load balanced instances.
It seems to be the same error as in the following github issue. The error and fault info are nearly identical:
https://github.com/aspnet/IISIntegration/issues/35
'w3wp.exe' (Win32): Loaded 'C:\Windows\System32\apphelp.dll'. Symbols loaded.
The thread 0x6f54 has exited with code 0 (0x0).
Unhandled exception at 0x000000007717298A (ntdll.dll) in w3wp.exe: 0xC000070A: Status 0x (parameters: 0xFFFFFFFFC0000008, 0x00000000000002F8, 0x00000000003E59F0, 0x000000000038A280, 0x000007FEF4CF88F4).
Exception thrown at 0x000007FEF4CF88F4 in w3wp.exe: 0xC0000005: Access violation executing location 0x000007FEF4CF88F4.
Unhandled exception at 0x000007FEF4CF88F4 in w3wp.exe: 0xC0000005: Access violation executing location 0x000007FEF4CF88F4.
The program '[4540] w3wp.exe' has exited with code 0 (0x0).
This issue does not appear for us on IIS 8 with Windows 2012 R2. It seems to be an underlying HttpPlatformHandler or DNX stability issue with IIS 7.5 vs 8.
Are others seeing this problem? Has anyone seen an easier workaround for this issue than upgrading the windows/iis version? It does not seem to be deterministically triggered by our application code. The github issue has not been updated for some time and unfortunately we may not be equipped to do crash dump analysis or process debugging.
Re: HttpPlatform Log
I turned on the HttpPlatform log using the webconfig setting:
<httpPlatform processPath="..\approot\web.cmd" arguments="" stdoutLogEnabled="true" stdoutLogFile="..\logs\stdout.log" startupTimeLimit="3600"></httpPlatform>
The startup is logged as usual on initialization, but doesn't log an error when the crash is reproduced:
Hosting environment: XXXXXX
Now listening on: http://localhost:XXXX
Application started. Press Ctrl+C to shut down.
I had the same issue and it's coming from a bug in aspnetcore.dll (https://github.com/aspnet/AspNetCoreModule) occuring on a few given combination of Windows (7 for instance) & IIS (7.5 for instance). You can find this module somewhere in your c:\windows\systemXXX.
When I get the lastest from GitHub dev branch, it's fixed for me.
I believe the fix lies in the changelist: https://github.com/aspnet/AspNetCoreModule/pull/59
This version is not officially delivered yet and is not packaged in the 7.1.1971 version of the DLL which is the latest as of now.

azure role not starting after windows update 10February

After installation of windows update on 10th February 2016, the azure roles are not starting in emulator (Full/Express).
The logs show below
[00005748:00006624, 2016/02/14, 12:03:24.391, FATAL] Role process exited with exit code of -2147024809
[00005748:00006624, 2016/02/14, 12:03:24.397, INFO ] Stopping role: deployment25(0).AzureCloudService2.WebRole1_IN_0. Notify: False Recycle: False StopTimeout: 30
[00005748:00006624, 2016/02/14, 12:03:24.398, IMPRT] State of deployment25(0).AzureCloudService2.WebRole1_IN_0 changed from RoleStateBusy to RoleStateStopping.
[00005748:00006624, 2016/02/14, 12:03:24.398, IMPRT] State of deployment25(0).AzureCloudService2.WebRole1_IN_0 changed from RoleStateStopping to RoleStateStopped.
[00005748:00006624, 2016/02/14, 12:03:24.398, ERROR] <- WapGetEnvironmentVariable=0x800700cb
[00005748:00006624, 2016/02/14, 12:03:24.398, WARN ] (Ignoring) Reading environment variable CleanupFirewallOnRoleRestart failed with HR: 800700cb
[00005748:00006624, 2016/02/14, 12:03:24.398, INFO ] The value of cleanupFirewallOnRoleRestart is set to True
[00005748:00006624, 2016/02/14, 12:03:24.398, WARN ] Attempting to recover role deployment25(0).AzureCloudService2.WebRole1_IN_0.
[00005748:00006624, 2016/02/14, 12:03:24.399, ERROR] Failed to create FSRM quota manager instance.
Update 14 Feb 2016
Looks like if i use full IIS (not IIS Express) and Full Emulator it works but if i select Express emulator (i can only select IISExpress) it does not*
As I have run into the same issue, I tried to uninstall the updates one by one and came down to the one causing the issue: KB3126593.
To verify, I installed all the updates again, except this one, emulator still started properly. After installing the problematic one, emulator stopped working, resumed after uninstalling it again.
I am using quite old Azure Tools v2.6, maybe this is fixed for the newer versions, cannot try this for myself unfortunately.
On my side, both Full and Express emulators were failing, both tried with IIS Express (not using full IIS).
Hope this helps!
Update 18 Feb 2016
I tried to contact Microsoft Azure Support to report this problem, also leading them to this StackOverflow question for more detailed information. They did not seem to care so much, because I don't have an appropriate paid support plan (quite frustrating). If there is anyone who would report this with a valid support plan, I am free to provide any info needed.
Update 22 Feb 2016
Microsoft Azure Support finally started to solve it, it has been reproduced and dispatched to the production team! The only workaround they presented is to use Full IIS in the meantime.
Uninstalling Windows Update KB3126593 solved the problem, but after the Windows update of patch day April 12th 2016, the emulator did not start again. By successively uninstalling the updates, I identified KB3147071 to be the culprit. I reinstalled all the other updates and excluded KB3147071 from further updates and now the emulator works again.
I use Azure 2.7 and ran into the same problem. After uninstalling Windows Update KB3126593 it worked. In the post-installation information section of that update, Microsoft mentions certain error messages that might show up in the event log. I installed the fix again and tried to start a worker (which failed of course), but I did not see any of the described messages. Then I added the registry key HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Safe Load Prefixes with the value 'C:\'. However, I still could not launch the worker role. So I uninstalled the update again and then launching worked. Just to share my experience with my attempt of having both: the Windows update and a working compute emulator.

MSDTC component generated an exception in Windows 2012 server

My Dotnet 4.0 application recieving messages from IBM MQ and putting into database. It is using Distributed transactions. In windows 2012 server sometimes MSDTC is throwing below error.
An MS DTC component has generated an exception. Error Specifics: The process '"D:\test\sampleApp.exe" "D:\test\sampleApp.exe.config"' hit an exception in a MSDTC related component.
The following exception (0xc0000005) was generated at 0x 4DFA7E9F, Pid:8788.
The process is being terminated.
Additional information useful in a debugger:
You can do '.exr 0x0585E680' to display the exception record.
You can do '.cxr 0x0585E6D0' to display the context at the time of the exception.
0
I found the answer to my question. we installed IBM MQ v7.0 version and this version of MQ is not certified with windows 2012 server.

Error running Azure emulator: Error 5048

I just moved from one machine to another, so everything is freshly installed (WIndows 7, VS 2012, SQL 2008, Azure 1.8, IIS) and I am getting the errors:
Site 1273337584 was disabled because the root application defined for
the site is invalid. See the previous event log message for
information about why the root application is invalid.
and
The application '/' belonging to site '1273337584' has an invalid
AppPoolId 'ff257d89-eddd-4724-9cbb-66a3f05590ef' set. Therefore, the
application will be ignored.
On my local machine. Any idea why this is happening? What did I forget to set up?

Resources