Tomcat 7 doesn't start after it crashed - crash

My problem is, that I am running a webapp on Tomcat7 on a 2GB 2Core VPS and when the app crashes with heapoverflow exception Tomcat doesn't start or stop. When I try to access it via the browser it just hangs.
If I try to stop it looks like it stops but if I do it repeatedly it is supposed to throw an exception because it's already stopped, but this is not the case. Only after 15 minutes am I able to start it up again.
I know that I should solve the heapoverflow problem, but the thing is I am simply not able as the framework I am using turned out to be nod thread safe and I have to create a new instance of a memory heavy object for every request :( I tried to come round the problem by adding some basic controller which only allows certain amount of objects to be created and the rest of the request are redirected to a Sorry-page. Since it is for a UNI project and the main goal is not being able to serve hundreds of users it's not important to make the framework thread safe.
Still I need to know why Tomcat does it after it crashes. Also it would help if you would have a better idea how to limit the number of these objects being in the memory at the same time.
++++++++++
At the moment the only solution I can see is to get say 2GB of more RAM so I will be able to serve some 15-20 users at a time.

Generally after tomcat crashes with out of memory error it is in unusable state and the process has to be killed either manually or by using
catalina.sh stop -force
For a discussion on how to prevent those out of memory errors see
Dealing with "java.lang.OutOfMemoryError: PermGen space" error
Though ultimately you may need to throw more hardware at the problem.
This might also come handy:
Can I auto restart tomcat jvm on out of memory exception

Related

weblogic stop writing logs and shutdown

Maybe someone had the same problem.
I use Weblogic at work. So, we have two small applications on it. And today it stopped writing logs(all logs stopped writing at the same time). Then, after three hours it writes in log “JVM called WLS shutdown hook. The server will force shutdown now” and shutdown. After start everything works fine.
But I want to understand, why this situation happened
Thanks
This happens when System.exit(int) is called. Check if some of the deployed components call System.exit instead of throwing an Exception. This also can be due to the JVM taking up the OS signals.Set the -Xrs option in the startup scripts in JAVA_OPTIONS if you are using Sun JDK.It reduces use of operating-system signals by the JVM.

HttpWebRequest.EndGetResponse hangs periodically when debugger attached to Unity editor

For various reasons I need to use HttpWebRequest instead of the built-in WWW class to call out to web services in our Unity project. I'm finding that Request.EndGetResponse hangs under certain circumstances. The issue is exacerbated when the debugger is attached--it does happen from time to time without the debugger, but happens close to 100% of the time when the debugger is attached. It is only happening when I'm calling a web service using HTTPS.
I plugged in Wireshark to look at the two traces. Oddly, the trace when the debugger is attached includes a "Handshake Failure" where the trace without the debugger does not. The other interesting thing is that the trace that works includes two [FIN, ACK] messages presumably from other failed attempts.
Ultimately I think I'm running into some known issues with the Mono 2.6 threadpool. That said, I don't understand what EndGetResponse is doing that could cause it to hang--I thought this was a synchronous operation. I also don't understand how attaching the debugger could affect the issue.
If there are any mono experts out there, I'd appreciate any insight!

ASP.MVC 4, Azure Caching: Error on both local and remote - "role discovery data is unavailable"

Whew...ok, been wrestling with this for a while and I can't figure out what is going on.
I am new to Azure caching, but at this point I have read a good bit and I think I have it setup right, but something is obviously wrong so what do I know?
Ok, so first I setup a dedicated caching web worker role using this fine tutorial: http://berniecook.wordpress.com/2013/01/27/distributed-caching-in-azure-cache-worker-role/
I have an ASP.net MVC 4 website that is supposed to be using it.
I have my solution set to multiple starting projects with my cloud caching project set to start first, but no matter what I do, I get the "role discovery data is unavailable".
Sometimes in my output log I get that the Role Environment failed to initialize, but not very often. Most of the time the output log says that is succeeds. Regardless of that, I still get the error above.
I was thinking that maybe the issue was because I was running on local azure storage and compute emulators, so I reconfigured and published the Cloud Service to Azure to see if that helped.
It didn't...
The fun part is that there have been exactly 2 times when it suddenly worked (both when I was working locally). 2 times about of about 100. I didn't do anything different...just ran the debugger and poof, it all worked. This at least lends a bit of credit that it is actually setup correctly.
Needless to say, this is putting a huge damper on my productivity so any advice would be appreciated.
Update
Ok, I have figured out a workaround of sorts...I have learned that the reason that it consistently failed was because the development web server was holding onto a file which prevented the caching server to launch correctly.
The workaround is to stop the web server each and every time I want to recompile and run the code. This is obviously not ideal, so any ways to make this more reliable would be appreciated.
Thanks,
David
I don't know if this helps but I find that if I don't shut down the both the storage and compute emulator, I get weird errors, so after doing an F5 and closing the browser down, I manually shut down both emulators

IIS reset details

What exactly happens when we do IISreset? What resources get released? We have an ASP.Net website (.net 1.1) which use Crystal reports 11. Lately, running reports are throwing several crystal report specific exceptions and then the users can't run reports anymore. Resetting IIS lets the users log back in and run the reports until it fails the next time. Knowing exactly what resources are released when IIS is reset will help us dig deeper to find the root cause. Any help?
Pretty much everything. All thread pools, asp, asp.net, shared memory, etc... will all be purged. Doing in IISReset is basically the same as going to Services->WWW Service->Restart. Also, it will affect SMTP and FTP if you are running these services as well.
To narrow your problem down slightly ( and to reduce impact ), you should try putting your website in its own App Pool. Then when it next hangs, see if restarting the app pool fixes the problem. Then you are limiting things to just one running web application, not completely taking down iis. If the problem persists and still requires an IISReset, you at least have one more datapoint to work with.
EDIT: In response to your additional comment, I would suggest you do as much logging as possible and see if the problem becomes obvious. http://learn.iis.net/page.aspx/579/advanced-logging-for-iis-70---custom-logging/
Obviously, a quick run through Event Viewer is probably a good idea.

Running a groovy application under Maven

We have developed a Groovy application. Under development for starting it we use the following command line
C:\myapp>mvn grails:run-app
Without sending any request to the server one can see how the memory used by the java process in increasing and increasing. When it starts at about 100M are allocated and a couple of hours later -without doind anything- the memory goes up to 300M.
When I start the application directly
C:\myapp> grails run-app
the memory consume is somehow different, without sending any request it is somehow stabilized at 110M. Sometimes goes up, sometimes comes down.
Although 300M is not critical I would like to know if this is a memory leak or not.
Is anybody having similar behaviours?
Thanks!
This could be a memory leak in Maven, but more likely a leak in the grails:run-app command. I would suggest posting this on the Grails development mailing list.
Why does this concern you? You should only be using these commands for development, not production as you'd be deploying a war file in production. If you're simply concerned, the Grails development mailing list is definitely the place for something like this.
I doubt there's a memory leak here.
It's perfectly normal for the JVM to wait on doing a full GC until it has to. That means if you allocate more memory, your java/groovy process will happily consume it.
Most likely you have different default memory settings for Maven vs Grails. I'm not sure exactly how these properties are set in windows, but they look something like:
GRAILS_OPTS="-Xms100m -Xmx110m"
MAVEN_OPTS="-Xms100m -Xmx300m"