Jay Pipes wrote: > Brian Aker wrote: >> Hi! > >> I want to come up with a standard behavior for failure to allocate >> memory. From this blog entry, >> http://ronaldbradford.com/blog/are-you-monitoring-rss-vsz-2009-03-08/,I quote > > >> "Monitoring MySQL Memory is a rather critical task because you cant >> limit MySQLs usage of physical memory resources. Improperly configured >> servers running MySQL can crash because you dont understand memory usage." > >> Right now memory allocation in Drizzle is the same as MySQL, namely the >> behavior is mostly undefined (and allocation failures are not always >> caught). Up till a certain version MySQL did capture these errors in >> most cases, but in recent time these failures have just been ignored. > >> This is my proposal: > >> 1) Any memory failure on startup causes an immediate shutdown. > > +1. This can be entirely done in a single try/catch block in the > drizzled.cc:init_server_components() function. Since it's not > time-critical or threaded code, using std::bad_alloc exception is > perfectly fine here and would clean up a crap-ton of checks for ENOMEM. > >> 2) Memory failure within a session disconnects the session (and frees >> all memory that the session allocated). > > +1. This can also be accomplished with localized exceptions, but more > planning is needed.
We should definitely have localized exceptions... however, we should also have a bad_alloc trap at the top of the thread runner function that can catch any bad_allocs, send an error message and abort the thread before those propagate to somewhere bad. Of course, to do this properly, we need to get all of those new'd pointers in to shared_ptr<>'s so that we don't leak by doing that... >> 3) Failure of memory on connection from the user disallows the login. > > -1 Agree with Monty here...perhaps we should have some fallback routine > to free unneeded memory and attempt to proceed with the sessions' execution? > >> 4) Memory failure in any system other then a session usage causes the >> server to shutdown (and attempts a graceful shutdown). > > +1 > >> What am I missing? Is the above a good policy for design? > >> Cheers, >> -Brian > >> -- >> _______________________________________________________ >> Brian "Krow" Aker, brian at tangent.org >> Seattle, Washington >> http://krow.net/ <-- Me >> http://tangent.org/ <-- Software >> _______________________________________________________ >> You can't grep a dead tree. > > > > >> _______________________________________________ >> Mailing list: https://launchpad.net/~drizzle-discuss >> Post to : [email protected] >> Unsubscribe : https://launchpad.net/~drizzle-discuss >> More help : https://help.launchpad.net/ListHelp > _______________________________________________ Mailing list: https://launchpad.net/~drizzle-discuss Post to : [email protected] Unsubscribe : https://launchpad.net/~drizzle-discuss More help : https://help.launchpad.net/ListHelp _______________________________________________ Mailing list: https://launchpad.net/~drizzle-discuss Post to : [email protected] Unsubscribe : https://launchpad.net/~drizzle-discuss More help : https://help.launchpad.net/ListHelp

