BlazeDS won't 'close' db connections

48 views
Skip to first unread message

Mario Talavera

unread,
Mar 15, 2010, 10:04:28 AM3/15/10
to Adobe Developers of Greater Orlando
Help!

I am writting a Flex/Java app. In a nutshell, it polls a backend
(Java Dao) every so often. This java method, in turn, fetched
information from a database.

Its a thing of beauty which will allows (will) to monitor obscenely
complex processes; makes for a sweet demo.

I'm stumped at Flex opening a db connection for every request. Before
long, I have 100+ open connections :( Looking at connections in MySQL
workbench, I see all these 'sleeping' connections which Bazeds won't
drop unless I cycle the service.

If my app dies, it gives
'org.hibernate.exception.jdbcconnectionexception: cannot open
connection'. If I manually kill a few connections in MySQL workbench,
all is well again (until I run out of connections again).

I thought I was mismanaging my connections in Hibernate but no changes
in cfg (even with c3p0) bear fruit. Calling method form eclipse does
not do this; only when called from flex app.

Has anyone run into anything similar? Any bits of wisdom? Thanks…

Mario

Brian LeGros

unread,
Mar 15, 2010, 10:34:21 AM3/15/10
to Adobe Developers of Greater Orlando
@Mario - Looks like the max pool size in c3po defaults to 100 (https://
www.hibernate.org/214.html), did you try changing <property
name="c3p0.max_size">5</property> or something along those lines?
Also if you're using Spring, then look at the datasource you're using,
it's possible that you're using a datasource which doesn't do
connection pooling and just need to switch to one that does. Just
some suggestions.

-Brian

Mario Talavera

unread,
Mar 15, 2010, 10:57:48 AM3/15/10
to Adobe Developers of Greater Orlando
Brian,

I have set min/max to everything from 0-3, 1-5, etc. to little effect
regarding connections listed on mysql workbench. It does allow me to
better control/manage whatever connections I use. They just won't
'drop' not seemingly get reused. It just looks like Blazeds opens a
conn, uses it and then conn lingers (in 'sleep') forever or until I
manually kill it or cycle Blazeds.

Fun thou... always fun. I'll keep thread updated as to what happens
and thanks lots.


On Mar 15, 10:34 am, Brian LeGros <legr...@gmail.com> wrote:
> @Mario - Looks like the max pool size in c3po defaults to 100 (https://www.hibernate.org/214.html), did you try changing <property

Maxim Porges

unread,
Mar 15, 2010, 12:05:08 PM3/15/10
to ad...@googlegroups.com
To Brian's point, BlazeDS shouldn't do anything with your database connections; it's all based on the library that you are using in Java to deal with connection management. For giggles, try switching to a single connection datasource and see if you still have issues. Spring has one you can try.

--
You received this message because you are subscribed to the Google Groups "Adobe Developers of Greater Orlando" group.
To post to this group, send email to ad...@googlegroups.com.
To unsubscribe from this group, send email to adogo+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/adogo?hl=en.


Mario Talavera

unread,
Mar 15, 2010, 1:12:29 PM3/15/10
to Adobe Developers of Greater Orlando
Brian and Max,

Thanks a ton guys; I am an idiot. On java method I was creating a
session, then a factory... Working, then closing session but not
factory. I assumed killing session was end of work but then that one
connection lingered (asleep) forever.

Flex app has been running now for almost an hour now and hasn't died
nor have connections gone up forever either. Actually, connections
follow c3p0 settings in cfg now. Yay!

Thanks again.

On Mar 15, 12:05 pm, Maxim Porges <maxim.por...@gmail.com> wrote:
> To Brian's point, BlazeDS shouldn't do anything with your database connections; it's all based on the library that you are using in Java to deal with connection management. For giggles, try switching to a single connection datasource and see if you still have issues. Spring has one you can try.
>

> http://static.springsource.org/spring/docs/2.5.x/api/org/springframew...

Reply all
Reply to author
Forward
0 new messages